cocos2d / cocos2d-x

Cocos2d-x is a suite of open-source, cross-platform, game-development tools utilized by millions of developers across the globe. Its core has evolved to serve as the foundation for Cocos Creator 1.x & 2.x.
https://www.cocos.com/en/cocos2d-x
18.24k stars 7.06k forks source link

Could not run cpp-test, #20748

Open kimspirit opened 2 years ago

kimspirit commented 2 years ago

Steps to Reproduce:

  1. when i running the cpp-test those errors have came out. I have linked fmod to fmod.so.6. still thoese error have came out
  2. ====================[ Build | cpp-tests | Debug ]=============================== /myData/Softwares/JetBrains/apps/CLion/ch-0/222.4167.35/bin/cmake/linux/bin/cmake --build /myData/Projects/C++/cocos2d-x-4.0/cmake-build-debug --target cpp-tests -j 6 [1/3] cd /myData/Projects/C++/cocos2d-x-4.0/cmake-build-debug/engine/tests/cpp-tests && /myData/Softwares/JetBrains/apps/CLion/ch-0/222.4167.35/bin/cmake/linux/bin/cmake -E echo Copying\ resources\ for\ cpp-tests\ ... Copying resources for cpp-tests ... [2/3] Running utility command for SYNC_RESOURCE-cpp-tests copying to /myData/Projects/C++/cocos2d-x-4.0/cmake-build-debug/bin/cpp-tests/Resources [3/3] Linking CXX executable bin/cpp-tests/cpp-tests FAILED: bin/cpp-tests/cpp-tests : && /usr/bin/c++ -g engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/proj.linux/main.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/ActionManagerTest/ActionManagerTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/ActionsEaseTest/ActionsEaseTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/ActionsProgressTest/ActionsProgressTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/ActionsTest/ActionsTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/AppDelegate.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/BaseTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/BillBoardTest/BillBoardTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/BugsTest/Bug-CCDrawNode.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/BugsTest/Bug-1159.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/BugsTest/Bug-1174.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/BugsTest/Bug-350.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/BugsTest/Bug-422.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/BugsTest/Bug-458/Bug-458.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/BugsTest/Bug-458/QuestionContainerSprite.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/BugsTest/Bug-624.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/BugsTest/Bug-886.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/BugsTest/Bug-899.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/BugsTest/Bug-914.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/BugsTest/Bug-12847.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/BugsTest/Bug-15594.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/BugsTest/Bug-15776.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/BugsTest/Bug-Child.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/BugsTest/BugsTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/Camera3DTest/Camera3DTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/ClickAndMoveTest/ClickAndMoveTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/ClippingNodeTest/ClippingNodeTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/ConfigurationTest/ConfigurationTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/ConsoleTest/ConsoleTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/CurlTest/CurlTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/CurrentLanguageTest/CurrentLanguageTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/DataVisitorTest/DataVisitorTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/DownloaderTest/DownloaderTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/DrawPrimitivesTest/DrawPrimitivesTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/EffectsAdvancedTest/EffectsAdvancedTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/EffectsTest/EffectsTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/ExtensionsTest/AssetsManagerExTest/AssetsManagerExTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/ExtensionsTest/ExtensionsTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/ExtensionsTest/NetworkTest/HttpClientTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/ExtensionsTest/NetworkTest/SocketIOTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/ExtensionsTest/NetworkTest/WebSocketTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/ExtensionsTest/NetworkTest/WebSocketDelayTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/ExtensionsTest/TableViewTest/CustomTableViewCell.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/ExtensionsTest/TableViewTest/TableViewTestScene.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/FileUtilsTest/FileUtilsTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/FontTest/FontTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/InputTest/MouseTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/IntervalTest/IntervalTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/LabelTest/LabelTestNew.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/LayerTest/LayerTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/LightTest/LightTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/MaterialSystemTest/MaterialSystemTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/MenuTest/MenuTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/MotionStreakTest/MotionStreakTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/MultiTouchTest/MultiTouchTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/NewAudioEngineTest/NewAudioEngineTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/NewEventDispatcherTest/NewEventDispatcherTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/NewRendererTest/NewRendererTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/NodeTest/NodeTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/OpenURLTest/OpenURLTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/ParallaxTest/ParallaxTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/Particle3DTest/Particle3DTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/ParticleTest/ParticleTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/ReleasePoolTest/ReleasePoolTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/RenderTextureTest/RenderTextureTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/RotateWorldTest/RotateWorldTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/SceneTest/SceneTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/SchedulerTest/SchedulerTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/ShaderTest/ShaderTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/ShaderTest/ShaderTest2.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/Sprite3DTest/DrawNode3D.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/Sprite3DTest/Sprite3DTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/SpritePolygonTest/SpritePolygonTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/SpriteTest/SpriteTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/TerrainTest/TerrainTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/TextInputTest/TextInputTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/Texture2dTest/Texture2dTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/TextureCacheTest/TextureCacheTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/TexturePackerEncryptionTest/TextureAtlasEncryptionTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/TileMapTest/TileMapTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/TileMapTest/TileMapTest2.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/TouchesTest/Ball.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/TouchesTest/Paddle.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/TouchesTest/TouchesTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/TransitionsTest/TransitionsTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/UITest/CocoStudioGUITest/CocosGUIScene.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/UITest/CocoStudioGUITest/UIButtonTest/UIButtonTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/UITest/CocoStudioGUITest/UICheckBoxTest/UICheckBoxTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/UITest/CocoStudioGUITest/UIRadioButtonTest/UIRadioButtonTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/UITest/CocoStudioGUITest/UIFocusTest/UIFocusTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/UITest/CocoStudioGUITest/UIImageViewTest/UIImageViewTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/UITest/CocoStudioGUITest/UILayoutTest/UILayoutTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/UITest/CocoStudioGUITest/UIListViewTest/UIListViewTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/UITest/CocoStudioGUITest/UILoadingBarTest/UILoadingBarTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/UITest/CocoStudioGUITest/UIPageViewTest/UIPageViewTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/UITest/CocoStudioGUITest/UIRichTextTest/UIRichTextTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/UITest/CocoStudioGUITest/UIScale9SpriteTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/UITest/CocoStudioGUITest/UIScene.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/UITest/CocoStudioGUITest/UISceneManager.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/UITest/CocoStudioGUITest/UIScrollViewTest/UIScrollViewTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/UITest/CocoStudioGUITest/UISliderTest/UISliderTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/UITest/CocoStudioGUITest/UITextAtlasTest/UITextAtlasTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/UITest/CocoStudioGUITest/UITextBMFontTest/UITextBMFontTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/UITest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/UITest/CocoStudioGUITest/UITextTest/UITextTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/UITest/CocoStudioGUITest/UIWidgetAddNodeTest/UIWidgetAddNodeTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/UITest/CocoStudioGUITest/UITabControlTest/UITabControlTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/UITest/UITest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/UnitTest/UnitTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/UserDefaultTest/UserDefaultTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/VisibleRect.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/VibrateTest/VibrateTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/ZwoptexTest/ZwoptexTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/SpriteFrameCacheTest/SpriteFrameCacheTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/controller.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/ZipTest/ZipTests.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/WindowTest/WindowTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/BugsTest/Bug-14327.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/Physics3DTest/Physics3DTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/NavMeshTest/NavMeshTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/PhysicsTest/PhysicsTest.cpp.o engine/tests/cpp-tests/CMakeFiles/cpp-tests.dir/Classes/ChipmunkTest/ChipmunkTest.cpp.o -o bin/cpp-tests/cpp-tests -Wl,-rpath,/myData/Projects/C++/cocos2d-x-4.0/external/linux-specific/fmod/prebuilt/64-bit lib/libcocos2d.a lib/libexternal.a ../external/Box2D/prebuilt/linux/64-bit/libbox2d.a ../external/chipmunk/prebuilt/linux/64-bit/libchipmunk.a ../external/freetype2/prebuilt/linux/64-bit/libfreetype.a lib/libext_recast.a ../external/bullet/prebuilt/linux/64-bit/libLinearMath.a ../external/bullet/prebuilt/linux/64-bit/libBulletDynamics.a ../external/bullet/prebuilt/linux/64-bit/libBulletCollision.a ../external/bullet/prebuilt/linux/64-bit/libLinearMath.a ../external/bullet/prebuilt/linux/64-bit/libBulletMultiThreaded.a ../external/bullet/prebuilt/linux/64-bit/libMiniCL.a ../external/jpeg/prebuilt/linux/64-bit/libjpeg.a ../external/webp/prebuilt/linux/64-bit/libwebp.a ../external/websockets/prebuilt/linux/64-bit/libwebsockets.a ../external/openssl/prebuilt/linux/64-bit/libssl.a ../external/openssl/prebuilt/linux/64-bit/libcrypto.a ../external/uv/prebuilt/linux/64-bit/libuv_a.a lib/libext_tinyxml2.a lib/libext_xxhash.a lib/libext_xxtea.a lib/libext_clipper.a lib/libext_edtaa3func.a lib/libext_convertUTF.a lib/libext_poly2tri.a lib/libext_md5.a ../external/linux-specific/fmod/prebuilt/64-bit/libfmod.so ../external/glfw3/prebuilt/linux/libglfw3.a lib/libext_unzip.a -ldl -lX11 -lXi -lXrandr -lXxf86vm -lXinerama -lXcursor -lrt -lm -lfontconfig -lfreetype -lgtk-3 -lgdk-3 -lz -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 /usr/lib64/libz.so /usr/lib64/libpng.so /usr/lib64/libz.so /usr/lib64/libpng.so /usr/lib64/libGLEW.so /usr/lib64/libGL.so /usr/lib64/libGLU.so /usr/lib64/libcurl.so /usr/lib64/libsqlite3.so && : /usr/bin/ld: ../external/linux-specific/fmod/prebuilt/64-bit/libfmod.so: .dynsym local symbol at index 2 (>= sh_info of 2) /usr/bin/ld: ../external/linux-specific/fmod/prebuilt/64-bit/libfmod.so: .dynsym local symbol at index 3 (>= sh_info of 2) /usr/bin/ld: ../external/linux-specific/fmod/prebuilt/64-bit/libfmod.so: .dynsym local symbol at index 4 (>= sh_info of 2) /usr/bin/ld: cannot find -lXxf86vm collect2: error: ld returned 1 exit status ninja: build stopped: subcommand failed.
luxingzhi27 commented 1 year ago

I encountered the same problem as you, I added 'set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=gold")' in cmakelists, and then related to 'cannot find -lXxf86vm', my system is Ubuntu22 .04, I executed 'sudo apt install libxxf86vm-dev' in terminal and it solved the problem