Closed EgoFan closed 1 month ago
[ 2%] Linking CXX executable h1_low_level_example //usr/local/lib/libunitree_sdk2.a(os.cpp.o):在函数‘unitree::common::OsHelper::GetTid()’中: os.cpp:(.text+0x4d3):对‘gettid’未定义的引用 //usr/local/lib/libunitree_sdk2.a(lock.cpp.o):在函数‘unitree::common::AssertEqual(int, int, bool, char const, char const, int)’中: lock.cpp:(.text._ZN7unitree6common11AssertEqualEiibPKcS2_i[_ZN7unitree6common11AssertEqualEiibPKcS2_i]+0x84):对‘gettid’未定义的引用 lock.cpp:(.text._ZN7unitree6common11AssertEqualEiibPKcS2_i[_ZN7unitree6common11AssertEqualEiibPKcS2_i]+0x190):对‘gettid’未定义的引用 //usr/local/lib/libunitree_sdk2.a(lock.cpp.o):在函数‘unitree::common::AssertEqual(int, int, int, bool, char const, char const, int)’中: lock.cpp:(.text._ZN7unitree6common11AssertEqualEiiibPKcS2_i[_ZN7unitree6common11AssertEqualEiiibPKcS2_i]+0x9c):对‘gettid’未定义的引用 lock.cpp:(.text._ZN7unitree6common11AssertEqualEiiibPKcS2_i[_ZN7unitree6common11AssertEqualEiiibPKcS2_i]+0x1a3):对‘gettid’未定义的引用 //usr/local/lib/libunitree_sdk2.a(lock.cpp.o):lock.cpp:(.text._ZN7unitree6common13AssertEqualExEiiibPKcS2_i[_ZN7unitree6common13AssertEqualExEiiibPKcS2_i]+0xaf): 跟着更多未定义的参考到 gettid //usr/local/lib/libunitree_sdk2.a(recurrent_thread.cpp.o):在函数‘unitree::common::Exception::ToString[abi:cxx11]() const’中: recurrent_thread.cpp:(.text._ZNK7unitree6common9Exception8ToStringB5cxx11Ev[_ZNK7unitree6common9Exception8ToStringB5cxx11Ev]+0x38):对‘std::cxx11::basic_ostringstream<char, std::char_traits, std::allocator >::basic_ostringstream()’未定义的引用 //usr/local/lib/libunitree_sdk2.a(recurrent_thread.cpp.o):在函数‘unitree::common::AssertNotEqual(int, int, bool, char const, char const, int)’中: recurrent_thread.cpp:(.text._ZN7unitree6common14AssertNotEqualEiibPKcS2_i[_ZN7unitree6common14AssertNotEqualEiibPKcS2_i]+0x84):对‘gettid’未定义的引用 recurrent_thread.cpp:(.text._ZN7unitree6common14AssertNotEqualEiibPKcS2_i[_ZN7unitree6common14AssertNotEqualEiibPKcS2_i]+0x190):对‘gettid’未定义的引用 //usr/local/lib/libunitree_sdk2.a(dds_factory_model.cpp.o):在函数‘void unitree::common::Logger::Log<char const (&) [36], unsigned int&>(int, char const (&) [36], unsigned int&)’中: dds_factory_model.cpp:(.text._ZN7unitree6common6Logger3LogIJRA36KcRjEEEviDpOT[_ZN7unitree6common6Logger3LogIJRA36KcRjEEEviDpOT]+0x88):对‘std::cxx11::basic_ostringstream<char, std::char_traits, std::allocator >::basic_ostringstream()’未定义的引用 //usr/local/lib/libunitree_sdk2.a(dds_factory_model.cpp.o):在函数‘void unitree::common::Logger::Log<char const (&) [36]>(int, char const (&) [36])’中: dds_factory_model.cpp:(.text._ZN7unitree6common6Logger3LogIJRA36KcEEEviDpOT[_ZN7unitree6common6Logger3LogIJRA36KcEEEviDpOT]+0x81):对‘std::__cxx11::basic_ostringstream<char, std::char_traits, std::allocator >::basic_ostringstream()’未定义的引用 //usr/local/lib/libddscxx.so:对‘std::__cxx11::basic_stringstream<char, std::char_traits, std::allocator >::basic_stringstream()@GLIBCXX_3.4.26’未定义的引用 collect2: error: ld returned 1 exit status CMakeFiles/h1_low_level_example.dir/build.make:94: recipe for target 'h1_low_level_example' failed make[2]: [h1_low_level_example] Error 1 CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/h1_low_level_example.dir/all' failed make[1]: [CMakeFiles/h1_low_level_example.dir/all] Error 2 Makefile:83: recipe for target 'all' failed make: *** [all] Error 2
单独去编译unitree_sdk2项目,检查环境和依赖的完整性。
感谢回复,把系统换成20.04就不报错了
[ 2%] Linking CXX executable h1_low_level_example //usr/local/lib/libunitree_sdk2.a(os.cpp.o):在函数‘unitree::common::OsHelper::GetTid()’中: os.cpp:(.text+0x4d3):对‘gettid’未定义的引用 //usr/local/lib/libunitree_sdk2.a(lock.cpp.o):在函数‘unitree::common::AssertEqual(int, int, bool, char const, char const, int)’中: lock.cpp:(.text._ZN7unitree6common11AssertEqualEiibPKcS2_i[_ZN7unitree6common11AssertEqualEiibPKcS2_i]+0x84):对‘gettid’未定义的引用 lock.cpp:(.text._ZN7unitree6common11AssertEqualEiibPKcS2_i[_ZN7unitree6common11AssertEqualEiibPKcS2_i]+0x190):对‘gettid’未定义的引用 //usr/local/lib/libunitree_sdk2.a(lock.cpp.o):在函数‘unitree::common::AssertEqual(int, int, int, bool, char const, char const, int)’中: lock.cpp:(.text._ZN7unitree6common11AssertEqualEiiibPKcS2_i[_ZN7unitree6common11AssertEqualEiiibPKcS2_i]+0x9c):对‘gettid’未定义的引用 lock.cpp:(.text._ZN7unitree6common11AssertEqualEiiibPKcS2_i[_ZN7unitree6common11AssertEqualEiiibPKcS2_i]+0x1a3):对‘gettid’未定义的引用 //usr/local/lib/libunitree_sdk2.a(lock.cpp.o):lock.cpp:(.text._ZN7unitree6common13AssertEqualExEiiibPKcS2_i[_ZN7unitree6common13AssertEqualExEiiibPKcS2_i]+0xaf): 跟着更多未定义的参考到 gettid //usr/local/lib/libunitree_sdk2.a(recurrent_thread.cpp.o):在函数‘unitree::common::Exception::ToString[abi:cxx11]() const’中: recurrent_thread.cpp:(.text._ZNK7unitree6common9Exception8ToStringB5cxx11Ev[_ZNK7unitree6common9Exception8ToStringB5cxx11Ev]+0x38):对‘std::cxx11::basic_ostringstream<char, std::char_traits, std::allocator >::basic_ostringstream()’未定义的引用
//usr/local/lib/libunitree_sdk2.a(recurrent_thread.cpp.o):在函数‘unitree::common::AssertNotEqual(int, int, bool, char const, char const, int)’中:
recurrent_thread.cpp:(.text._ZN7unitree6common14AssertNotEqualEiibPKcS2_i[_ZN7unitree6common14AssertNotEqualEiibPKcS2_i]+0x84):对‘gettid’未定义的引用
recurrent_thread.cpp:(.text._ZN7unitree6common14AssertNotEqualEiibPKcS2_i[_ZN7unitree6common14AssertNotEqualEiibPKcS2_i]+0x190):对‘gettid’未定义的引用
//usr/local/lib/libunitree_sdk2.a(dds_factory_model.cpp.o):在函数‘void unitree::common::Logger::Log<char const (&) [36], unsigned int&>(int, char const (&) [36], unsigned int&)’中:
dds_factory_model.cpp:(.text._ZN7unitree6common6Logger3LogIJRA36KcRjEEEviDpOT[_ZN7unitree6common6Logger3LogIJRA36KcRjEEEviDpOT]+0x88):对‘std:: cxx11::basic_ostringstream<char, std::char_traits, std::allocator >::basic_ostringstream()’未定义的引用
//usr/local/lib/libunitree_sdk2.a(dds_factory_model.cpp.o):在函数‘void unitree::common::Logger::Log<char const (&) [36]>(int, char const (&) [36])’中:
dds_factory_model.cpp:(.text._ZN7unitree6common6Logger3LogIJRA36KcEEEviDpOT[_ZN7unitree6common6Logger3LogIJRA36KcEEEviDpOT]+0x81):对‘std::__cxx11::basic_ostringstream<char, std::char_traits, std::allocator >::basic_ostringstream()’未定义的引用
//usr/local/lib/libddscxx.so:对‘std::__cxx11::basic_stringstream<char, std::char_traits, std::allocator >::basic_stringstream()@GLIBCXX_3.4.26’未定义的引用
collect2: error: ld returned 1 exit status
CMakeFiles/h1_low_level_example.dir/build.make:94: recipe for target 'h1_low_level_example' failed
make[2]: [h1_low_level_example] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/h1_low_level_example.dir/all' failed
make[1]: [CMakeFiles/h1_low_level_example.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2