Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
514 views
in Technique[技术] by (71.8m points)

mongodb - Undefined reference to symbol error when linking Mongo C driver static library

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...