[CDRIVER-4020] Build breaks with cmake 3.18.2 (but it worked with 3.11.4) Created: 09/Jun/21  Updated: 05/Feb/24

Status: Backlog
Project: C Driver
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Fermín Galán Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: bg-rf, neweng
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Epic Link: CDRIVER-4577

 Description   

I'm trying to build the driver as described in documentation, basically:

curl -kOL https://github.com/mongodb/mongo-c-driver/releases/download/1.17.6/mongo-c-driver-1.17.6.tar.gz
{{ tar xfvz mongo-c-driver-1.17.6.tar.gz}}
{{ cd mongo-c-driver-1.17.6}}
{{ mkdir cmake-build}}
{{ cd cmake-build}}
{{ cmake -DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF ..}}
{{ make}}

However I get this error in the cmake step:

...mongo-c-driver-1.17.6/src/libbson/src/libbson-1.0.pc.in
mongo-c-driver-1.17.6/src/libbson/src/CMakeLists.txt
mongo-c-driver-1.17.6/src/libbson/src/libbson-static-1.0.pc.in
mongo-c-driver-1.17.6/src/libbson/src/jsonsl/
mongo-c-driver-1.17.6/src/libbson/src/jsonsl/CMakeLists.txt
mongo-c-driver-1.17.6/src/libbson/src/jsonsl/jsonsl.h
mongo-c-driver-1.17.6/src/libbson/src/jsonsl/jsonsl.c
cmake: symbol lookup error: cmake: undefined symbol: archive_write_add_filter_zstd

It seems this has started to fail since I changed in my system from cmake 3.11.4 to cmake 3.18.2.

I have tested with driver versions 1.17.4 and 1.17.6 and the problem is the same.

Is there any restriction in the cmake version that has to be used to build the driver? Is there any way to solve this problem?

Thanks!



 Comments   
Comment by Kevin Albertson [ 14/Jun/21 ]

Thank you for the additional information fermin.galanmarquez@telefonica.com. Since you have a workaround, we will continue to investigate this after we wrap up some higher priority upcoming server support work.

Comment by Fermín Galán [ 09/Jun/21 ]

My platform is centos8.3.2011

In fact, you can easily reproduce the problem is you build this Dockerfile: https://github.com/telefonicaid/fiware-orion/blob/3.0.0/docker/Dockerfile (using the typical command "sudo docker build -t issue4020-test"). The part that installs cmake 3.18.2 (through yum) is line 48 and the part that build mongo c driver is from line 70 to 79.

You can also check how I solved the problem in this other Dockerfile: https://github.com/telefonicaid/fiware-orion/blob/3.1.0/docker/Dockerfile. There is a "hack" to uninstala cmake 3.18.2 and install (from sources!) cmake 3.20.1, in lines 61 to 75.

(Sorry for the "extra stuff" in these Dockerfiles which has nothing to do with this issue , but note these Dockerfiles are taken from real for the project in which I'm using the driver).

Comment by Kevin Albertson [ 09/Jun/21 ]

Thank you for the report fermin.galanmarquez@telefonica.com and the information! 

The linked cmake bug suggests a simple fix in cmake 2.6.0+:

 cmake_policy (SET CMP0012 NEW)

I was unable to reproduce the error on an Ubuntu 20.04 machine with cmake 3.18.2.

What platform did you observe the error on? If you have it handy, can you include the full output of the cmake command?

Comment by Fermín Galán [ 09/Jun/21 ]

I have tried with a newer version of cmake (in particular, version 3.20.1) and it works!

However, not sure if the mongo C driver building stuff should be modified to cope with 3.18.2 (in which case this ticket should be kept) or not (in which case this ticket should be closed).

Comment by Fermín Galán [ 09/Jun/21 ]

Maybe there is a bug in cmake 3.18.2? As seen in https://gitlab.kitware.com/cmake/cmake/-/issues/21204

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