cmake

Unitree Go1 unitree_legged_sdk 'make' error


I try to build the unitree_legged_sdk v3.8.6 on my virtual Ubuntu 22.04 and follow the instructions:

mkdir build
cd build
cmake ..
make

But when I try to execute the command 'make' I get the following error:

.../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: final link failed: bad value

collect2: error: ld returned 1 exit status

make[2]: *** [CMakeFiles/example_position.dir/build.make:97: example_position] Error 1

make[1]: *** [CMakeFiles/Makefile2:125: CMakeFiles/example_position.dir/all] Error 2

make: *** [Makefile:136: all] Error 2

How I can solve this issue? Thank you.


Solution

  • I edited the CMakeLists.txt file of the unitree_legged_sdk and added the following line under add_executable(example_position example/example_position.cpp): target_link_options(example_position PRIVATE "-no-pie")

    No error anymore. Did this for every other target as well. Ran it on the Go1 and it worked.