Fix: Skip host LLVM detection during cross-compilation#241
Merged
LunaStev merged 1 commit intowavefnd:masterfrom Nov 27, 2025
Merged
Fix: Skip host LLVM detection during cross-compilation#241LunaStev merged 1 commit intowavefnd:masterfrom
LunaStev merged 1 commit intowavefnd:masterfrom
Conversation
When cross-compiling (e.g., building for Windows on Linux), `build.rs` runs on the host machine. Previously, it would detect and attempt to link the host's system LLVM libraries against the target binary, causing linker errors. This change adds a check to compare the `TARGET` and `HOST` environment variables. If they differ, automatic LLVM detection is skipped to prevent incorrect linking configurations, assuming the cross-compilation toolchain handles dependencies appropriately.
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.
This PR resolves build failures encountered during cross-compilation (e.g., building Windows binaries on a Linux host) by preventing the build script from linking against the host's system libraries.
Problem
The
build.rsscript executes on the host machine during the build process. Previously, it would detect the host's system LLVM libraries (e.g.,/usr/lib/llvm-14on Linux) and instruct Cargo to link them into the target binary (e.g., a Windows.exe). This resulted in linker errors due to mismatched binary formats and architectures.Solution
llvm_temporary/build.rsto compare theTARGETandHOSTenvironment variables.TARGET != HOST(indicating cross-compilation), the script now prints a warning and skips the automatic system LLVM detection logic.