Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix macos-11 #167

Merged
merged 1 commit into from
Apr 12, 2022
Merged

Fix macos-11 #167

merged 1 commit into from
Apr 12, 2022

Conversation

jschwe
Copy link
Collaborator

@jschwe jschwe commented Apr 12, 2022

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.

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<path> 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_<triple>_RUSTFLAGS also
don't seem to affect buildscripts.

Setting LIBRARY_PATH=<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.
@jschwe jschwe marked this pull request as ready for review April 12, 2022 13:06
Copy link

@jayvdb jayvdb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixed installation for me. yay.

@jschwe jschwe changed the title Draft: Fix macos-11 Fix macos-11 Apr 12, 2022
@jschwe jschwe merged commit 9a1cb76 into master Apr 12, 2022
@jschwe jschwe deleted the jschwe/macos-nonhost branch April 12, 2022 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants