Pseudomanifold / Aleph

A library for exploring persistent homology
https://pseudomanifold.github.io/Aleph/
MIT License
101 stars 17 forks source link

Building python binding with g++-4.8 results in undefined symbols #47

Closed ExpectationMax closed 6 years ago

ExpectationMax commented 6 years ago

Compiling the python binding with g++-4.8 successfully links, yet results in an unusable binary with undefined symbols.

Compiling with g++-6 works fine though.

Error when loading:

>>> import aleph as al
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: /home/hornm/Projects/DeepTDA/Aleph/build/bindings/python/aleph/aleph.so: undefined symbol: _ZNSt20regex_token_iteratorIN9__gnu_cxx17__normal_iteratorIPKcSsEEcSt12regex_traitsIcEEC1ES4_S4_RKSt11basic_regexIcS6_EiSt6bitsetILm11EE
Output CMake

``` -- The CXX compiler identification is GNU 4.8.4 -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- CMAKE_ROOT: /usr/share/cmake-2.8 -- CMAKE_SYSTEM_VERSION: 3.13.0-133-generic -- Performing Test ALEPH_HAVE_FLAG_Wall -- Performing Test ALEPH_HAVE_FLAG_Wall - Success -- Performing Test ALEPH_HAVE_FLAG_Wconversion -- Performing Test ALEPH_HAVE_FLAG_Wconversion - Success -- Performing Test ALEPH_HAVE_FLAG_Wextra -- Performing Test ALEPH_HAVE_FLAG_Wextra - Success -- Performing Test ALEPH_HAVE_FLAG_Wnon-virtual-dtor -- Performing Test ALEPH_HAVE_FLAG_Wnon-virtual-dtor - Success -- Performing Test ALEPH_HAVE_FLAG_Wold-style-cast -- Performing Test ALEPH_HAVE_FLAG_Wold-style-cast - Success -- Performing Test ALEPH_HAVE_FLAG_Woverloaded-virtual -- Performing Test ALEPH_HAVE_FLAG_Woverloaded-virtual - Success -- Performing Test ALEPH_HAVE_FLAG_Wself-init -- Performing Test ALEPH_HAVE_FLAG_Wself-init - Failed -- Performing Test ALEPH_HAVE_FLAG_Wunsafe-loop-optimization -- Performing Test ALEPH_HAVE_FLAG_Wunsafe-loop-optimization - Failed -- Performing Test ALEPH_HAVE_FLAG_pedantic -- Performing Test ALEPH_HAVE_FLAG_pedantic - Success -- Boost version: 1.67.0 -- Try OpenMP CXX flag = [-fopenmp] -- Performing Test OpenMP_FLAG_DETECTED -- Performing Test OpenMP_FLAG_DETECTED - Success -- Found OpenMP: -fopenmp -- Could NOT find FLANN (missing: FLANN_INCLUDE_DIR FLANN_LIBRARY) -- Found HDF5: HDF5_hdf5_cpp_LIBRARY-NOTFOUND;/usr/lib/x86_64-linux-gnu/libhdf5.so;/usr/lib/x86_64-linux-gnu/libpthread.so;/usr/lib/x86_64-linux-gnu/libz.so;/usr/lib/x86_64-linux-gnu/libdl.so;/usr/lib/x86_64-linux-gnu/libm.so CMake Warning at CMakeLists.txt:116 (MESSAGE): One of the required HDF5 C++ libraries was not found but the module returned HDF5_FOUND. This indicates a broken installation. -- Found PkgConfig: /usr/bin/pkg-config (found version "0.26") -- checking for one of the modules 'RapidJSON' -- checking for one of the modules 'eigen3' -- Found PythonInterp: /local0/software/python/python3_bleeding_edge/bin/python3 (found suitable version "3.6.4", minimum required is "3") -- Found PythonLibs: /local0/software/python/python3_bleeding_edge/lib (found suitable version "3.6.4", minimum required is "3") CMake Warning at CMakeLists.txt:150 (FIND_PACKAGE): By not providing "Findtinyxml2.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "tinyxml2", but CMake did not find one. Could not find a package configuration file provided by "tinyxml2" with any of the following names: tinyxml2Config.cmake tinyxml2-config.cmake Add the installation prefix of "tinyxml2" to CMAKE_PREFIX_PATH or set "tinyxml2_DIR" to a directory containing one of the above files. If "tinyxml2" provides a separate development package or SDK, be sure it has been installed. -- Found PYBIND11: X/pybind11/include -- Building tools -- Performing Test ALEPH_HAVE_FLAG_O3 -- Performing Test ALEPH_HAVE_FLAG_O3 - Success -- Building examples -- Performing Test ALEPH_HAVE_FLAG_Og -- Performing Test ALEPH_HAVE_FLAG_Og - Success -- Performing Test ALEPH_HAVE_FLAG_g -- Performing Test ALEPH_HAVE_FLAG_g - Success -- Performing Test ALEPH_HAVE_FLAG_Werror -- Performing Test ALEPH_HAVE_FLAG_Werror - Success -- Configuring done -- Generating done -- Build files have been written to: X/Aleph/build ```

