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.
For Rust targets, Rust will invoke the linker and add (among others) the
-lSystem flag. This works fine for the default linker, but if we use a
custom linker (e.g. g++, or even /usr/bin/ld), then we must provide
that path to the System library.
Adding -L to RUSTFLAGS works fine for regular libraries, but fails
for build-scripts (See rust-lang/cargo#4423 )
because there is no way to set RUSTFLAGS for build scripts when
cross-compiling. This is mostly an issue because we always specify the
target, even when building for host, but that is already sufficient for
the RUSTFLAGS to not apply to the build-script-build.
Target specific RUSTFLAGS (i.e CARGO_TARGET__RUSTFLAGS also
don't seem to affect buildscripts.
Setting LIBRARY_PATH= applies to normal targets and build-scripts
too, and seems to fix the issue.
My previous fix probably only fixed the case where a rust library gets
linked into a foreign library or executable.