-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Problem building 1.86.0 on Darwin due to problematic usage of DYLD_LIBRARY_PATH in bootstrap #139400
Comments
Why is cargo getting linked against libjpeg in the first place? Cargo has absolutely no need to encode or decode jpeg images.
That is because the bootstrap compiler you are using is located in |
I am not certain about what is pulling in the ImageIO framework, it is likely one of the other system frameworks. Cargo is linked against the system Security framework and also the CoreFoundation framework. Here is the list of the libraries referenced by Cargo:
The real problem I see is putting system directories into the DYLD_LIBRARY_PATH. Why not just allow the full pathname resolution to occur, or the normal fallback path in the dynamic linker which occurs after the normal pathname resolution? |
Because if rustc was compiled without rpath enabled and it isn't installed into a system location, the dynamic linker would fail to find |
Understood, but that belongs in |
Summary
Bootstrap is placing system directories such as
/usr/local/lib
intoDYLD_LIBRARY_PATH
, which allows stem name matching of libraries and can result in the incorrect version of system libraries being located during a lookup.Here is the case I ran into:
Normally, the dynamic linker locates libraries using the absolute path recorded in an executable or another dynamic library, but setting
DYLD_LIBRARY_PATH
subverts that, because those directories are searched first using stem matching. This is intended to allow the use of special libraries, but it is not clear why bootstrap is placing a system library location (/usr/local/lib
) into the path. In this case, the failure is due to the fact that the systemImageIO
framework has its own copy oflibjpeg
, but putting/usr/local/lib
inDYLD_LIBRARY_PATH
causes/usr/local/lib/libjpeg.dylib
to be located first using stem matching.I was able to work around the problem by changing bootstrap to instead use
DYLD_FALLBACK_LIBRARY_PATH
and setting that to the appropriate search path in the environment before invoking the build. This works becauseDYLD_FALLBACK_LIBRARY_PATH
is searched after the pathname searching is performed.It is probably okay to place special build directories needed by bootstrap into
DYLD_LIBRARY_PATH
, but don't put any other locations there.Command used
DESTDIR=/tmp/dst.rustc x.py install
Operating system
macOS 10.12.6
HEAD
Tarball build of 1.86.0:
05f9846
Additional context
Build Log
The text was updated successfully, but these errors were encountered: