[CDRIVER-4013] Invalid RPATH to sources directories Created: 03/Jun/21  Updated: 27/Oct/23  Resolved: 30/Jul/21

Status: Closed
Project: C Driver
Component/s: libbson, libmongoc
Affects Version/s: 1.17.6
Fix Version/s: None

Type: Bug Priority: Unknown
Reporter: Remi Collet Assignee: Roberto Sanchez
Resolution: Works as Designed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by CDRIVER-4012 Invalid RPATH to sources directories Closed

 Description   

ERROR 0002: file '/usr/bin/mongoc-stat' contains an invalid rpath '/dev/shm/extras/BUILD/mongo-c-driver-1.17.6/x86_64-redhat-linux-gnu/src/libmongoc' in [/dev/shm/extras/BUILD/mongo-c-driver-1.17.6/x86_64-redhat-linux-gnu/src/libmongoc:/dev/shm/extras/BUILD/mongo-c-driver-1.17.6/x86_64-redhat-linux-gnu/src/libbson]
ERROR 0002: file '/usr/bin/mongoc-stat' contains an invalid rpath '/dev/shm/extras/BUILD/mongo-c-driver-1.17.6/x86_64-redhat-linux-gnu/src/libbson' in [/dev/shm/extras/BUILD/mongo-c-driver-1.17.6/x86_64-redhat-linux-gnu/src/libmongoc:/dev/shm/extras/BUILD/mongo-c-driver-1.17.6/x86_64-redhat-linux-gnu/src/libbson]
erreur : Mauvais statut de sortie pour /var/tmp/rpm-tmp.D3ZF6I (%install) 

Notice: starting with Fedora 35, invalid RPATH are blocker for build
https://fedoraproject.org/wiki/Changes/Broken_RPATH_will_fail_rpmbuild

Changing CMAKE_SKIP_BUILD_RPATH to ON seems a working workaround, but a better fix probably exists (RPATH mays be needed to run the test suite), but are unwanted in installed binaries



 Comments   
Comment by Roberto Sanchez [ 30/Jul/21 ]

The issue is best resolved downstream through the use of an already available build option, as described in an earlier comment.

Comment by Remi Collet [ 30/Jul/21 ]

Thanks, -DCMAKE_SKIP_RPATH:BOOL=ON is OK.

 

Applied in https://src.fedoraproject.org/rpms/mongo-c-driver/c/192bce4a7dd956296fca134cf38aa3f5581cb59f?branch=rawhide

Build: https://koji.fedoraproject.org/koji/taskinfo?taskID=72953511

 

Can be closed

Comment by Roberto Sanchez [ 29/Jul/21 ]

remi, it seems that the solution is to specify -DCMAKE_SKIP_RPATH:BOOL=ON as a CMake option. I dropped your sed workaround and added that option in the %build option of the spec. After that, no RPATHs were set in the built or installed components. Are you comfortable with making this change to your downstream spec as the resolution to this issue? If so, I would like to close this issue.

Comment by Roberto Sanchez [ 26/Jul/21 ]

Ah, of course! I had overlooked that. I will remove the sed command from the spec file and try to reproduce the error. Thanks for the pointer.

Comment by Remi Collet [ 26/Jul/21 ]

I confirm the issue is still present in 1.18.0

 

> your spec file

 

Have you removed the workaround to this issue ?

{{ (sed -e '/CMAKE_SKIP_BUILD_RPATH/s/OFF/ON/' -i CMakeLists.txt)}}

Comment by Roberto Sanchez [ 24/Jul/21 ]

remi, I have tried several different approaches, but I cannot reproduce the error you describe. From what I can tell, the installed components of the C driver do not carry RPATH settings. After building in a F35 mock (using the script .evergreen/build_snapshot_rpm.sh in the C driver repository and your spec file with minor modifications), this is what I observe:

<mock-chroot> sh-5.1# chrpath /builddir/build/BUILD/mongo-c-driver-1.19.0/redhat-linux-build/src/libmongoc/mongoc-stat
/builddir/build/BUILD/mongo-c-driver-1.19.0/redhat-linux-build/src/libmongoc/mongoc-stat: no rpath or runpath tag found.
<mock-chroot> sh-5.1# rpm2cpio mongo-c-driver-1.19.0-0.20210724+gitf9db623e3.fc35.x86_64.rpm | cpio -dium
33 blocks
<mock-chroot> sh-5.1# chrpath ./usr/bin/mongoc-stat
./usr/bin/mongoc-stat: no rpath or runpath tag found.

Additionally, I tried several different checks with rpmlint and rpminspect-fedora (as described in the wiki page you linked) and none of them found problems with the RPATH. If I have missed something in replicating the behavior, please let me know.

As an added precaution, you should be able to add the option -DCMAKE_SKIP_INSTALL_RPATH:BOOL=ON to the CMake command line invoked from the spec file. Would this be sufficient? Or do I need to dig deeper?

Comment by Kevin Albertson [ 04/Jun/21 ]

Thank you for the bug report remi! We will investigate this soon.

Generated at Wed Feb 07 21:19:41 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.