jedeschaud / ct_icp

CT-ICP: Continuous-Time LiDAR Odometry
MIT License
766 stars 131 forks source link

Fail to copy libglog during superbuild #66

Closed gitouni closed 1 year ago

gitouni commented 1 year ago

Thank you for sharing your advanced work. I met an issue during step1. It seems that the installed glog in my system conflicts with the glog linked by superbuild.

Environment

System ROS GCC Cmake
Ubuntu 20.04 noetic 9.4.0 3.25.0

Issue

Issue appeared when using command cmake --build . --config Release in Step 1 Output (part)

[ 36%] Linking CXX shared library libglog.so
/usr/bin/ld: /usr/local/lib/libgflags.a(gflags.cc.o): relocation R_X86_64_PC32 against symbol `stderr@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: 最后的链结失败: bad value
collect2: error: ld returned 1 exit status
make[8]: *** [CMakeFiles/glog.dir/build.make:194:libglog.so.0.5.0] 错误 1
make[7]: *** [CMakeFiles/Makefile2:853:CMakeFiles/glog.dir/all] 错误 2
make[6]: *** [Makefile:166:all] 错误 2
make[5]: *** [CMakeFiles/glog.dir/build.make:86:glog/src/glog-stamp/glog-build] 错误 2
make[4]: *** [CMakeFiles/Makefile2:154:CMakeFiles/glog.dir/all] 错误 2
make[3]: *** [Makefile:136:all] 错误 2
make[2]: *** [CMakeFiles/MappingResearchKEU_superbuild.dir/build.make:86:MappingResearchKEU_superbuild/src/MappingResearchKEU_superbuild-stamp/MappingResearchKEU_superbuild-build] 错误 2
make[1]: *** [CMakeFiles/Makefile2:83:CMakeFiles/MappingResearchKEU_superbuild.dir/all] 错误 2
make: *** [Makefile:91:all] 错误 2

Possible Cause

Conflict between glog and gflags. Maybe superbuild links one using its static library while links the other using its dynamic library.

fratopa commented 1 year ago

I have the same setup as you do and i encountered a very similar error:

[ 15%] Performing build step for 'viz3d'
-- The C compiler identification is GNU 9.4.0
-- The CXX compiler identification is GNU 9.4.0
-- Check for working C compiler: /usr/lib/ccache/cc
-- Check for working C compiler: /usr/lib/ccache/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/lib/ccache/c++
-- Check for working CXX compiler: /usr/lib/ccache/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at cmake/external.cmake:8 (find_package):
  By not providing "Findglog.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "glog", but
  CMake did not find one.

  Could not find a package configuration file provided by "glog" with any of
  the following names:

    glogConfig.cmake
    glog-config.cmake

  Add the installation prefix of "glog" to CMAKE_PREFIX_PATH or set
  "glog_DIR" to a directory containing one of the above files.  If "glog"
  provides a separate development package or SDK, be sure it has been
  installed.
Call Stack (most recent call first):
  CMakeLists.txt:11 (include)

-- Configuring incomplete, errors occurred!
See also "/home/MyUserName/ct_icp/.cmake-build-superbuild/MappingResearchKEU_superbuild/src/MappingResearchKEU_superbuild-build/viz3d/src/viz3d-build/CMakeFiles/CMakeOutput.log".
make[5]: *** [CMakeFiles/viz3d.dir/build.make:113: viz3d/src/viz3d-stamp/viz3d-build] Error 1
make[4]: *** [CMakeFiles/Makefile2:124: CMakeFiles/viz3d.dir/all] Error 2
make[3]: *** [Makefile:130: all] Error 2
make[2]: *** [CMakeFiles/MappingResearchKEU_superbuild.dir/build.make:112: MappingResearchKEU_superbuild/src/MappingResearchKEU_superbuild-stamp/MappingResearchKEU_superbuild-build] Error 2
make[1]: *** [CMakeFiles/Makefile2:76: CMakeFiles/MappingResearchKEU_superbuild.dir/all] Error 2
make: *** [Makefile:84: all] Error 2

Have you found a way to deal with the glog problem?

fratopa commented 1 year ago

Moving from Gcc 9.4.0 to gcc 11.1.0 solved the glog problem, I still have more but its a step forward I guess. You can check issue 67 to check where I get stuck now

pierdell commented 1 year ago

Thank you for sharing your advanced work. I met an issue during step1. It seems that the installed glog in my system conflicts with the glog linked by superbuild.

Environment

System ROS GCC Cmake Ubuntu 20.04 noetic 9.4.0 3.25.0

Issue

Issue appeared when using command cmake --build . --config Release in Step 1 Output (part)

[ 36%] Linking CXX shared library libglog.so
/usr/bin/ld: /usr/local/lib/libgflags.a(gflags.cc.o): relocation R_X86_64_PC32 against symbol `stderr@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: 最后的链结失败: bad value
collect2: error: ld returned 1 exit status
make[8]: *** [CMakeFiles/glog.dir/build.make:194:libglog.so.0.5.0] 错误 1
make[7]: *** [CMakeFiles/Makefile2:853:CMakeFiles/glog.dir/all] 错误 2
make[6]: *** [Makefile:166:all] 错误 2
make[5]: *** [CMakeFiles/glog.dir/build.make:86:glog/src/glog-stamp/glog-build] 错误 2
make[4]: *** [CMakeFiles/Makefile2:154:CMakeFiles/glog.dir/all] 错误 2
make[3]: *** [Makefile:136:all] 错误 2
make[2]: *** [CMakeFiles/MappingResearchKEU_superbuild.dir/build.make:86:MappingResearchKEU_superbuild/src/MappingResearchKEU_superbuild-stamp/MappingResearchKEU_superbuild-build] 错误 2
make[1]: *** [CMakeFiles/Makefile2:83:CMakeFiles/MappingResearchKEU_superbuild.dir/all] 错误 2
make: *** [Makefile:91:all] 错误 2

