构建失败错误:无法使用 qibuild 构建C++ SDK Helloworld

BuildFailed Error: Cannot build C++ SDK Helloworld with qibuild

本文关键字:构建 qibuild C++ SDK Helloworld 失败 错误      更新时间:2023-10-16

我正在尝试在Linux 18.04.1(VirtualBox(上安装NaoQI C++ SDK。我遵循了以下安装说明:http://doc.aldebaran.com/2-1/dev/cpp/install_guide.html

我的问题在 E. 第 3 部分,当我尝试运行"qibuild make"时

当我尝试构建helloworld示例时,我收到此错误:

CMakeFiles/testhelloworld.dir/testhelloworld.cpp.o:在函数中main': /home/nounou/Documents/SDKfolder/naoqi-sdk/doc/dev/cpp/examples/core/helloworld/testhelloworld.cpp:35: undefined reference to AL::ALBroker::createBroker(std::__cxx11::basic_string, std::allocator> const&, 标准::__cxx11::basic_string, std::allocator> const&, int, std::__cxx11::basic_string, std::allocator> const&, int, int, 标准::__cxx11::basic_string, std::分配器>, bool('/home/nounou/Documents/SDKfolder/naoqi-sdk/doc/dev/cpp/examples/core/helloworld/testhelloworld.cpp:38: 未定义的引用AL::ALProxy::ALProxy(boost::shared_ptr<AL::ALBroker>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int, int)' CMakeFiles/testhelloworld.dir/testhelloworld.cpp.o: In function qi::log::LogStream::~LogStream((':

....

CMakeFiles/testhelloworld.dir/build.make:113: recipe for target 'SDK/bin/testhelloworld' make 失败[2]:* [SDK/bin/testhelloworld] 错误 1 CMakeFiles/Makefile2:67:目标配方 'CMakeFiles/testhelloworld.dir/all' 失败的制作[1]: *[CMakeFiles/testhelloworld.dir/all]错误 2 制作文件:129: 配方 目标"全部"失败制作:*** [全部] 错误 2

[错误]:构建项目时发生构建失败错误 hello world

如果您对问题是什么有任何想法,请帮助我。谢谢!

我在 Fedora 29 上遇到了同样的问题......经过几个小时的搜索,我发现将 set(CMAKE_CXX_FLAGS"-D_GLIBCXX_USE_CXX11_ABI=0"( 添加到 CMakeLists.txt 文件中解决了这个问题。

我在这里找到了解决方案: 使用 C++11 标准的 GCC,即使明确指定了 98

由于过渡到 C++11,您很可能遇到了 ABI 不兼容问题。您使用的是 Ubuntu 18.04,编译器配置为与现代C++库链接,但工具链是使用以前的 ABI 编译的,并且不强制使用编译器标志以确保兼容性。

要解决此问题,请执行以下任一操作:

  • 设置编译器标志以确保您不会链接到 C++11 库(如果有人知道它们,请分享(。
  • 通过使用跨工具链而不是 Linux 工具链,为机器人而不是您的机器进行编译。
  • 使用 Ubuntu 12.04,如安装指南中所述。

顺便说一下,在C++安装指南的E.4小节中,它说要编译core/sayhelloworld下的示例。在这里,您在core/helloworld下编译了示例。