[SERVER-84308] implement origin RPATHs for bazel Created: 19/Dec/23  Updated: 23/Jan/24  Resolved: 12/Jan/24

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 7.3.0-rc0

Type: New Feature Priority: Major - P3
Reporter: Daniel Moody Assignee: Daniel Moody
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Build
Backwards Compatibility: Fully Compatible
Participants:

 Description   

bazel creates shared libraries that link to a library in the build dir, but we need to use rpaths to make these libraries relocatable.

 

for example:
ldd bazel-out/aarch64-fastbuild/bin/src/mongo/platform/visibility_test1
linux-vdso.so.1 (0x0000ffff80b32000)
libsrc_Smongo_Splatform_Slibvisibility_Utest_Ulib1_Uwith_Udebug.so => /home/ubuntu/mongo/bazel-out/aarch64-fastbuild/bin/src/mongo/platform/../../../_solib_arm64/libsrc_Smongo_Splatform_Slibvisibility_Utest_Ulib1_Uwith_Udebug.so (0x0000ffff80ab0000)
libsrc_Smongo_Splatform_Slibvisibility_Utest_Ulibcommon_Uwith_Udebug.so => /home/ubuntu/mongo/bazel-out/aarch64-fastbuild/bin/src/mongo/platform/../../../_solib_arm64/libsrc_Smongo_Splatform_Slibvisibility_Utest_Ulibcommon_Uwith_Udebug.so (0x0000ffff80a90000)
libsrc_Sthird_Uparty_Sgperftools_Slibtcmalloc_Uminimal_Uwith_Udebug.so => /home/ubuntu/mongo/bazel-out/aarch64-fastbuild/bin/src/mongo/platform/../../../_solib_arm64/libsrc_Sthird_Uparty_Sgperftools_Slibtcmalloc_Uminimal_Uwith_Udebug.so (0x0000ffff80730000)
libm.so.6 => /lib/aarch64-linux-gnu/libm.so.6 (0x0000ffff80680000)
libgcc_s.so.1 => /lib/aarch64-linux-gnu/libgcc_s.so.1 (0x0000ffff80650000)
libc.so.6 => /lib/aarch64-linux-gnu/libc.so.6 (0x0000ffff804a0000)
/lib/ld-linux-aarch64.so.1 (0x0000ffff80af9000)
SCons still will do the install portion and correctly move the bazel libraries out of bazel build dir and to the install/build location and archive will grab all the files correctly, however because the example paths above are recorded into the library, the libraries will not be able to be loaded when the archive is extracted on some other system. So we need to implement $ORIGIN RPATHs before phase 1 is complete



 Comments   
Comment by Githook User [ 11/Jan/24 ]

Author:

{'name': 'Daniel Moody', 'email': 'dmoody256@gmail.com', 'username': 'dmoody256'}

Message: SERVER-84308 add rpath support to bazel (#17961)

GitOrigin-RevId: 467e66b40966f996cd303c6174012f5cbafd1511
Branch: master
https://github.com/mongodb/mongo/commit/2ef4e0dfb0b59b72bc53fe9afa74d2d26b8fb9da

Generated at Thu Feb 08 06:54:38 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.