Hi, I am trying to build Open3D v0.7.0 from source.
For whatever reason I am getting a linking error:
[ 77%] Linking CXX executable ../../bin/examples/ViewPCDMatch
/usr/bin/ld: /usr/local/lib/libglfw3.a(vulkan.c.o): undefined reference to symbol 'dlclose@@GLIBC_2.2.5'
//lib/x86_64-linux-gnu/libdl.so.2: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
examples/Cpp/CMakeFiles/ViewPCDMatch.dir/build.make:91: recipe for target 'bin/examples/ViewPCDMatch' failed
make[2]: *** [bin/examples/ViewPCDMatch] Error 1
CMakeFiles/Makefile2:1555: recipe for target 'examples/Cpp/CMakeFiles/ViewPCDMatch.dir/all' failed
make[1]: *** [examples/Cpp/CMakeFiles/ViewPCDMatch.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2
Steps to reproduce:
$ git clone --recursive --branch v0.7.0 https://github.com/intel-isl/Open3D.git
$ cd Open3D/util/scripts/
$ ./build.sh
I suspect either the unusual location for the library - /usr/lib/x86_64-linux-gnu/libdl.so, or some kind of problem with cmake files (sadly I am no good with cmake so no idea what to look for).
I had this issue last week, tried a bunch of things but ended up compiling fine after reboot.
Looking online informed me that the linker was missing some linked libraries on the system.
The errors I got were:
/usr/bin/ld: /usr/local/lib/libglfw3.a(vulkan.c.o): undefined reference to symbol 'dlclose@@GLIBC_2.2.5'
//lib/x86_64-linux-gnu/libdl.so.2: error adding symbols: DSO missing from command line
/usr/bin/ld: /usr/local/lib/libglfw3.a(x11_window.c.o): undefined reference to symbol 'XConvertSelection'
Using make -verbose showed that make was not adding these libraries, so CMake made a mistake somewhere during configuration. Some info here
So what I needed to do was add -ldl and -lX11 to the end of the link process. Instead of modifying the CMakeLists.txt file, I found a hacky way to do it on the command line. I fixed it by adding this parameter at the end of CMAKE: -DCMAKE_CXX_STANDARD_LIBRARIES="-lX11 -ldl". This is hack was found here.
Compiles fine and runs well.
@yxlao do you have anything to say about this building issue?
From the error message, /usr/local/lib/libglfw3.a is a system library, which is not guaranteed to be compatible with Open3D. Now we've set the default to always use the GLFW that comes with Open3D's CMake system, which should avoid this issue.