[CDRIVER-2216] Static linking against libmongoc fails if it was built with bundled snappy Created: 19/Jul/17  Updated: 27/Oct/23  Resolved: 11/Aug/17

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

Type: Bug Priority: Major - P3
Reporter: A. Jesse Jiryu Davis Assignee: Hannes Magnusson
Resolution: Works as Designed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to CDRIVER-2209 Bundle snappy & zlib if not available Closed

 Description   

On my Mac, the default ./configure line uses bundled Snappy and generates libmongoc-static-1.0-config.cmake with these libraries:

-lsasl2 -lz libsnappy.la

I think the syntax is wrong. Also, libsnappy.la is not installed by "make install". Building libmongoc with the Autotools and then linking a program to libmongoc using the CMake configuration file fails:

> BUILD_SAMPLE_WITH_CMAKE=1 BUILD_LIBMONGOC_WITH_CMAKE=  LINK_STATIC=1 sh .evergreen/link-sample-program.sh
...
ld: library not found for -llibsnappy.la

Same for building libmongoc with CMake.

Linking a program to the libmongoc shared lib seems to work fine.



 Comments   
Comment by A. Jesse Jiryu Davis [ 11/Aug/17 ]

Yes, I think it was the second commit that also fixed this.

Comment by Hannes Magnusson [ 11/Aug/17 ]

tentatively closing as works as designed as we can no longer repro this (like related to
https://github.com/mongodb/mongo-c-driver/commit/225a0f86490648ce886de24f29728dc9a13e048d
and https://github.com/mongodb/mongo-c-driver/commit/a0480985628c4f7201ab33e09ac421eb0c1dbe02 )

Comment by A. Jesse Jiryu Davis [ 11/Aug/17 ]

Current code on master works for me, I can do "BUILD_SAMPLE_WITH_CMAKE=1 BUILD_LIBMONGOC_WITH_CMAKE= LINK_STATIC=1 sh .evergreen/link-sample-program.sh" without error.

Comment by Hannes Magnusson [ 19/Jul/17 ]

libsnappy.la should not be in the .cmake file

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