Conversation
`libafl_frida/build.rs` invokes `cl.exe` directly to link `test_harness.dll`
but only forwards `compiler.args()` from `cc`, dropping `compiler.env()`.
Outside a Visual Studio developer shell the environment has no
`INCLUDE`/`LIB`, so a Windows build fails with:
test_harness.cpp(1): fatal error C1034: stdint.h: no include path set
`cc` already resolves the MSVC toolchain on its own (vswhere/registry) and
exposes the resulting environment via `Tool::env()`. Forward it to the
command so `cargo build` works from a plain shell.
Verified on Windows by building a consumer of this crate from a plain
PowerShell (no vcvars): `test_harness.dll` is now produced and links
successfully, where it previously failed with C1034.
The libafl-fuzz fuzzer denies `clippy::all`, and clippy 1.98 flags the late-initialized `let scheduler;` (`needless_late_init`), failing the `forkserver/libafl-fuzz` CI job. Build the scheduler in a single `if`/`else` expression instead.
Author
|
The orkserver/libafl-fuzz CI failure is unrelated to this change: that fuzzer has #![deny(clippy::all)] and clippy 1.98 flags the late-initialized let scheduler; in uzzers/forkserver/libafl-fuzz/src/fuzzer.rs ( I cherry-picked the same fix from #3926 (2f62ce0 -> �9c13de1) so this PR is green standalone. Once #3926 lands, this commit becomes a no-op. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
crates/libafl_frida/build.rsinvokescl.exedirectly to linktest_harness.dll, but only forwardscompiler.args()from thecccrate and dropscompiler.env():Outside a Visual Studio developer shell the process environment has no
INCLUDE/LIB, so on Windows the build fails:This forces Windows consumers of
libafl_fridato build from avcvars-initialised shell, even thoughccitself locates MSVC without one (it compilessrc/gettls.cfine in the same build).Fix
ccalready resolves the MSVC toolchain (vswhere/registry) and exposes the environment it would use viaTool::env()(pub fn env(&self) -> &[(OsString, OsString)]). Forward it to the directcl.exeinvocation:Verification
Built a Windows consumer (x86_64-pc-windows-msvc) of this crate from a plain PowerShell — no
vcvars:test_harness.cpp(1): fatal error C1034: stdint.h: no include path settest_harness.dllis produced and the crate links successfullyNo behavioural change on Unix; the extra environment is empty there.