When I run the hello_mongoc test app (renamed to mongotest), the output looks like this:
{ "ok" : 1 }
./mongotest: symbol lookup error: /usr/local/lib/libmongoc-1.0.so.0: undefined symbol: bson_validate_with_error
The app is build with:
cc -o mongotest mongotest.o -lmongoc-1.0 -lbson-1.0
and gives no compilation warnings/errors.
This is in /usr/local/lib:
lrwxrwxrwx 1 root staff 16 Oct 5 11:38 libbson-1.0.so -> libbson-1.0.so.0
lrwxrwxrwx 1 root staff 20 Oct 5 11:38 libbson-1.0.so.0 -> libbson-1.0.so.0.0.0
-rw-r--r-- 1 root staff 549180 Oct 5 11:29 libbson-1.0.so.0.0.0
-rw-r--r-- 1 root staff 744738 Oct 5 11:30 libbson-static-1.0.a
lrwxrwxrwx 1 root staff 18 Oct 5 11:38 libmongoc-1.0.so -> libmongoc-1.0.so.0
lrwxrwxrwx 1 root staff 22 Oct 5 11:38 libmongoc-1.0.so.0 -> libmongoc-1.0.so.0.0.0
-rw-r--r-- 1 root staff 2162580 Oct 5 11:31 libmongoc-1.0.so.0.0.0
-rw-r--r-- 1 root staff 3553982 Oct 5 11:33 libmongoc-static-1.0.a
I am running on a raspberry pi 3B+
According to
libbson
source,bson_validate_with_error
was added in1.7.0
, while you have1.0
.EDIT 1:
This seems to be a linker issue. More info in comments below.
EDIT 2:
One way of solving this is to use static linking: