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

rpath binaries so no LD_LIBRARY_PATH is needed #441

Closed
graydon opened this issue Jun 1, 2011 · 10 comments
Closed

rpath binaries so no LD_LIBRARY_PATH is needed #441

graydon opened this issue Jun 1, 2011 · 10 comments
Assignees
Labels
A-linkage Area: linking into static, shared libraries and binaries E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

Comments

@graydon
Copy link
Contributor

graydon commented Jun 1, 2011

use of rpath and $ORIGIN when linking, and we won't need LD_LIBRARY_PATH settings at all. implement this.

@ghost ghost assigned eholk Jun 17, 2011
@eholk
Copy link
Contributor

eholk commented Jun 17, 2011

I started working on this a little, but I will probably switch back to concurrency stuff before long. Here's a patch with my work so far:

https://gist.github.com/1031941

It depends on the getcwd and other functions that I added to the library, which will probably land after I make sure they work on all three platforms.

eholk pushed a commit to eholk/rust that referenced this issue Jun 17, 2011
@graydon
Copy link
Contributor Author

graydon commented Jun 20, 2011

It's possible this will only "really" work on linux and osx, and we'll have to ship a .bat file for windows that adds our bin and lib directories to %PATH%. That seems like "the normal way" to do toolchains on windows. I think.

@ghost ghost assigned espindola Jun 21, 2011
@graydon
Copy link
Contributor Author

graydon commented Sep 23, 2011

As part of this, I'd like to make the stageN directories look as much as possibly like the structure a normal-unix distro would want landing in /usr. That is: bin/rustc, lib/libfoo.so for the runtime libs, and lib/rustc/$arch/libfoo.so for the target libs. I have started fiddling the makefiles and configury to build this way, but it is incomplete. Best bet I think is to build everything redundantly in the old-and-new locations for a bit first, then snapshot and switch over to only using the new locations, then snapshot again and start purging the old locations.

@graydon
Copy link
Contributor Author

graydon commented Sep 23, 2011

See also #474

@ghost ghost assigned brson Sep 27, 2011
@brson
Copy link
Contributor

brson commented Oct 5, 2011

Done.

@brson brson closed this as completed Oct 5, 2011
@brson
Copy link
Contributor

brson commented Oct 6, 2011

Reopening because it doesn't seem to be working on mac yet

@brson brson reopened this Oct 6, 2011
@brson
Copy link
Contributor

brson commented Oct 6, 2011

It looks like mac doesn't support $ORIGIN, so the behavior is going to be different on every platform.

@jckarter
Copy link

jckarter commented Oct 6, 2011

I believe the dyld equivalent to $ORIGIN is @executable_path .

@brson
Copy link
Contributor

brson commented Oct 6, 2011

jckarter: Thanks for the tip!

I was under the impression @executable_path could only be used as the install_name, but you can also use it in the rpath, like -Wl,-rpath,@executable_path/../lib

Fantastic!

@brson
Copy link
Contributor

brson commented Oct 6, 2011

I think this is finally working now. Here's the current scheme:

  • For each used crate we rpath the relative path from $ORIGIN to the location of the crate. This allows binaries to be relocated.
  • For each used crate we rpath the absolute path to the used crate. Our build relies upon this since currently the relative path to some libraries changes when they are promoted from the target directories to the host directories.
  • We also add an absolute fallback path to appropriate target lib directories under the install prefix.

@brson brson closed this as completed Oct 6, 2011
keeperofdakeys pushed a commit to keeperofdakeys/rust that referenced this issue Dec 12, 2017
Add setfsgid()/setfsuid() on linux
dlrobertson pushed a commit to dlrobertson/rust that referenced this issue Nov 29, 2018
ZuseZ4 pushed a commit to EnzymeAD/rust that referenced this issue Mar 7, 2023
calebzulawski added a commit to calebzulawski/rust that referenced this issue Jan 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-linkage Area: linking into static, shared libraries and binaries E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
Projects
None yet
Development

No branches or pull requests

5 participants