Output of ldd and objdump

```bash aleph[0]> ldd aleph.so linux-vdso.so.1 => (0x00007ffd5acca000) libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f558b32f000) libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f558b029000) libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f558ae12000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f558aa49000) /lib64/ld-linux-x86-64.so.2 (0x00007f558bbbc000) aleph[0]> objdump -p aleph.so aleph.so: file format elf64-x86-64 Program Header: LOAD off 0x0000000000000000 vaddr 0x0000000000000000 paddr 0x0000000000000000 align 2**21 filesz 0x000000000036654b memsz 0x000000000036654b flags r-x LOAD off 0x0000000000366d48 vaddr 0x0000000000566d48 paddr 0x0000000000566d48 align 2**21 filesz 0x0000000000012428 memsz 0x00000000000125c0 flags rw- DYNAMIC off 0x00000000003688f0 vaddr 0x00000000005688f0 paddr 0x00000000005688f0 align 2**3 filesz 0x0000000000000200 memsz 0x0000000000000200 flags rw- NOTE off 0x00000000000001c8 vaddr 0x00000000000001c8 paddr 0x00000000000001c8 align 2**2 filesz 0x0000000000000024 memsz 0x0000000000000024 flags r-- EH_FRAME off 0x00000000002e98a8 vaddr 0x00000000002e98a8 paddr 0x00000000002e98a8 align 2**2 filesz 0x00000000000166a4 memsz 0x00000000000166a4 flags r-- STACK off 0x0000000000000000 vaddr 0x0000000000000000 paddr 0x0000000000000000 align 2**4 filesz 0x0000000000000000 memsz 0x0000000000000000 flags rw- RELRO off 0x0000000000366d48 vaddr 0x0000000000566d48 paddr 0x0000000000566d48 align 2**0 filesz 0x00000000000022b8 memsz 0x00000000000022b8 flags r-- Dynamic Section: NEEDED libstdc++.so.6 NEEDED libm.so.6 NEEDED libgcc_s.so.1 NEEDED libc.so.6 SONAME aleph.so INIT 0x00000000001d0fe0 FINI 0x00000000002e5820 INIT_ARRAY 0x0000000000566d48 INIT_ARRAYSZ 0x0000000000000010 FINI_ARRAY 0x0000000000566d58 FINI_ARRAYSZ 0x0000000000000008 GNU_HASH 0x00000000000001f0 STRTAB 0x0000000000056a28 SYMTAB 0x0000000000014cb0 STRSZ 0x00000000001409e4 SYMENT 0x0000000000000018 PLTGOT 0x0000000000569000 PLTRELSZ 0x0000000000030180 PLTREL 0x0000000000000007 JMPREL 0x00000000001a0e60 RELA 0x000000000019cd08 RELASZ 0x0000000000004158 RELAENT 0x0000000000000018 VERNEED 0x000000000019cbd8 VERNEEDNUM 0x0000000000000004 VERSYM 0x000000000019740c RELACOUNT 0x0000000000000080 Version References: required from libgcc_s.so.1: 0x0b792650 0x00 16 GCC_3.0 required from libm.so.6: 0x09691a75 0x00 12 GLIBC_2.2.5 required from libc.so.6: 0x0d696914 0x00 14 GLIBC_2.4 0x06969194 0x00 13 GLIBC_2.14 0x09691a75 0x00 04 GLIBC_2.2.5 required from libstdc++.so.6: 0x0297f861 0x00 15 GLIBCXX_3.4.11 0x0297f868 0x00 11 GLIBCXX_3.4.18 0x02297f85 0x00 10 GLIBCXX_3.4.5 0x0297f863 0x00 09 GLIBCXX_3.4.13 0x0297f864 0x00 08 GLIBCXX_3.4.14 0x0bafd173 0x00 07 CXXABI_1.3.3 0x0bafd175 0x00 06 CXXABI_1.3.5 0x0297f865 0x00 05 GLIBCXX_3.4.15 0x056bafd3 0x00 03 CXXABI_1.3 0x08922974 0x00 02 GLIBCXX_3.4 ```

Pseudomanifold commented 6 years ago

Workaround/fix in master. The culprit is the missing implementation of std::regex_token_iterator in that particular version of gcc. Aleph detects this situation now upon compile time and falls back to Boost. This, however, requires another run-time dependency but not a more recent compiler.

I already checked this on my personal systems and on Travis. Can you give me the details for reproducing the bug on our systems as well?