-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Use relative path in installed libraries #7301
Use relative path in installed libraries #7301
Conversation
As it happens, today I've been testing out |
Review status: 0 of 3 files reviewed at latest revision, all discussions resolved. Comments from Reviewable |
Reviewed 3 of 3 files at r1. drake/bindings/pybind.bzl, line 27 at r1 (raw file):
It is unclear why the count of two slashes found in Probably the way to make it clear would be to assert that tools/install.py.in, line 101 at r1 (raw file):
The tools/install.py.in, line 106 at r1 (raw file):
line too long tools/install.py.in, line 107 at r1 (raw file):
I don't understand what this comment means. Comments from Reviewable |
drake/bindings/pybind.bzl, line 26 at r1 (raw file):
To avoid confusing a reader of the code here, this documentation here should make it clear that we are performing an installation-related action at build-time instead of install-time, because we do not want to depend on Comments from Reviewable |
Marking high priority since this is required for one of the tests in #7293 to pass. |
87e4779
to
37aadef
Compare
Review status: 1 of 3 files reviewed at latest revision, 5 unresolved discussions, some commit checks failed. tools/install.py.in, line 101 at r1 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
To answer the question, the linker adds values to RPATH to find the libraries in the build tree. This is done both on linux and on MacOS, and not limited to bazel. On MacOS, this can create the SIP error reported by @ EricCousineau-TRI in #6760 . Since the paths added to RPATH at build time are irrelevant at install time, it is better to remove them. tools/install.py.in, line 106 at r1 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Done. tools/install.py.in, line 107 at r1 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Removed. drake/bindings/pybind.bzl, line 26 at r1 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
This new version of the patch actually removes the modifications of Comments from Reviewable |
Reviewed 1 of 3 files at r2. Comments from Reviewable |
One problem that this patch does not address is the RPATH of the executables, but that doesn't seem to be needed for now. Review status: 1 of 3 files reviewed at latest revision, all discussions resolved, some commit checks failed. Comments from Reviewable |
FYI I am OK with the |
PR needs a rebase onto recent master. Reviewed 2 of 3 files at r2. a discussion (no related file): Ideally, all of the library fixup methods would have standalone branch-coverage level unit testing with python's unittest library that include both common and corner cases. It's great that we have Those function need to turn into tools/install.py.in, line 68 at r1 (raw file):
BTW Needs two lines between function declarations per pycodestyle. tools/install.py.in, line 17 at r2 (raw file):
BTW Do you want to escape the tools/install.py.in, line 60 at r2 (raw file):
FYI Python styleguides usually say tools/install.py.in, line 85 at r2 (raw file): BTW nit Three blank lines? Should be two, I think. tools/install.py.in, line 122 at r2 (raw file):
BTW Needs two lines between function declarations per pycodestyle. tools/install.py.in, line 126 at r2 (raw file):
Bad indentation. Run a Python style checker, I guess manually for now. tools/install.py.in, line 126 at r2 (raw file):
FYI Consider printing an informative error message if tools/install.py.in, line 129 at r2 (raw file):
If the tools/install.py.in, line 139 at r2 (raw file):
Python best practice would be to to a structured assignment, something like: soname, sover = m.groups() In this way, if the number of groups in the regex ever evolves, we would fail-fast instead of computing with lies. tools/install.py.in, line 148 at r2 (raw file):
Unclear when this is ever false? Should the Comments from Reviewable |
37aadef
to
680477d
Compare
Review status: 0 of 3 files reviewed at latest revision, 11 unresolved discussions. tools/install.py.in, line 68 at r1 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Done. tools/install.py.in, line 17 at r2 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Good idea, and same with dylib. tools/install.py.in, line 60 at r2 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Done. tools/install.py.in, line 85 at r2 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Done. tools/install.py.in, line 122 at r2 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Done. tools/install.py.in, line 126 at r2 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Done. tools/install.py.in, line 126 at r2 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Done. tools/install.py.in, line 129 at r2 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Done. tools/install.py.in, line 139 at r2 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Done. tools/install.py.in, line 148 at r2 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
It was to avoid having a trailing Comments from Reviewable |
Reviewed 2 of 4 files at r3. tools/install/install.py.in, line 138 at r3 (raw file):
The not-if condition should re-raise, I think? except OSError as ex:
if ex.errno == 2 and ex.strerror == "No such file or directory":
print("`chrpath` not found. Please run install_prereqs.sh.")
raise ex
except ... tools/install/install.py.in, line 144 at r3 (raw file):
When returncode is 2, but the output didn't match, we sliently ignore the error. Probably the tools/install.py.in, line 148 at r2 (raw file): Previously, fbudin69500 (Francois Budin) wrote…
OK But I didn't think diff_path would ever be empty? It would be Comments from Reviewable |
680477d
to
71bc83b
Compare
Review status: 2 of 3 files reviewed at latest revision, 4 unresolved discussions. tools/install/install.py.in, line 138 at r3 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Done. tools/install/install.py.in, line 144 at r3 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Done. tools/install.py.in, line 148 at r2 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Actually it does return an empty string. Comments from Reviewable |
Reviewed 1 of 4 files at r3. tools/install/install.py.in, line 138 at r3 (raw file): Previously, fbudin69500 (Francois Budin) wrote…
I think the re-raise should be out one level of indentation? So that it always happens? (This is why PRs without unit tests are a challenge, for both author and reviewer.) tools/install/install.py.in, line 143 at r4 (raw file):
Wrong level of intendation -- should be only +4 versus the if this body is filling in. tools/install.py.in, line 148 at r2 (raw file): Previously, fbudin69500 (Francois Budin) wrote…
OK I see now. If you wanted to put it back with a comment, I'd be OK with that too. Comments from Reviewable |
71bc83b
to
181ab59
Compare
Review status: 2 of 3 files reviewed at latest revision, 3 unresolved discussions. tools/install/install.py.in, line 138 at r3 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Done. tools/install/install.py.in, line 143 at r4 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Done. Comments from Reviewable |
+(status: curate commits before merging) The commits bled into each other a bit. FYI Just doing a squash in GitHub merge process here is OK by me.
Reviewed 1 of 1 files at r5. Comments from Reviewable |
181ab59
to
9f0095f
Compare
-(status: curate commits before merging) Review status: all files reviewed at latest revision, 1 unresolved discussion. Comments from Reviewable |
+@sammy-tri Platform review please Review status: all files reviewed at latest revision, 1 unresolved discussion. Comments from Reviewable |
Reviewed 2 of 4 files at r3. tools/install/install.py.in, line 162 at r6 (raw file):
I'm confused here... Are we deleting rpath entries with Comments from Reviewable |
Relative paths to libraries on MacOS were updated to absolute path at install time. This limited relocation of the install directory. Relative paths are now updated to relative paths in the install tree.
This allows to use pydrake without having to update (DY)LD_LIBRARY_PATH to find where the libraries (e.g. VTK) that pydrake requires and libdrake.so to find its dependencies in the install tree.
(DY)LD_LIBRARY_PATH is not necessary anymore to use pydrake since RPath is set on Linux and libraries know their dependencies location on MacOS.
9f0095f
to
e86f56e
Compare
Review status: 2 of 3 files reviewed at latest revision, 3 unresolved discussions. tools/install/install.py.in, line 162 at r6 (raw file): Previously, sammy-tri (Sam Creasey) wrote…
On MacOS, we do not use RPATH as the path to each library is individually set (relative or absolute depending if it is part of the package or a system library). On linux, libraries are found using RPATH. The RPATH values used in the build tree are removed with the tools/install/install.py.in, line 156 at r7 (raw file):
Added a test here to make sure that any library that is has a path containing the Comments from Reviewable |
Reviewed 1 of 1 files at r7. Comments from Reviewable |
Reviewed 1 of 1 files at r7. tools/install/install.py.in, line 162 at r6 (raw file): Previously, fbudin69500 (Francois Budin) wrote…
I think that's a bit clearer, thanks Comments from Reviewable |
I filed an issue for the lack of testing for Review status: all files reviewed at latest revision, 1 unresolved discussion. Comments from Reviewable |
Reviewed 2 of 4 files at r3, 1 of 1 files at r7. Comments from Reviewable |
On MacOS, libraries can be modified at installation to update the path to shared libraries used using the tool
install_name_tool
. On linux, there is no easy way to fixup the paths to the libraries that are used (patchelf
can only update the library paths in its most recent version that is not widely available). Instead, on Linux, the relative path in which libraries should be found at runtime is added to RPath. This patch allows to not manually have to set (DY)LD_LIBRARY_PATH when usingpydrake
: All the dependencies will be found automatically.This change is