ubuntu编译sumo报错

ubuntu编译sumo报错,有人能帮忙解决吗


[ 94%] Built target libsumojni
[ 95%] Built target libtracijni
[ 95%] Built target libsumo
[ 95%] Built target libtraci
[ 95%] Built target TraCITestClient
[ 95%] Built target generate-templates-h
[ 95%] Linking CXX executable ../../../../../../bin/testcommon
Scanning dependencies of target testgeom
[ 95%] Building CXX object unittest/src/utils/geom/CMakeFiles/testgeom.dir/BoundaryTest.cpp.o
/usr/bin/ld: CMakeFiles/testcommon.dir/StringTokenizerTest.cpp.o:(.data.rel.ro._ZTI46StringTokenizer_test_split_with_whitechar_Test[_ZTI46StringTokenizer_test_split_with_whitechar_Test]+0x10): undefined reference to `typeinfo for testing::Test'
/usr/bin/ld: CMakeFiles/testcommon.dir/StringTokenizerTest.cpp.o:(.data.rel.ro._ZTI44StringTokenizer_test_split_with_newline_Test[_ZTI44StringTokenizer_test_split_with_newline_Test]+0x10): undefined reference to `typeinfo for testing::Test'
/usr/bin/ld: CMakeFiles/testcommon.dir/StringTokenizerTest.cpp.o:(.data.rel.ro._ZTI38StringTokenizer_test_split_with_x_Test[_ZTI38StringTokenizer_test_split_with_x_Test]+0x10): undefined reference to `typeinfo for testing::Test'
/usr/bin/ld: CMakeFiles/testcommon.dir/StringTokenizerTest.cpp.o:(.data.rel.ro._ZTI40StringTokenizer_test_split_any_char_Test[_ZTI40StringTokenizer_test_split_any_char_Test]+0x10): undefined reference to `typeinfo for testing::Test'
/usr/bin/ld: CMakeFiles/testcommon.dir/StringTokenizerTest.cpp.o:(.data.rel.ro._ZTI39StringTokenizer_test_method_reinit_Test[_ZTI39StringTokenizer_test_method_reinit_Test]+0x10): undefined reference to `typeinfo for testing::Test'
/usr/bin/ld: CMakeFiles/testcommon.dir/StringTokenizerTest.cpp.o:(.data.rel.ro._ZTI37StringTokenizer_test_method_size_Test[_ZTI37StringTokenizer_test_method_size_Test]+0x10): more undefined references to `typeinfo for testing::Test' follow
collect2: error: ld returned 1 exit status
make[2]: *** [unittest/src/utils/common/CMakeFiles/testcommon.dir/build.make:162:../../bin/testcommon] 错误 1
make[1]: *** [CMakeFiles/Makefile2:5783:unittest/src/utils/common/CMakeFiles/testcommon.dir/all] 错误 2
make[1]: *** 正在等待未完成的任务....
[ 95%] Building CXX object unittest/src/utils/geom/CMakeFiles/testgeom.dir/GeoConvHelperTest.cpp.o
[ 95%] Building CXX object unittest/src/utils/geom/CMakeFiles/testgeom.dir/PositionVectorTest.cpp.o
[ 95%] Building CXX object unittest/src/utils/geom/CMakeFiles/testgeom.dir/GeomHelperTest.cpp.o
[ 96%] Linking CXX executable ../../../../../../bin/testgeom
/usr/bin/ld: CMakeFiles/testgeom.dir/BoundaryTest.cpp.o:(.data.rel.ro._ZTI29Boundary_test_method_add_Test[_ZTI29Boundary_test_method_add_Test]+0x10): undefined reference to `typeinfo for testing::Test'
/usr/bin/ld: CMakeFiles/testgeom.dir/BoundaryTest.cpp.o:(.data.rel.ro._ZTI38Boundary_test_method_add_multiple_Test[_ZTI38Boundary_test_method_add_multiple_Test]+0x10): undefined reference to `typeinfo for testing::Test'
/usr/bin/ld: CMakeFiles/testgeom.dir/BoundaryTest.cpp.o:(.data.rel.ro._ZTI35Boundary_test_method_getCenter_Test[_ZTI35Boundary_test_method_getCenter_Test]+0x10): undefined reference to `typeinfo for testing::Test'
/usr/bin/ld: CMakeFiles/testgeom.dir/BoundaryTest.cpp.o:(.data.rel.ro._ZTI40Boundary_test_method_getWidthHeight_Test[_ZTI40Boundary_test_method_getWidthHeight_Test]+0x10): undefined reference to `typeinfo for testing::Test'
/usr/bin/ld: CMakeFiles/testgeom.dir/BoundaryTest.cpp.o:(.data.rel.ro._ZTI32Boundary_test_method_around_Test[_ZTI32Boundary_test_method_around_Test]+0x10): undefined reference to `typeinfo for testing::Test'
/usr/bin/ld: CMakeFiles/testgeom.dir/BoundaryTest.cpp.o:(.data.rel.ro._ZTI38Boundary_test_method_overlapsWith_Test[_ZTI38Boundary_test_method_overlapsWith_Test]+0x10): more undefined references to `typeinfo for testing::Test' follow
collect2: error: ld returned 1 exit status
make[2]: *** [unittest/src/utils/geom/CMakeFiles/testgeom.dir/build.make:146:../../bin/testgeom] 错误 1
make[1]: *** [CMakeFiles/Makefile2:5822:unittest/src/utils/geom/CMakeFiles/testgeom.dir/all] 错误 2
make: *** [Makefile:141:all] 错误 2

提供相应的编译脚本或相关编译过程命令!

这个错误可能是由于缺少 Google Test 库导致的。请尝试安装 Google Test 库并重新编译:

安装 Google Test 库:

sudo apt-get install libgtest-dev

编译 Google Test 库:

cd /usr/src/gtest
sudo cmake CMakeLists.txt
sudo make

将编译好的库文件复制到系统库目录下:

sudo cp *.a /usr/lib

重新编译 sumo:

make clean
make -j4

如果问题仍然存在,请尝试检查您的编译环境是否正确设置,并确保您已经安装了所有必要的依赖项。

不知道你这个问题是否已经解决, 如果还没有解决的话:
  • 看下这篇博客,也许你就懂了,链接:Ubuntu使用

如果你已经解决了该问题, 非常希望你能够分享一下解决方案, 写成博客, 将相关链接放在评论区, 以帮助更多的人 ^-^