Apollo代码提取移植错误提示总结

1. protobuf的安装及proto文件的编译

2. [undefined reference to testing::internal::xxx in gtest]

未安装gtest模块,可安装此模块或者屏蔽test测试代码
或者安装gtest后,在CmakLists.txt 中加入gtest链接

target_link_libraries(
 ${PROJECT_NAME}
 ...
 gtest
)

3. fLB::FLAGS_xxx’未定义的引用

find_package(gflags REQUIRED)
...
target_link_libraries(
 ${PROJECT_NAME}
 ...
 gflags
)

4. 对‘google::base::CheckOpMessageBuilder::NewString()’未定义的引用

5. 运行时崩溃,Segmentation fault of google::protobuf::Arena::OnArenaAllocation

应是由于protobuf版本混乱导致,可使用ldd查看是否依赖两个版本的protobuf库,
可参考https://github.com/protocolbuffers/protobuf/issues/4723

6. 对‘apollo::hdmap::LaneInfo::GetProjection(apollo::common::math::Vec2d const&, double, double) const’未定义的引用

  • 1) 应是其他模块对HDmap模块的调用产生的,产生了交叉引用,一般是由于编译test文件而导致的,可以将test文件从编译文件中剔除

  • 2) 出现未定义的引用时,还有可能是link时库的顺序影响,尽量保持库的顺序为底层库在前

7. 对‘qpOASES::QProblemB::getPrimalSolution(double*) const’未定义的引用

添加链接依赖项 qpOASES
首先下载并编译qpOASES,加入环境变量,然后添加链接依赖项

target_link_libraries(
 ${PROJECT_NAME}
 ...
 qpOASES
)

8. 对‘tinyxml2::XMLNode::NextSiblingElement(char const*) const’未定义的引用

target_link_libraries(
 ${PROJECT_NAME}
 ...
 tinyxml2
)

9. 对‘pj_free’未定义的引用

target_link_libraries(
 ${PROJECT_NAME}
 ...
 proj
)

10. warning: AVX vector return without AVX enabled changes the ABI [-Wpsabi]

error: inlining failed in call to always_inline ‘__m256 _mm256_setzero_ps()’: target specific option

insert this line to CMakeLists.txt

add_compile_options(-march=native)

11. fatal error: Eigen/Core: 没有那个文件或目录

find_package(Eigen3 REQUIRED)
...
include_directories(
  ${EIGEN3_INCLUDE_DIRS}
  ...
)
...
target_link_libraries(${PROJECT_NAME}
  ${EIGEN3_LIBRARIES}
  ...
)

12. error: ‘__s_getMD5Sum’ is not a member of ‘xxx::xxx::xxx’

添加头文件支持

#include "modules/xxx/proto/xxx.ros.h"

13. fatal error: ros/include/ros/ros.h: 没有那个文件或目录

修改
#include "ros/include/ros/ros.h"
为
#include "ros/ros.h"

14. 对‘xxx’未定义的引用

Reference lib
glfwGetWindowUserPointer glfw
YAML yaml-cpp
  • 对‘pcl::PCLBase<apollo::perception::pcl_util::PointXYZIH>::initCompute()’未定义的引用
perception_common

15. libgtest.a(gtest-all.cc.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC

/usr/local/lib/libgtest.a: 无法添加符号: 错误的值
参考:https://github.com/google/googletest/issues/854
重新编译安装googletest

cd <path>
git clone https://github.com/google/googletest.git
vim CMakeLists.txt  
// add set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
mkdir build
cd build
cmake ..
make -j12
sudo make install

99. 支持

1) glog gfalgs
参考
https://www.cnblogs.com/burningTheStar/p/6986048.html
2) curlpp

  1. leveldb

sudo apt install libleveldb-dev
4)protobuf-3.6.1

https://blog.csdn.net/datase/article/details/82347834
安装完成之后,记得头文件拷贝
sudo cp src/google/protobuf/stubs/*.h /usr/local/protobuf/include/google/protobuf/stubs/
5) qpOASES-3.2.1

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • Swift1> Swift和OC的区别1.1> Swift没有地址/指针的概念1.2> 泛型1.3> 类型严谨 对...
    cosWriter阅读 11,135评论 1 32
  • 来说下c/c++中的const的用法。在英语中常数的一种表达是“中的const的”,在编程中可能是借用了这个单词(...
    Jack_Cui阅读 3,785评论 0 3
  • 今日来谈一谈行动,书中的内容已经画在思维导图中,便不在叙述 01 我的困惑 有时日常生活当与朋友谈起“目标” “计...
    视觉笔记糕小糕阅读 457评论 0 11
  • 从宿舍楼到教学楼的路上,经过了A食堂。透过窗内,我看到了一个男生,在吃着饭。其实,食堂内有好多男生,正吃着饭的男生...
    嫣然婉清阅读 264评论 0 1
  • xy: 28年前,三毛走了,有人说,三毛是去了撒哈拉,去找荷西,去寻梦中的橄榄树...... 1991年1月4日,...
    沈园3阅读 1,930评论 12 55