unitreerobotics / unitree_mujoco

BSD 3-Clause "New" or "Revised" License
161 stars 42 forks source link

Undefined reference to "gettid" when compiling unitree_mujoco #13

Open thisismoiself opened 3 months ago

thisismoiself commented 3 months ago

The installs of mujoco and the unitree_sdk2 were successful.

However, when i try to compile unitree_mujoco with "cmake .." and "make" in unitree_mujoco/simulate/build, I get the following error:

//usr/local/lib/libunitree_sdk2.a(os.cpp.o): In function unitree::common::OsHelper::GetTid()': os.cpp:(.text+0x4d3): undefined reference to gettid' //usr/local/lib/libunitree_sdk2.a(lock.cpp.o): In function unitree::common::AssertEqual(int, int, bool, char const*, char const*, int)': lock.cpp:(.text._ZN7unitree6common11AssertEqualEiibPKcS2_i[_ZN7unitree6common11AssertEqualEiibPKcS2_i]+0x84): undefined reference to gettid' lock.cpp:(.text._ZN7unitree6common11AssertEqualEiibPKcS2_i[_ZN7unitree6common11AssertEqualEiibPKcS2_i]+0x190): undefined reference to gettid' //usr/local/lib/libunitree_sdk2.a(lock.cpp.o): In function unitree::common::AssertEqual(int, int, int, bool, char const*, char const*, int)': lock.cpp:(.text._ZN7unitree6common11AssertEqualEiiibPKcS2_i[_ZN7unitree6common11AssertEqualEiiibPKcS2_i]+0x9c): undefined reference to gettid' lock.cpp:(.text._ZN7unitree6common11AssertEqualEiiibPKcS2_i[_ZN7unitree6common11AssertEqualEiiibPKcS2_i]+0x1a3): undefined reference to gettid' //usr/local/lib/libunitree_sdk2.a(lock.cpp.o):lock.cpp:(.text._ZN7unitree6common13AssertEqualExEiiibPKcS2_i[_ZN7unitree6common13AssertEqualExEiiibPKcS2_i]+0xaf): more undefined references to gettid' follow collect2: error: ld returned 1 exit status CMakeFiles/unitree_mujoco.dir/build.make:177: recipe for target 'unitree_mujoco' failed make[2]: *** [unitree_mujoco] Error 1 CMakeFiles/Makefile2:82: recipe for target 'CMakeFiles/unitree_mujoco.dir/all' failed make[1]: *** [CMakeFiles/unitree_mujoco.dir/all] Error 2 Makefile:86: recipe for target 'all' failed make: *** [all] Error 2

When checking for the symbol "gettid" in libunitree_sdk2.a with nm -C /usr/local/lib/libunitree_sdk2.a | grep gettid, the result is:

U gettid
U gettid
U gettid
U gettid
U gettid

so I assume the symbol is not defined. How can i fix this? If the error is on my side, I apologize.

Thank you!