tmontaigu / laszip-python

Python bindings for LASzip
MIT License
4 stars 7 forks source link

ImportError - undefined symbol - laszip_read_point #2

Closed Rheinwalt closed 2 years ago

Rheinwalt commented 2 years ago

when building with cmake the build seems fine, but when importing the resulting module I get the mentioned import error:

mkdir build cd build cmake .. -- The C compiler identification is GNU 11.1.0 -- The CXX compiler identification is GNU 11.1.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /usr/bin/cc - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /usr/bin/c++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Found PythonInterp: /usr/bin/python3.10 (found version "3.10.2") -- Found PythonLibs: /usr/lib/libpython3.10.so -- Performing Test HAS_FLTO -- Performing Test HAS_FLTO - Success -- Found pybind11: /usr/include (found version "2.9.0") -- Configuring done -- Generating done -- Build files have been written to: /home/.../laszip-python/build make [ 25%] Building CXX object CMakeFiles/laszip.dir/src/laszip.cpp.o [ 50%] Building CXX object CMakeFiles/laszip.dir/src/lasunzipper.cpp.o [ 75%] Building CXX object CMakeFiles/laszip.dir/src/laszipper.cpp.o [100%] Linking CXX shared module laszip.cpython-310-x86_64-linux-gnu.so [100%] Built target laszip

and then from within python: import laszip ImportError: /home/.../laszip-python/build/laszip.cpython-310-x86_64-linux-gnu.so: undefined symbol: laszip_read_point

tmontaigu commented 2 years ago

What's your OS, how did you install laszip ?

Rheinwalt commented 2 years ago

Arch Linux and I have 3 packages installed that might be of interest:

community/laszip2 2.2.0-1 (50.0 KiB 171.3 KiB) (Installed) ASPRS LAS lossless compression library — version 2 community/laszip 3.4.3-1 (128.5 KiB 496.7 KiB) (Installed) ASPRS LAS lossless compression library aur/lastools-git r653.20e9673-1 (+2 0.00) (Installed: r1251.e6b536d-1) Efficient tools for LiDAR processing. Contains LASlib, a C++ programming API for reading / writing LIDAR data stored in standard LAS format.

Are we looking for laslib/lasreadpoint.hpp ? That would be in /usr/include

tmontaigu commented 2 years ago

I tried to compile on manjaro an I had no problem importing the python module after building.

The library needed for this module is community/laszip 3.4.3-1. The header needed is laszip/laszip_api.h.

But your error is about missing symbol so, it may not be linked to the proper .so or not loading the proper .so.

The aur/lastools-git r653.20e9673-1 (+2 0.00) (Installed: r1251.e6b536d-1) seems old (2017) and when I tried it actually messed up everything when trying to compile.

You should try to just pip install laszip it may be easier

tmontaigu commented 2 years ago

I don't know when you installed aur/lastools-git but I think that is interferring as it may provide a liblaszip.so that is not the same as the liblaszip.so provided by community/laszip 3.4.3-1. So I would suggest maybe removing aur/lastools-git (unless you actually need it) and reinstalling community/laszip 3.4.3-1

Rheinwalt commented 2 years ago

I don't know when you installed aur/lastools-git but I think that is interferring as it may provide a liblaszip.so that is not the same as the liblaszip.so provided by community/laszip 3.4.3-1. So I would suggest maybe removing aur/lastools-git (unless you actually need it) and reinstalling community/laszip 3.4.3-1

Yes, I moved the lastools binaries to my local path and removed that package. That did the trick, did not even reinstall laszip. Btw laszip2 is not in conflict.

Thanks!