KavrakiLab / vamp

SIMD-Accelerated Sampling-based Motion Planning
Other
150 stars 18 forks source link

Facing compilation error "relocation R_X86_64_PC32 against undefined hidden symbol ... can not be used when making a shared object #25

Open MiaoDragon opened 1 month ago

MiaoDragon commented 1 month ago

Hello,

Thank you for the effort of creating this software. I'm a PhD student working on robotic manipulations, and I'm planning to try this software to do motion planning due to its speed. I'm facing some difficulties compiling the software. I followed the instruction to download the software through github, and then tried both to pip install it and cmake it. However, in both cases, I'm having issues during compilation with a long error message. I'll post the last several lines of the error message, and hope that this may help explain the issue. I'm getting the following error:

<artificial>:(.text.unlikely._ZZN8nanobind6detail11func_createILb0ELb1EZNS0_18make_iterator_implINS0_15iterator_accessIN9__gnu_cxx17__normal_iteratorIPKN4vamp6VectorINS6_10SIMDVectorIDv8_fEELm1ELm3EEESt6vectorISB_SaISB_EEEEEELNS_9rv_policyE1ESH_SH_RSC_JEEENS_5typedINS_8iteratorEJT3_EEENS_6handleEPKcOT1_OT2_DpOT4_EUlRNS0_14iterator_stateISI_LSJ_1ESH_SH_SK_JEEEE0_SK_JS11_EJLm0EEJNS_5scopeENS_4nameENS_9is_methodESJ_EEEP7_objectST_PFSU_DpT3_ESt16integer_sequenceImJXspT4_EEEDpRKT5_ENUlPvPS17_PhSJ_PNS0_12cleanup_listEE_4_FUNES1I_S1J_S1K_SJ_S1M_+0x1d): undefined reference to `nanobind::builtin_exception::builtin_exception(nanobind::exception_type, char const*)'
/home/yinglong/micromamba/envs/ros_env/bin/../lib/gcc/x86_64-conda-linux-gnu/12.4.0/../../../../x86_64-conda-linux-gnu/bin/ld: <artificial>:(.text.unlikely._ZZN8nanobind6detail11func_createILb0ELb1EZNS0_18make_iterator_implINS0_15iterator_accessIN9__gnu_cxx17__normal_iteratorIPKN4vamp6VectorINS6_10SIMDVectorIDv8_fEELm1ELm3EEESt6vectorISB_SaISB_EEEEEELNS_9rv_policyE1ESH_SH_RSC_JEEENS_5typedINS_8iteratorEJT3_EEENS_6handleEPKcOT1_OT2_DpOT4_EUlRNS0_14iterator_stateISI_LSJ_1ESH_SH_SK_JEEEE0_SK_JS11_EJLm0EEJNS_5scopeENS_4nameENS_9is_methodESJ_EEEP7_objectST_PFSU_DpT3_ESt16integer_sequenceImJXspT4_EEEDpRKT5_ENUlPvPS17_PhSJ_PNS0_12cleanup_listEE_4_FUNES1I_S1J_S1K_SJ_S1M_+0x2b): undefined reference to `nanobind::builtin_exception::~builtin_exception()'
/home/yinglong/micromamba/envs/ros_env/bin/../lib/gcc/x86_64-conda-linux-gnu/12.4.0/../../../../x86_64-conda-linux-gnu/bin/ld: /tmp/ccmJi8mG.ltrans4.ltrans.o: relocation R_X86_64_PC32 against undefined hidden symbol `_ZN8nanobind17builtin_exceptionD1Ev' can not be used when making a shared object
/home/yinglong/micromamba/envs/ros_env/bin/../lib/gcc/x86_64-conda-linux-gnu/12.4.0/../../../../x86_64-conda-linux-gnu/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/_core_ext.dir/build.make:242: _core_ext.cpython-311-x86_64-linux-gnu.so] Error 1
make[1]: *** [CMakeFiles/Makefile2:112: CMakeFiles/_core_ext.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

I guess there are two main types of errors:

I'm using Ubuntu system and inside a micromamba environment with python version 3.11.8. GCC version is 12.4.0.

Please let me know if you have any ideas to fix the problem. Thanks!

zkingston commented 2 weeks ago

@MiaoDragon sorry for the delayed reply. I was able to replicate this bug with the following environment:

micromamba create -n vamp_test -c conda-forge python=3.11.8 gcc_linux-64=12.4 gxx=12.4 eigen

While I don't have time to fully debug what is happening, I can tell you that the issue is link time optimization (LTO), and that if you disable LTO by changing the pyproject.toml:

# LTO is set to "ON" by default, disable it
VAMP_LTO = "OFF"

You should be able to compile the library successfully with only a small performance degradation over the LTO'd library.