unitreerobotics / unitree_legged_sdk

SDK tools for control robots.
BSD 3-Clause "New" or "Revised" License
270 stars 156 forks source link

..."R_X86_64_PC32"... can not be used when making a PIE object #140

Closed Awin-G closed 1 month ago

Awin-G commented 1 month ago

The following compilation error is reported:

/usr/bin/ld: /home/awin/Mydisk/中转站/unitree/unitree_legged_sdk/lib/cpp/amd64/libunitree_legged_sdk.a(loop.cpp.o): relocation R_X86_64_PC32 against undefined hidden symbol _ZTCN5boost10wrapexceptINS_17bad_function_callEEE0_NS_16exception_detail10clone_implINS3_19error_info_injectorIS1_EEEE' can not be used when making a PIE object /usr/bin/ld: 最后的链结失败: bad value collect2: error: ld returned 1 exit status make[2]: *** [CMakeFiles/example_position.dir/build.make:97:example_position] 错误 1 make[1]: *** [CMakeFiles/Makefile2:91:CMakeFiles/example_position.dir/all] 错误 2 make: *** [Makefile:136:all] 错误 2 environment: Linux awin-ubuntu 6.5.0-26-generic #26-Ubuntu SMP PREEMPT_DYNAMIC Tue Mar 5 21:19:28 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux`with:

g++:
g++ (Ubuntu 13.2.0-4ubuntu3) 13.2.0
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
cmake:
cmake version 3.27.4
boost:
libboost1.81-dev

The answer to some similar questions says to use a ‘-fPIE’ flag,but -fPIE is already in CMakeList.txt?? image

Awin-G commented 1 month ago

。。。Found a solution。。。 add flag:-no-PIE in CMakeList.txt:

image

And then all was right