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

Set -Wl,-rpath,'$ORIGIN/../lib' when building rust toolchain #29941

Closed
rillian opened this issue Nov 19, 2015 · 12 comments
Closed

Set -Wl,-rpath,'$ORIGIN/../lib' when building rust toolchain #29941

rillian opened this issue Nov 19, 2015 · 12 comments

Comments

@rillian
Copy link
Contributor

rillian commented Nov 19, 2015

For building rust code in automation, it would be convenient if the official builds of rustc, rustdoc, cargo, etc. set an rpath relative to the executable, so they can be invoked without having to add to LD_LIBRARY_PATH (linux) or DYLD_LIBRARY_PATH (mac).

@rillian
Copy link
Contributor Author

rillian commented Nov 19, 2015

Note in particular I'm having trouble getting the LD_LIBRARY_PATH thing to work in gecko automation. Fragile build systems.

@pnkfelix
Copy link
Member

@rillian have you tried passing --enable-rpath to the configure script when building rustc ?

In short, We used to do this, and we explicitly stopped doing it, for various reasons.

See in particular the discussion at #14832

update: see also discussion at old weekly mtg: https://github.com/rust-lang/meeting-minutes/blob/master/weekly-meetings/2014-07-08.md#rpath

@pnkfelix
Copy link
Member

@rillian (if you have a counter-argument to the claims that "There are also bad things with rpaths. [Linux] distros will reject binaries that have rpaths" from the notes above, I would be curious to hear them. I had tried to push back against this change back when it was put forward, but I am ignorant of distros' processes and thus decided that I could not argue effectively on that front.)

@rillian
Copy link
Contributor Author

rillian commented Nov 19, 2015

@pnkfelix Thanks. I didn't know about --enable-rpath That should fix the issue, but is another step away from being able to use official builds.

The bug discussion mostly seems to be about rpath in rustc's output. I'm just asking for it in rustc itself. Changing the default of the configure switch, not of -C rpath if I understand correctly.

@glandium
Copy link
Contributor

What is the rationale for the rustc builds one can download are not using --enable-rpath? They are the builds that would benefit from it the most...

@pnkfelix
Copy link
Member

see also #21483 #28640

@larsbergstrom
Copy link
Contributor

CC @alexcrichton @brson

@alexcrichton
Copy link
Member

The past motivations for this change are outlined in the many linked issues here (I'll also throw in #11747).

It seems fine, however, to enable this sort of setting by default when building the compiler itself (but not for the executables the compiler itself then generates). I don't think we can "just use" the -C rpath option as it's not quite what we want for our own distribution, so this will likely either passing weird -C link-args or using external tools to frob these settings after the artifacts are built.

@brson
Copy link
Contributor

brson commented Nov 23, 2015

Not sure I agree that it's fine for the rustc case. The main argument seems the same to me there - it's different than windows.

@alexcrichton
Copy link
Member

I guess you can view this from two angles:

  • On one hand rpath doesn't exist on Windows but does on Unix
  • On the other hand the compiler works by default on Windows but doesn't work on Unix

I'd probably lean more towards consistency on the latter point for the compiler itself at least.

@jonthn
Copy link

jonthn commented Dec 8, 2015

I would love a variant of this for OSX (using @executable_path also explained in a few other issues) . It would mean I don't have to mess around with DYLD_LIBRARY_PATH and I can use --prefix= of rustup.sh

Also I believe this change would help integration with package systems for open-source OSes.

alexcrichton added a commit to alexcrichton/rust that referenced this issue Dec 12, 2015
This commit changes our distribution and in-tree sources to pass the `-C rpath`
flag by default during compiles. This means that from-source builds, including
our release channels, will have this option enabled as well. Motivated
by rust-lang#29941, this change means that the compiler should be usable as-is on all
platforms just after extraction or installation. This experience is already true
on Windows but on Unixes you still need to set up LD_LIBRARY_PATH or the
equivalent, which can often be unfortunate.

This option was originally turned off by default for Linux distributions who
tend to take care of these sorts of details themselves, so it is expected that
all those builds of Rust will want to pass `--disable-rpath` to the configure
script to preserve that behavior.

Closes rust-lang#29941
bors added a commit that referenced this issue Dec 23, 2015
This commit changes our distribution and in-tree sources to pass the `-C rpath`
flag by default during compiles. This means that from-source builds, including
our release channels, will have this option enabled as well. Motivated
by #29941, this change means that the compiler should be usable as-is on all
platforms just after extraction or installation. This experience is already true
on Windows but on Unixes you still need to set up LD_LIBRARY_PATH or the
equivalent, which can often be unfortunate.

This option was originally turned off by default for Linux distributions who
tend to take care of these sorts of details themselves, so it is expected that
all those builds of Rust will want to pass `--disable-rpath` to the configure
script to preserve that behavior.

Closes #29941
jroesch pushed a commit to jroesch/rust that referenced this issue Jan 4, 2016
This commit changes our distribution and in-tree sources to pass the `-C rpath`
flag by default during compiles. This means that from-source builds, including
our release channels, will have this option enabled as well. Motivated
by rust-lang#29941, this change means that the compiler should be usable as-is on all
platforms just after extraction or installation. This experience is already true
on Windows but on Unixes you still need to set up LD_LIBRARY_PATH or the
equivalent, which can often be unfortunate.

This option was originally turned off by default for Linux distributions who
tend to take care of these sorts of details themselves, so it is expected that
all those builds of Rust will want to pass `--disable-rpath` to the configure
script to preserve that behavior.

Closes rust-lang#29941
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

No branches or pull requests

7 participants