I'm trying to build a program using the Mongo C driver. My CMake configuration includes this:
include_directories("/usr/local/include/libmongoc-1.0")
include_directories("/usr/local/include/libbson-1.0")
...
SET (STATIC_LIBS
...
libmongoc-static-1.0.a
libbson-static-1.0.a
)
TARGET_LINK_LIBRARIES(myapp ${STATIC_LIBS})
Compile stage goes fine (so it seems that includes are correctly found), but when the linking stage takes place I get this error:
/usr/bin/ld: /usr/local/lib/libmongoc-static-1.0.a(mongoc-counters.c.o): undefined reference to symbol 'shm_unlink@@GLIBC_2.2.5'
It seems it correctly find the static library file but something in it doesn't like it...
Somebody has found a similar error? Is there any known solution?
Some additional info about my system:
- gcc version: 6.3.0
- Mongo C driver version: 1.16.0
- MongoDB version: 4.4.1
- Operating system: Debian 9.3
Thanks!
question from:
https://stackoverflow.com/questions/65937063/undefined-reference-to-symbol-error-when-linking-mongo-c-driver-static-library 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…