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

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 this issue Aug 17, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@MiaoDragon
Copy link

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:

  • one is undefined reference to `nanobind::builtin_exception::builtin_exception(nanobind::exception_type, char const*)'
  • another is /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

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!

@MiaoDragon MiaoDragon added the bug Something isn't working label Aug 17, 2024
@zkingston
Copy link
Contributor

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants