-
-
Notifications
You must be signed in to change notification settings - Fork 305
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
build/separate.md: explain rpath vs runpath #371
Conversation
- Explain that LD_LIBRARY_PATH can override runpath but not rpath. .. because using runpath solved some in-tree curl testing problems I had with libtool, so I figure other users may benefit from knowing about it. Ref: curl/curl#432 (comment) Closes #xxxx
since then libtool can use `LD_LIBRARY_PATH`. To use an rpath as a runpath add | ||
the linker flag `-Wl,--enable-new-dtags` like this: | ||
|
||
LDFLAGS="-Wl,-rpath,$HOME/install/lib -Wl,--enable-new-dtags" ./configure ... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Jeffrey Walton pointed out this interesting link on the mailing list:
https://stackoverflow.com/a/55283740
It highlights the fact that gcc's -Wl,-rpath=
option already in fact sets the runpath
property if you use a new gcc/ld. i verified this with gcc 13.2.0 on Debian.
Somewhat more explained here: https://rohgarg.github.io/notes/2020/02/20/library-search-order.html.
Thus, this section should probably emphasize that this is only valid for "old" linkers. I have not managed to figure out exactly when this change was done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think there's enough info to say that for certain that only older linkers set RPATH by default. I pushed a change that says newer linkers may use it:
Newer linkers may use the runpath form of rpath by default when rpath is specified but others need an additional linker flag -Wl,--enable-new-dtags
like this:
LDFLAGS="-Wl,-rpath,$HOME/install/lib -Wl,--enable-new-dtags" ./configure ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The way you phrase this makes it sound as if this is the preferred way to do it with current toolchains, while in reality it is a way to do it only with old compilers/linkers. I think this should rather stress that part. The already document way sets runpath with current toolsets.
.. because using runpath solved some in-tree curl testing problems I had with libtool, so I figure other users may benefit from knowing about it.
Ref: curl/curl#432 (comment)
Closes #xxxx