zdlarr/SAILOR

undefined symbol when building voxelencoding

fasogbon opened this issue · 2 comments

Thank you for this impressive work.
Can you help please, I am having problem in building your voxelencoding library with error "undefined symbol: _ZN2cv7imwriteERKSsRKNS_11_InputArrayERKSt6vectorIiSaIiEE"
After lots of debugging the error, the error is from the compiled cd c_lib/VoxelEncoding && python setup.py install
This error occur after loading the VoxelEncoding.cpython-310-x86_64-linux-gnu.so

I trace the error to the loaded opencv libraries in your setup.py, and i used the following

        include_dirs = ['/usr/include/opencv4'],
        libraries = ['opencv_highgui', 'opencv_imgcodecs', 'opencv_imgproc', 'opencv_core'], 
        extra_compile_args= {'nvcc': ["-Xptxas", "-v"]},
        library_dirs = ['/usr/lib/x86_64-linux-gnu']

I am still having the error, can you help please. I have checked everywhere and re-install the opencv to no avail.

(SAILOR) pet@pet-ubuntu:~/Desktop/SAILOR/c_lib/VoxelEncoding/dist$ ldd VoxelEncoding.cpython-38-x86_64-linux-gnu.so 
	linux-vdso.so.1 (0x00007ffd44560000)
	libopencv_highgui.so.4.5d => /usr/lib/x86_64-linux-gnu/libopencv_highgui.so.4.5d (0x000076887a735000)
	libopencv_imgcodecs.so.4.5d => /usr/lib/x86_64-linux-gnu/libopencv_imgcodecs.so.4.5d (0x000076887a6dc000)
	libopencv_imgproc.so.4.5d => /usr/lib/x86_64-linux-gnu/libopencv_imgproc.so.4.5d (0x0000768879c00000)
	libopencv_core.so.4.5d => /usr/lib/x86_64-linux-gnu/libopencv_core.so.4.5d (0x0000768879800000)
	libc10.so => not found
	libtorch.so => not found
	libtorch_cpu.so => not found
	libtorch_python.so => not found
	libcudart.so.12 => /usr/local/cuda-12.6/lib64/libcudart.so.12 (0x0000768879200000)
	libc10_cuda.so => not found
	libtorch_cuda.so => not found
	libstdc++.so.6 => /home/pet/anaconda3/envs/SAILOR/lib/libstdc++.so.6 (0x0000768878e00000)
	libm.so.6 => /usr/lib/x86_64-linux-gnu/libm.so.6 (0x000076887a5f1000)
          .
          .
          .
	libgcc_s.so.1 => /home/pet/anaconda3/envs/SAILOR/lib/libgcc_s.so.1 **(0x000076887a5d7000)**

Thank you for your support. Seen from the error, is there any problem with your Pytorch and CUDA libs? For example, you should check if the files libtorch.so, libc10.so, and others exist. Are their LD_LIBRARY_PATHs linked correctly in your bashrc?

Since these .so files are related to PyTorch/LibTorch, maybe you should check if Pytorch and Cuda are installed correctly (refer to our installation).

If the problems still exist, there may be conflicts with opencv4 (The function 'imwrite'). You can comment out the line './src/undistort.cu' (containing 'imwrite' function) in our setup.py, since undistort.cu is not used in our provided examples.

Thank you it is working. I removed everything related to undistort_image, UNDISTORTIMAGE
For whatever reason, (The function 'imwrite') is having linkage issues in cuda