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

build/separate.md: explain rpath vs runpath #371

Closed
wants to merge 5 commits into from
Closed

Conversation

jay
Copy link
Member

@jay jay commented Dec 21, 2023

  • 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

- 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
build/separate.md Outdated Show resolved Hide resolved
wordlist.txt Outdated Show resolved Hide resolved
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 ...
Copy link
Member

@bagder bagder Dec 22, 2023

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.

Copy link
Member Author

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 ...

Copy link
Member

@bagder bagder Dec 24, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants