unitreerobotics / unitree_legged_sdk

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

Cannot install - error related to linking #48

Open Velythyl opened 2 years ago

Velythyl commented 2 years ago

Hello!

Thank you for writing this library. I want to control the Go1 robot's low level controller using python.

But I cannot install this library (see attached log)

┌─[charlie@pop-os] - [~/Desktop/unitree_legged_latest_sdk/build] - [2022-07-13 04:59:43]
└─[0] <git:(master 1304ed0✈) > make
[ 10%] Building CXX object CMakeFiles/example_position.dir/example/example_position.cpp.o
In file included from /usr/include/boost/smart_ptr/detail/sp_thread_sleep.hpp:22,
                 from /usr/include/boost/smart_ptr/detail/yield_k.hpp:23,
                 from /usr/include/boost/smart_ptr/detail/spinlock_gcc_atomic.hpp:14,
                 from /usr/include/boost/smart_ptr/detail/spinlock.hpp:42,
                 from /usr/include/boost/smart_ptr/detail/spinlock_pool.hpp:25,
                 from /usr/include/boost/smart_ptr/shared_ptr.hpp:29,
                 from /usr/include/boost/shared_ptr.hpp:17,
                 from /home/charlie/Desktop/unitree_legged_latest_sdk/include/unitree_legged_sdk/loop.h:14,
                 from /home/charlie/Desktop/unitree_legged_latest_sdk/include/unitree_legged_sdk/unitree_legged_sdk.h:11,
                 from /home/charlie/Desktop/unitree_legged_latest_sdk/example/example_position.cpp:5:
