Unable to run orocksdb
Hi guys!
I am new to ocaml and I wanted to run an application using orocksdb. I installed rocksdb with the script from the repo. After that I ran make build make install in orocksdb and everything was fine. My project compiled too, but when I wanted to start it, I got the following error message:
Fatal error: exception Dl.DL_error("./main: undefined symbol: rocksdb_cache_create_lru")
Raised at file "src/ctypes-foreign-base/dl.ml", line 42, characters 20-44
Called from file "src/ctypes-foreign-base/ctypes_foreign_basis.ml", line 47, characters 19-47
Re-raised at file "src/ctypes-foreign-base/ctypes_foreign_basis.ml", line 49, characters 50-59
Called from file "rocks_options.ml", line 14, characters 6-94
I think, for some reason it is unable to find the required .so files
It is probably me, who messed up something, but couldn't find help yet. I hope it's ok, to ask here :)
OS: Ubuntu 16.04 Ocaml 4.06.0
Hi @vinczedani
I'm not an expert in this kind of stuff.
You can try adding this https://github.com/domsj/orocksdb/blob/master/Makefile#L8 to your build command?
Although I thought this shouldn't be needed, as these options are already declared in the META file (https://github.com/domsj/orocksdb/blob/master/myocamlbuild.ml#L58) that is installed when you run make install.
Fwiw in alba in the past we had https://github.com/openvstorage/alba/pull/412/files#diff-7e5e13f77b3b0e3c516faf87e8940c6cL162 in myocamlbuild.ml, but since the addition to the META file this was no longer needed.
Hope this helps, good luck!
@vinczedani Can it be that our executable picks up a different rocksdb shared lib ?
what's the output of ldd ./main ?
I'm also getting undefined symbol errors.
Fatal error: exception Dl.DL_error("./a.out: undefined symbol: rocksdb_options_set_allow_os_buffer")
$ ldd a.out
linux-vdso.so.1 (0x00007fffcfde4000)
librocksdb.so.5.13 => /usr/lib/librocksdb.so.5.13 (0x00007f7c9d708000)
libffi.so.6 => /usr/lib/libffi.so.6 (0x00007f7c9d4ff000)
libm.so.6 => /usr/lib/libm.so.6 (0x00007f7c9d16b000)
libdl.so.2 => /usr/lib/libdl.so.2 (0x00007f7c9cf67000)
libc.so.6 => /usr/lib/libc.so.6 (0x00007f7c9cbac000)
libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007f7c9c98e000)
librt.so.1 => /usr/lib/librt.so.1 (0x00007f7c9c786000)
libsnappy.so.1 => /usr/lib/libsnappy.so.1 (0x00007f7c9c57e000)
libz.so.1 => /usr/lib/libz.so.1 (0x00007f7c9c367000)
libbz2.so.1.0 => /usr/lib/libbz2.so.1.0 (0x00007f7c9c157000)
liblz4.so.1 => /usr/lib/liblz4.so.1 (0x00007f7c9bf40000)
libzstd.so.1 => /usr/lib/libzstd.so.1 (0x00007f7c9bcbb000)
libtbb.so.2 => /usr/lib/libtbb.so.2 (0x00007f7c9ba7e000)
libjemalloc.so.2 => /usr/lib/libjemalloc.so.2 (0x00007f7c9b5ff000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007f7c9b278000)
libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x00007f7c9b061000)
/lib64/ld-linux-x86-64.so.2 => /usr/lib64/ld-linux-x86-64.so.2 (0x00007f7c9e2a0000)
OS: Archlinux Ocaml 4.06.1
If I pin locally, this error does not occur. I guess this package needs a new publish to opam?
https://github.com/ocaml/opam-repository/pull/12203, hope it helps :)
opam package was accepted. can you verify?
I'm still getting errors similar reported by others here, using orocksdb 0.4.0.
In my case, I see:
Fatal error: exception Dl.DL_error("_build/default/bar.exe: undefined symbol: rocksdb_cache_create_lru")
More info:
$ ldd _build/default/bar.exe
linux-vdso.so.1 (0x00007ffe90b74000)
libffi.so.6 => /usr/lib/x86_64-linux-gnu/libffi.so.6 (0x00007f72fa4bf000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f72fa2a0000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f72f9f02000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f72f9cfe000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f72f990d000)
/lib64/ld-linux-x86-64.so.2 (0x00007f72faaa3000)
Shouldn't I see librocksdb.so in that list?
Update: I solved this problem by passing a linker flag when building my executable. So: never mind.
Update: I solved this problem by passing a linker flag when building my executable. So: never mind.
Mind telling me the flag? I have both rocks and orocksdb installed, but still getting this error.
edit: if anyone has the same problem, i fixed it by removing this line in install_rocksdb