-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
rustc should be usable as-is from the build directory #20836
Comments
Another possible solution:
|
I use |
Why does this error give an undefined symbol error rather than a "cannot load shared library" type of error, which would be the case if it couldn't find the libraries? In bug #21344, when I deleted the system libraries in /lib, it a missing .so error. |
+1 to --enable-rpath being the default. My gut says that this is more likely to be a useful default than the disabled version. |
It used to be the default. I don't remember why it was changed, but I think the decision has been made. |
Apparently the rationale was "because windows doesn't support it". (see #11747) |
It seems to me that a better answer might be to twiddle rpaths on install instead of setting them during build. That way you don't run into the "stage1 uses the wrong version" problem noted in that issue. |
Thanks for the background. I think I'll file a separate issue to set rpath during install. |
One thing to note is that |
On mac os you can use DYLD_FALLBACK_LIBRARY_PATH to avoid overriding rpaths. Does ld.so have something like that? |
I'm not currently aware of an equivalent on linux, but I had forgotten about that! To be maximally compatible with Windows, however, we'd likely want to not rely on these environment variables (as windows certainly doesn't have it) |
I'm not sure you can do much on windows other than put the dlls in the same dir as the executables... |
We might first consider linking the binaries statically, since that works on windows. |
As a newcomer to hacking on Rust, I lost a lot of time due to this particular issue. After receiving Also, someone on IRC mentioned that using Thanks! |
What I mentioned on IRC is that projects which use Cargo build scripts (i.e. It does seem weird to have two options for how to find dynamic libraries. I'm okay sticking to |
Indeed I have often wondered why we have not simply embraced this approach ourselves; i.e. provide a pair of such wrapper scripts (a update: indeed, I already mentioned this a few months ago here: #19263 (comment) |
I am doubtful about the logic being used to justify pushing the matter of creating a runnable program onto individual developers. I would say it is squarely in the range of what people expect their compilers to do. It's a pretty awful first impression of rust to install anywhere but /usr/local on OSX and discover nothing works. Even if shipped, wrappers which set environment variables are suboptimal in numerous ways: you need one for every program until the end of time (e.g. people think of rustc, but I haven't seen anyone mention rustdoc, which requires the same treatment), it doesn't compose, it's racy, error messages are opaque, a dependency on the contents of an unsynchronized mutable unrestricted namespace is vulnerable to interference (intentional or not) by anything else in the system, the list goes on and on.
See #19263 (comment) for more. |
Here is a very helpful gist (I'm not the author, I just cloned it to make sure it would stick around) enumerating some of the failure modes of DYLD_* . |
Closing since we enabled rpath by default |
Steps to reproduce:
./configure && make
x86_64-unknown-linux-gnu/stage2/bin/rustc --help
Expected results: the help message. rustc can be used in place to compile stuff.
Actual result:
The instructions in
README.md
also includemake install
which would fix this issue, but:make install
defaults to writing to a directory that typically requires root accessI’m told I can pass
--enable-rpath
to./configure
, but that’s exactly the kind of secret sauce that I shouldn’t need to know.Possible solutions:
--enable-rpath
the default for source builds (binary builds distributed on rust-lang.org don’t have to use that default)bin/rustc
a wrapper script that sets the correct environment variables (e.g.LD_LIBRARY_PATH
on Linux). This might also help with Support installing multiple release channels #19263.CC @brson
The text was updated successfully, but these errors were encountered: