Ghidrust provides a hyper fast, AI native reverse engineering platform built in Rust, inspired by Ghidra. Includes experimental GPU kernels to rapidly decompile large files, a decryption suite, and network monitor for packet to binary reverse engineering.
Fix Linux CLI build: cfg-gate winres in build scripts.
oofzb3928d1f2bf3
diff --git a/crates/ghidrust-cli/build.rs b/crates/ghidrust-cli/build.rsindex e6733e1..abdc779 100644--- a/crates/ghidrust-cli/build.rs+++ b/crates/ghidrust-cli/build.rs@@ -1,13 +1,20 @@fn main() {- let target_os = std::env::var("CARGO_CFG_TARGET_OS").unwrap_or_default();- if target_os != "windows" {- return;- }-- let mut res = winres::WindowsResource::new();- res.set_icon("assets/ghidrust.ico");- if let Err(err) = res.compile() {- // Keep non-MSVC / missing-RC toolchains buildable; icon is best-effort.- println!("cargo:warning=windows icon embed skipped: {err}");+ // Build scripts compile for the *host*. `winres` is only a+ // `[target.'cfg(windows)'.build-dependencies]` crate, so a runtime+ // `CARGO_CFG_TARGET_OS` check alone still type-checks `winres::` on Linux+ // hosts and fails with E0433. Compile-gate the call on host `cfg(windows)`,+ // and still skip when the *target* is not Windows (cross builds).+ #[cfg(windows)]+ {+ let target_os = std::env::var("CARGO_CFG_TARGET_OS").unwrap_or_default();+ if target_os != "windows" {+ return;+ }+ let mut res = winres::WindowsResource::new();+ res.set_icon("assets/ghidrust.ico");+ if let Err(err) = res.compile() {+ // Keep non-MSVC / missing-RC toolchains buildable; icon is best-effort.+ println!("cargo:warning=windows icon embed skipped: {err}");+ }}}diff --git a/crates/ghidrust-core/src/process/discovery.rs b/crates/ghidrust-core/src/process/discovery.rsindex d09978f..d622c0c 100644--- a/crates/ghidrust-core/src/process/discovery.rs+++ b/crates/ghidrust-core/src/process/discovery.rs@@ -388,6 +388,7 @@ pub fn eval_watch_expr(})}+#[cfg_attr(not(any(windows, test)), allow(dead_code))]fn parse_offset_token(tok: &str) -> Result<u64, ProcessError> {let t = tok.trim().trim_start_matches('+');if let Some(rest) = t.strip_prefix("*+") {@@ -444,6 +445,7 @@ fn resolve_token(tok: &str, mods: &[ModuleInfo], _base: Option<u64>) -> Result<uparse_u64_flexible(tok)}+#[cfg_attr(not(any(windows, test)), allow(dead_code))]fn parse_u64_flexible(s: &str) -> Result<u64, ProcessError> {let s = s.trim().trim_start_matches('+');let (s, radix) = if let Some(h) = s.strip_prefix("0x").or_else(|| s.strip_prefix("0X")) {diff --git a/crates/ghidrust-core/src/process/error.rs b/crates/ghidrust-core/src/process/error.rsindex 49ccdb5..e0ee59e 100644--- a/crates/ghidrust-core/src/process/error.rs+++ b/crates/ghidrust-core/src/process/error.rs@@ -112,6 +112,7 @@ impl From<ProcessError> for String {}/// Map common Win32 last-error patterns into structured codes.+#[cfg(windows)]pub fn map_win32_message(err: u32, context: &str) -> ProcessError {// ERROR_ACCESS_DENIED = 5, ERROR_INVALID_PARAMETER = 87match err {diff --git a/crates/ghidrust-core/src/process/mod.rs b/crates/ghidrust-core/src/process/mod.rsindex 5760e76..1076f50 100644--- a/crates/ghidrust-core/src/process/mod.rs+++ b/crates/ghidrust-core/src/process/mod.rs@@ -33,6 +33,7 @@ use std::collections::HashMap;use std::path::Path;use std::sync::Mutex;+#[cfg_attr(not(windows), allow(dead_code))]struct Attached {pid: u32,mode: SessionMode,@@ -63,6 +64,7 @@ wheref(guard.as_mut().unwrap())}+#[cfg(windows)]fn now_token() -> u64 {std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH)@@ -70,6 +72,7 @@ fn now_token() -> u64 {.unwrap_or(0)}+#[cfg(windows)]fn session_report(a: &Attached, session_id: &str) -> ProcessSession {let mut s = ProcessSession::new(session_id.to_string(), a.pid, a.mode, a.run_state);s.advisory = a.advisory.clone();diff --git a/crates/ghidrust-gui/build.rs b/crates/ghidrust-gui/build.rsindex e6733e1..abdc779 100644--- a/crates/ghidrust-gui/build.rs+++ b/crates/ghidrust-gui/build.rs@@ -1,13 +1,20 @@fn main() {- let target_os = std::env::var("CARGO_CFG_TARGET_OS").unwrap_or_default();- if target_os != "windows" {- return;- }-- let mut res = winres::WindowsResource::new();- res.set_icon("assets/ghidrust.ico");- if let Err(err) = res.compile() {- // Keep non-MSVC / missing-RC toolchains buildable; icon is best-effort.- println!("cargo:warning=windows icon embed skipped: {err}");+ // Build scripts compile for the *host*. `winres` is only a+ // `[target.'cfg(windows)'.build-dependencies]` crate, so a runtime+ // `CARGO_CFG_TARGET_OS` check alone still type-checks `winres::` on Linux+ // hosts and fails with E0433. Compile-gate the call on host `cfg(windows)`,+ // and still skip when the *target* is not Windows (cross builds).+ #[cfg(windows)]+ {+ let target_os = std::env::var("CARGO_CFG_TARGET_OS").unwrap_or_default();+ if target_os != "windows" {+ return;+ }+ let mut res = winres::WindowsResource::new();+ res.set_icon("assets/ghidrust.ico");+ if let Err(err) = res.compile() {+ // Keep non-MSVC / missing-RC toolchains buildable; icon is best-effort.+ println!("cargo:warning=windows icon embed skipped: {err}");+ }}}