/usr/include/boost/bind.hpp:36:1: note: ‘#pragma message: The practice of declaring the Bind placeholders (_1, _2, ...) in the global namespace is deprecated. Please use <boost/bind/bind.hpp> + using namespace boost::placeholders, or define BOOST_BIND_GLOBAL_PLACEHOLDERS to retain the current behavior.’
   36 | BOOST_PRAGMA_MESSAGE(
      | ^~~~~~~~~~~~~~~~~~~~
[ 20%] Linking CXX executable example_position
/usr/bin/ld: /home/charlie/Desktop/unitree_legged_latest_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:91: CMakeFiles/example_position.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

I think the /home/charlie/Desktop/unitree_legged_latest_sdk/lib/cpp/amd64/libunitree_legged_sdk.a provided was not compiled with the right option https://stackoverflow.com/questions/19768267/relocation-r-x86-64-32s-against-linking-error

If it's my fault that it won't compile, can you let me know how to compile it such that it works? thank you

TrivasZhang commented 2 years ago

The lib has -fPIC flags. It seems like boost releated issue. You can check your own boost version at /usr/include/boost/version.hpp

yosagi commented 2 years ago

I've got a same error on Ubuntu 22.04.

Ubuntu 22.04 CMake 3.22.1 Boost 1.74 g++ 11.2.0

On Ubuntu 20.04, it compiles fine.

Ubuntu 20.04 CMake 3.16.3 Boost 1.71 g++ 9.4.0

Velythyl commented 2 years ago

Any news on this?

bpesun commented 2 years ago

I've got a same error on raspberry pi 4B. It seemed that can not find the lib. the log file: bpesun@raspberrypi:~/Downloads/unitree_legged_sdk-master/build $ bpesun@raspberrypi:~/Downloads/unitree_legged_sdk-master/build $ cd /home/bpesun/Downloads/unitree_legged_sdk-master bpesun@raspberrypi:~/Downloads/unitree_legged_sdk-master $ ls CMakeLists.txt example example_py include lib LICENSE README.md bpesun@raspberrypi:~/Downloads/unitree_legged_sdk-master $ mkdir build bpesun@raspberrypi:~/Downloads/unitree_legged_sdk-master $ cd build bpesun@raspberrypi:~/Downloads/unitree_legged_sdk-master/build $ ls bpesun@raspberrypi:~/Downloads/unitree_legged_sdk-master/build $ cmake ../ -- The C compiler identification is GNU 10.2.1 -- The CXX compiler identification is GNU 10.2.1 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /usr/bin/cc - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /usr/bin/c++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- CMAKE_SYSTEM_PROCESSOR: armv7l -- Configuring done -- Generating done -- Build files have been written to: /home/bpesun/Downloads/unitree_legged_sdk-master/build bpesun@raspberrypi:~/Downloads/unitree_legged_sdk-master/build $ make Scanning dependencies of target example_walk [ 10%] Building CXX object CMakeFiles/example_walk.dir/example/example_walk.cpp.o In file included from /usr/include/boost/smart_ptr/detail/sp_thread_sleep.hpp:22, from /usr/include/boost/smart_ptr/detail/yield_k.hpp:23, from /usr/include/boost/smart_ptr/detail/spinlock_gcc_atomic.hpp:14, from /usr/include/boost/smart_ptr/detail/spinlock.hpp:42, from /usr/include/boost/smart_ptr/detail/spinlock_pool.hpp:25, from /usr/include/boost/smart_ptr/shared_ptr.hpp:29, from /usr/include/boost/shared_ptr.hpp:17, from /home/bpesun/Downloads/unitree_legged_sdk-master/include/unitree_legged_sdk/loop.h:14, from /home/bpesun/Downloads/unitree_legged_sdk-master/include/unitree_legged_sdk/unitree_legged_sdk.h:11, from /home/bpesun/Downloads/unitree_legged_sdk-master/example/example_walk.cpp:5: /usr/include/boost/bind.hpp:36:1: note: ‘#pragma message: The practice of declaring the Bind placeholders (_1, _2, ...) in the global namespace is deprecated. Please use <boost/bind/bind.hpp> + using namespace boost::placeholders, or define BOOST_BIND_GLOBAL_PLACEHOLDERS to retain the current behavior.’ 36 | BOOST_PRAGMA_MESSAGE( | ^~~~~~~~~~~~~~~~~~~~ [ 20%] Linking CXX executable example_walk /usr/bin/ld: cannot find -lunitree_legged_sdk collect2: error: ld returned 1 exit status make[2]: *** [CMakeFiles/example_walk.dir/build.make:103: example_walk] Error 1 make[1]: *** [CMakeFiles/Makefile2:103: CMakeFiles/example_walk.dir/all] Error 2 make: *** [Makefile:149: all] Error 2

bpesun commented 2 years ago

sorry. I changed the raspberry pi4 OS form 32bits to 64bits and the exmaple worked.

Velythyl commented 2 years ago

NEW PR:

This way even 22.04 users can run this repo.

https://github.com/unitreerobotics/unitree_legged_sdk/pull/56

bpesun commented 2 years ago

hi Velythyl, Thanks for your files. You said 22.04 can run your repo. Could you please give the instruction to run your reop? I used the methord by unitree,

cmake ../
make

but when i run the python example, it can not find the lib. The log:

pi@pi-desktop:~/Desktop/unitree_legged_sdk-master/example_py$ python3 example_walk.py
Traceback (most recent call last):
  File "/home/pi/Desktop/unitree_legged_sdk-master/example_py/example_walk.py", line 8, in <module>
    import robot_interface as sdk
ModuleNotFoundError: No module named 'robot_interface'

platform: raspberry Pi4B os: ubuntu desktop 22.04.1 LTS python: Python 3.10.4 CMake: 3.22.1 Boost: 1.74 g++ : 11.2.0

It seemed it can not find the python lib, the version of python is too high?should i back to python3.8? or the python lib should be created by the make command? Is the python lib created by make command or by unitree? Thanks

amburkoff commented 1 year ago

I have the same error on ubuntu 22.04 SDK ver v3.8.0: /usr/bin/ld: /home/amb/Workspace/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:91: CMakeFiles/example_position.dir/all] Error 2 make: *** [Makefile:136: all] Error 2

How to fix it? or when will the corrected version of the sdk be released?

bpesun commented 1 year ago

anything new?

xyq1223 commented 1 year ago

Hello, our SDK does not support ubuntu 22.04, you can try ubuntu 18.04

ahanjaya commented 3 months ago

Hi, here is my way to compile the sdk with ubuntu 22:

  1. Download the older libboost-1_66
  2. unzip the downloaded libboost
  3. ./bootstrap.sh
  4. ./b2
  5. sudo ./b2 install

    redo the cmake .. and make the sdk folder.