Possible Cause

Conflict between glog and gflags. Maybe superbuild links one using its static library while links the other using its dynamic library.

You could also maybe try to build glog without gflags,

(See the CMakeLists.txt from gflags:

https://github.com/google/glog/blob/674283420118bb919f83ceb3d9dee31ef43ff3aa/CMakeLists.txt#L40 )

And set -DWITH_GFLAGS=OFF in the relevant script

(see https://gitlab.kitware.com/keu-computervision/MappingResearchKEU/Superbuild/-/blob/master/CMakeLists.txt#L85 )

gitouni commented 1 year ago

I appreciate the replies from @pierdell and @fratopa. I have solved this problem in a manual way.

First, add -DWITH_GFLAGS=OFF config in .cmake-build-superbuild/MappingResearchKEU_superbuild/src/MappingResearchKEU_superbuild/CMakeLists.txt does fix the bug in the Step 1, but the same bug emegered at my step 2. To fix it, we need to manually change the static link files to the dynamic ones in link.txt.

1. First, run the first two commands of Step 2:

mkdir cmake-build-release && cd  cmake-build-release  
cmake .. -DCMAKE_BUILD_TYPE=Release 

2. Second, manually modify the link.txt files.

Cmake Passed!

...
-- Up-to-date: /home/bit/CODE/Drivers/ct_icp/install/CT_ICP/include/SlamCore/cereal.h
-- Installing: /home/bit/CODE/Drivers/ct_icp/install/CT_ICP/lib/cmake/cmake
-- Installing: /home/bit/CODE/Drivers/ct_icp/install/CT_ICP/lib/cmake/cmake/target_utils.cmake
-- Installing: /home/bit/CODE/Drivers/ct_icp/install/CT_ICP/lib/cmake/cmake/utils.cmake
-- Installing: /home/bit/CODE/Drivers/ct_icp/install/CT_ICP/lib/cmake/cmake/test_utils.cmake
-- Installing: /home/bit/CODE/Drivers/ct_icp/install/CT_ICP/lib/cmake/cmake/includes.cmake
-- Installing: /home/bit/CODE/Drivers/ct_icp/install/CT_ICP/lib/cmake/cmake/project_config.cmake.in
-- Installing: /home/bit/CODE/Drivers/ct_icp/install/CT_ICP/lib/cmake/cmake/install_utils.cmake
-- Installing: /home/bit/CODE/Drivers/ct_icp/install/CT_ICP/lib/cmake/cmake/viz3d_utils.cmake
-- Installing: /home/bit/CODE/Drivers/ct_icp/install/CT_ICP/lib/cmake/cmake/superbuild_utils.cmake
-- Installing: /home/bit/CODE/Drivers/ct_icp/install/CT_ICP/lib/cmake/cmake/external.cmake
-- Installing: /home/bit/CODE/Drivers/ct_icp/install/CT_ICP/lib/cmake/cmake/flags.cmake
-- Installing: /home/bit/CODE/Drivers/ct_icp/install/CT_ICP/test/all_tests
-- Set runtime path of "/home/bit/CODE/Drivers/ct_icp/install/CT_ICP/test/all_tests" to ":/usr/local/lib:/usr/local/lib:/home/bit/CODE/Drivers/ct_icp/install/yaml-cpp/lib:/home/bit/CODE/Drivers/ct_icp/install/tinyply/lib:/home/bit/CODE/Drivers/ct_icp/install/CT_ICP/lib:/home/bit/CODE/Drivers/ct_icp/install/CT_ICP/lib:/usr/local/lib:/usr/local/cuda-11.1/lib64"
-- Installing: /home/bit/CODE/Drivers/ct_icp/install/CT_ICP/bin/run_odometry
-- Set runtime path of "/home/bit/CODE/Drivers/ct_icp/install/CT_ICP/bin/run_odometry" to ":/usr/local/lib:/usr/local/lib:/home/bit/CODE/Drivers/ct_icp/install/yaml-cpp/lib:/home/bit/CODE/Drivers/ct_icp/install/tinyply/lib:/home/bit/CODE/Drivers/ct_icp/install/CT_ICP/lib:/home/bit/CODE/Drivers/ct_icp/install/CT_ICP/lib:/usr/local/cuda-11.1/lib64:/usr/local/lib"