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

Fix libraries runpath on newer Debian #1606

Merged
merged 5 commits into from
Apr 8, 2020

Conversation

themperek
Copy link
Contributor

@themperek themperek commented Apr 8, 2020

Due to changes in Debian (default --enable-new-dtagshas), rpath has to be set on dependent libraries.
See: https://stackoverflow.com/questions/52018092/how-to-set-rpath-and-runpath-with-gcc-ld

@themperek themperek added type:bug a bug in existing functionality category:packaging issues related to (PyPi) packaging, etc. labels Apr 8, 2020
@themperek themperek mentioned this pull request Apr 8, 2020
@eric-wieser
Copy link
Member

I'm not sure I understand why RUNPATH isn't working for our use-case. Are you able to work that out?

@eric-wieser
Copy link
Member

eric-wieser commented Apr 8, 2020

Supposedly

The new-style DT_RUNPATH is not extended recursively when resolving transitive dependencies, as was the case with RPATH. That is, if we dlopen() libA.so, which in turn marks libB.so as DT_NEEDED, which in turn requires a libC.so — then the resolution for libC.so will visit only the RUNPATH given in libB.so, but not the RUNPATH given in libA.so (to the contrary, the old RPATH used to visit all these locations).
This behaviour was chosen deliberately, in compliance with the ELF spec, as can be seen in this glibc bug #13945 and the developer comment by Roland McGrath from 2002 mentioned therein.

Based on this, maybe we just need to set runpath on one more library.

Can you paste the original failure message without this change?

@themperek
Copy link
Contributor Author

If I set -rpath,$ORIGIN on all depend libraries it seems to work with RUNPATH. I will try to update today.

@eric-wieser
Copy link
Member

That might be the more appropriate fix.

Due to changes in Debain (default --enable-new-dtagshas) rpath has to be set on dependent libraries https://stackoverflow.com/questions/52018092/how-to-set-rpath-and-runpa
@themperek
Copy link
Contributor Author

themperek commented Apr 8, 2020

It seems to work. Test on Ubuntu and Windows WLS1.

cocotb/_build_libs.py Outdated Show resolved Hide resolved
Co-Authored-By: Eric Wieser <wieser.eric@gmail.com>
cocotb/_build_libs.py Outdated Show resolved Hide resolved
Co-Authored-By: Eric Wieser <wieser.eric@gmail.com>
cocotb/_build_libs.py Outdated Show resolved Hide resolved
cocotb/_build_libs.py Outdated Show resolved Hide resolved
themperek and others added 2 commits April 8, 2020 14:19
Co-Authored-By: Eric Wieser <wieser.eric@gmail.com>
Co-Authored-By: Eric Wieser <wieser.eric@gmail.com>
Copy link
Member

@eric-wieser eric-wieser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Commit message needs updating when squashing.

@themperek
Copy link
Contributor Author

What is wrong with the message?

@eric-wieser
Copy link
Member

Nevermind, misread it

@eric-wieser eric-wieser merged commit 046d399 into cocotb:master Apr 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:packaging issues related to (PyPi) packaging, etc. type:bug a bug in existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants