[MONGOCRYPT-451] Cannot build with shared libbson Created: 29/Jun/22 Updated: 27/Jan/23 Resolved: 28/Jul/22 |
|
| Status: | Closed |
| Project: | Libmongocrypt |
| Component/s: | cmake |
| Affects Version/s: | 1.5.0 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Unknown |
| Reporter: | Remi Collet | Assignee: | Colby Pike |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
||||||||
| Issue Links: |
|
||||||||
| Description |
|
I'm unable to build RPM of new version using system shared libbson. In all case, it seems the static libbson is required (which is not available in the package per packaging Guidelines)
|
| Comments |
| Comment by Colby Pike [ 28/Jul/22 ] | ||
|
I believe this is all settled now. Feel free to re-open if you run into any new issues. | ||
| Comment by Remi Collet [ 18/Jul/22 ] | ||
|
Build in Fedora Rawhide using https://src.fedoraproject.org/rpms/libmongocrypt/raw/rawhide/f/libmongocrypt-static.patch Perhaps will have to keep it rawhide only because of ABI/API change ( (looks like each day I hate cmake a bit more) | ||
| Comment by Colby Pike [ 07/Jul/22 ] | ||
|
Those references in mongocrypt-config.cmake will not create issues. Those are there for setting up link rules at import time and do not require any bson-static targets. | ||
| Comment by Remi Collet [ 07/Jul/22 ] | ||
|
Yes, using
sed -e '/target_link_libraries/s/bson_static/bson_shared/' -i cmake/ImportBSON.cmake
build passes (tests are no more available)
But some static are now referenced in installed cmake files:
+ grep -r static cmake | ||
| Comment by Colby Pike [ 06/Jul/22 ] | ||
|
I believe I have found the issue. The mongocrypt_static attempts to link with bson_static, but that target is not defined in your build. That CMake target also exposes the usage requirements that set up the header search paths. Since bson_static does not refer to anything, the build does not receive any usage requirements that allow it to compile and link. In ImportBSON.cmake, there is a line:
Replace it with this:
| ||
| Comment by Remi Collet [ 02/Jul/22 ] | ||
|
CMakeCache.txt attached | ||
| Comment by Colby Pike [ 01/Jul/22 ] | ||
|
Can you post your CMakeCache.txt from the failing build? | ||
| Comment by Remi Collet [ 01/Jul/22 ] | ||
|
Using: {{ -DENABLE_PIC:BOOL=ON }} Still failing: [ 48%] Building C object CMakeFiles/mongocrypt_static.dir/src/crypto/cng.c.o
Notice: this issue also blocks update in official repository of
| ||
| Comment by Colby Pike [ 30/Jun/22 ] | ||
|
Hi Remi, I made the changes that are relevant here. The static libbson in this case is only needed to compile some test programs. Does the build succeed if you set BUILD_TESTING=OFF as a CMake setting? | ||
| Comment by Remi Collet [ 29/Jun/22 ] | ||
|
Package content: # rpm -q libbson-devel
| ||
| Comment by Remi Collet [ 29/Jun/22 ] | ||
|
Using -DUSE_SHARED_LIBBSON:BOOL=ON -DMONGOCRYPT_MONGOC_DIR:STRING=USE-SYSTEM -DENABLE_ONLINE_TESTS:BOOL=OFF -DENABLE_STATIC:BOOL=OFF gmake[2]: *** No rule to make target '_MONGOCRYPT_SYSTEM_LIBBSON_STATIC-NOTFOUND', needed by 'mongo_crypt_v1.so'. Stop.
Trying with removing find_library (_MONGOCRYPT_SYSTEM_LIBBSON_STATIC ... /dev/shm/extras/BUILD/libmongocrypt-1.5.0/test/crypt_shared-stub.cpp:20:10: fatal error: bson/bson.h: No such file or directory |