Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

`GLIBCXX_3.4.30' not found for importing _limap #2

Closed
cherubicXN opened this issue Mar 31, 2023 · 5 comments
Closed

`GLIBCXX_3.4.30' not found for importing _limap #2

cherubicXN opened this issue Mar 31, 2023 · 5 comments

Comments

@cherubicXN
Copy link

Thanks for your great work!

While running the quickstart on my machine, I found an issue with importing _limap with the errors as shown below:

(limap) [TITAN] ➜  limap git:(main) ✗ python runners/hypersim/triangulation.py --output_dir outputs/quickstart_triangulation

Traceback (most recent call last):
  File "/home/xn/repo/limap/runners/hypersim/triangulation.py", line 6, in <module>
    from loader import read_scene_hypersim
  File "/home/xn/repo/limap/runners/hypersim/loader.py", line 7, in <module>
    import limap.base as _base
  File "/home/xn/repo/limap/limap/__init__.py", line 3, in <module>
    from _limap import *
ImportError: /home/xn/anaconda3/envs/limap/bin/../lib/libstdc++.so.6: version `GLIBCXX_3.4.30' not found (required by /home/xn/repo/limap/_limap.cpython-39-x86_64-linux-gnu.so)

After checking the code, I found the issue is caused by the sys.path.append at triangulation.py#L4.

When I first import _limap at triangulation.py#L3, the problem is solved.

@B1ueber2y
Copy link
Member

Hey thanks for the interest and contribution!

I never came across this issue. Could you provide more details on reproducing it? I do not understand why adding "import _limap" can resolve this issue. Is there any chance that you could clarify on this?

Thanks a lot!

@iago-suarez
Copy link

This is something usual when using anaconda. The error is saying that you have compiled the library (/home/xn/repo/limap/_limap.cpython-39-x86_64-linux-gnu.so) with a different C++ version than the one used to compile the python version that you are trying to use (/home/xn/anaconda3/envs/limap/bin/../lib/libstdc++.so.6).

This usually happens because when compiling the limap library in this case, the system compiler and C++ version is used but the correct one would be the anaconda version. A simple fix uses to be installing the proper gcc and cmake version in anaconda. In such a way that the default cmake is the anaconda one instead of the system one.

try with (untested):

conda install cmake

And re-compile the limap library

@cherubicXN
Copy link
Author

Hello,

I am currently working with the following runtime environment:

  • Ubuntu 22.04.1
  • Anaconda 4.13.0
  • CUDA 11.7
  • Python 3.9
  • PyTorch 1.13.0+cu117 (installed using pip install torch==1.13.0+cu117 torchvision==0.14.0+cu117 torchaudio==0.13.0 --extra-index-url https://download.pytorch.org/whl/cu117)
Click to see my CMake Outputs
-- The C compiler identification is GNU 9.5.0
-- The CXX compiler identification is GNU 9.5.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/gcc-9 - 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/g++-9 - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found OpenMP_C: -fopenmp (found version "4.5")
-- Found OpenMP_CXX: -fopenmp (found version "4.5")
-- Found OpenMP: TRUE (found version "4.5")
-- Enabling OpenMP support
-- Disabling pixelwise optimization with ceres interpolation.
-- Found METIS: /usr/include (found suitable version "5.1.0", minimum required is "5.1.0")
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Found AMD headers in: /usr/include/suitesparse
-- Found AMD library: /usr/lib/x86_64-linux-gnu/libamd.so
-- Found CAMD headers in: /usr/include/suitesparse
-- Found CAMD library: /usr/lib/x86_64-linux-gnu/libcamd.so
-- Found CCOLAMD headers in: /usr/include/suitesparse
-- Found CCOLAMD library: /usr/lib/x86_64-linux-gnu/libccolamd.so
-- Found CHOLMOD headers in: /usr/include/suitesparse
-- Found CHOLMOD library: /usr/lib/x86_64-linux-gnu/libcholmod.so
-- Found COLAMD headers in: /usr/include/suitesparse
-- Found COLAMD library: /usr/lib/x86_64-linux-gnu/libcolamd.so
-- Found SPQR headers in: /usr/include/suitesparse
-- Found SPQR library: /usr/lib/x86_64-linux-gnu/libspqr.so
-- Found Config headers in: /usr/include/suitesparse
-- Found Config library: /usr/lib/x86_64-linux-gnu/libsuitesparseconfig.so
-- Did not find Intel TBB library, assuming SuiteSparseQR was not compiled with TBB.
-- Looking for shm_open in rt
-- Looking for shm_open in rt - found
-- Adding librt to SuiteSparse_config libraries (required on Linux & Unix [not OSX] if SuiteSparse is compiled with timing).
-- Found METIS: /usr/include (found version "5.1.0")
-- Looking for cholmod_metis
-- Looking for cholmod_metis - found
-- Found SuiteSparse: /usr/include/suitesparse (found suitable version "5.10.1", minimum required is "5.10.1") found components: AMD CAMD CCOLAMD CHOLMOD COLAMD SPQR Config
-- Found required Ceres dependency: Eigen version 3.4.0 in /usr/share/eigen3/cmake
-- Found required Ceres dependency: glog
-- Found required Ceres dependency: gflags
-- Found Ceres version: 2.2.0 installed in: /usr/local with components: [EigenSparse, SparseLinearAlgebraLibrary, LAPACK, SuiteSparse, SchurSpecializations, Multithreading]
-- Found Boost: /usr/lib/x86_64-linux-gnu/cmake/Boost-1.74.0/BoostConfig.cmake (found version "1.74.0") found components: program_options filesystem system unit_test_framework
-- Found Eigen3: /usr/include/eigen3 (Required is at least version "2.91.0")
-- Found Eigen
--   Includes : /usr/include/eigen3
-- Found FreeImage
--   Includes : /usr/include
--   Libraries : /usr/lib/x86_64-linux-gnu/libfreeimage.so
-- Found Glog
--   Includes : /usr/local/include
--   Libraries : /usr/local/lib/libglog.so
-- Found OpenGL: /usr/lib/x86_64-linux-gnu/libOpenGL.so
-- Found Glew
--   Includes : /usr/include
--   Libraries : /usr/lib/x86_64-linux-gnu/libGLEW.so
-- Using header-only CGAL
-- Targetting Unix Makefiles
-- Using /usr/bin/g++-9 compiler.
-- Found GMP: /usr/lib/x86_64-linux-gnu/libgmp.so
-- Found MPFR: /usr/lib/x86_64-linux-gnu/libmpfr.so
-- Found Boost: /usr/lib/x86_64-linux-gnu/cmake/Boost-1.74.0/BoostConfig.cmake (found suitable version "1.74.0", minimum required is "1.48")
-- Boost include dirs: /usr/include
-- Boost libraries:
-- Using gcc version 4 or later. Adding -frounding-math
-- Setting build type to 'RelWithDebInfo' as none was specified.
-- Found HDF5: /usr/lib/x86_64-linux-gnu/hdf5/serial/libhdf5.so;/usr/lib/x86_64-linux-gnu/libcrypto.so;/usr/lib/x86_64-linux-gnu/libcurl.so;/usr/lib/x86_64-linux-gnu/libpthread.a;/usr/lib/x86_64-linux-gnu/libsz.so;/usr/lib/x86_64-linux-gnu/libz.so;/usr/lib/x86_64-linux-gnu/libdl.a;/usr/lib/x86_64-linux-gnu/libm.so (found version "1.10.7")
-- Found Boost: /usr/include (found version "1.74.0") found components: system serialization
-- pybind11 v2.10.0 dev1
-- Found PythonInterp: /home/xn/anaconda3/envs/limap/bin/python (found suitable version "3.9", minimum required is "3.6")
-- Found PythonLibs: /home/xn/anaconda3/envs/limap/lib/libpython3.9.so
-- Performing Test HAS_FLTO
-- Performing Test HAS_FLTO - Success
Build type: RelWithDebInfo
-- Creating target: igl::core (igl_core)
-- Configuring done
-- Generating done

I tried implementing @iago-suarez's solution but still encountered the same issue. I believe the main cause is the use of Anaconda. However, I discovered that the compiled _limap module could be successfully imported in the terminal, as shown below:

(limap) [TITAN] ➜  limap git:(main) ✗ python
Python 3.9.0 (default, Nov 15 2020, 14:28:56)
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import _limap
>>>

I further investigated the problem by attempting to import _limap before or after triangulation.py#L4, both of which were successful. Since _limap is actually imported at hypersim/loader.py#L5, I set a breakpoint at the beginning of loader.py and then tried importing _limap. Unfortunately, I encountered the same error.

So, my current solution to avoid this issue is importing the _limap or limap in the first.

On my machine, I encounter the same issue with other runners as well, such as ETH3D.

@B1ueber2y
Copy link
Member

B1ueber2y commented Apr 16, 2023

Maybe the problem can be resolved by linking your existing libstdc++.so file to the anaconda environment by

ln -sf /usr/lib/x86_64-linux-gnu/libstdc++.so.6  {path to anaconda}/envs/limap/bin/../lib/libstdc++.so.6

I never encountered this issue myself but got inspiration from similar issue from another project. Thanks!

@cherubicXN
Copy link
Author

It works! Thanks!

zhangshaos pushed a commit to zhangshaos/limap that referenced this issue Jul 12, 2023
add options to map back to the original image.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants