Skip to content

Unit test binary fails to link with missing bullet symbols #272

@apteryks

Description

@apteryks

Hi,

I have built Ogre with bullet support, and MyGUI builds fine unless I enable the unit tests with: -DMYGUI_BUILD_UNITTESTS=TRUE. When I do, the build fails with link errors:

[ 70%] Linking CXX executable ../../bin/UnitTest_AttachDetach
cd /tmp/guix-build-mygui-3.4.3.drv-0/build/UnitTests/UnitTest_AttachDetach && /gnu/store/jjxafj2r8np0ay9q6y554xj7b32dxn98-cmake-minimal-3.24.2/bin/cmake -E cmake_link_script CMakeFiles/UnitTest_AttachDetach.dir/link.txt --verbose=1
/gnu/store/86fc8bi3mciljxz7c79jx8zr4wsx7xw8-gcc-11.4.0/bin/c++ -O2 -g -DNDEBUG CMakeFiles/UnitTest_AttachDetach.dir/DemoKeeper.cpp.o -o ../../bin/UnitTest_AttachDetach  -Wl,-rpath,/tmp/guix-build-mygui-3.4.3.drv-0/build/lib:/gnu/store/v6papmny5q52dn4w6rh6g3aiwiw91g6q-bullet-3.25/lib ../../lib/libMyGUICommon.a /gnu/store/y9b30vxc27wymy861la2j0bj6i7wd8gf-sdl2-2.30.1/lib/libSDL2.so ../../lib/libMyGUI.OgrePlatform.a ../../lib/libMyGUIEngine.so.3.4.3 -ldl /gnu/store/7ah6i5829f5ha6bdfzcj1gf21115xyyd-freetype-2.13.0/lib/libfreetype.so /gnu/store/1prv14v6jfnzzg7szm57690b7fr6sx33-zlib-1.3/lib/libz.so /gnu/store/ai8h4fwkx6cr7lxq77pwah6x8cpqzji2-ogre-14.3.1/lib/libOgreBites.so.14.3 /gnu/store/ai8h4fwkx6cr7lxq77pwah6x8cpqzji2-ogre-14.3.1/lib/libOgreBullet.so /gnu/store/v6papmny5q52dn4w6rh6g3aiwiw91g6q-bullet-3.25/lib/libBulletDynamics.so /gnu/store/v6papmny5q52dn4w6rh6g3aiwiw91g6q-bullet-3.25/lib/libBulletCollision.so /gnu/store/v6papmny5q52dn4w6rh6g3aiwiw91g6q-bullet-3.25/lib/libLinearMath.so /gnu/store/v6papmny5q52dn4w6rh6g3aiwiw91g6q-bullet-3.25/lib/libBulletSoftBody.so /gnu/store/ai8h4fwkx6cr7lxq77pwah6x8cpqzji2-ogre-14.3.1/lib/libOgreMeshLodGenerator.so.14.3 /gnu/store/ai8h4fwkx6cr7lxq77pwah6x8cpqzji2-ogre-14.3.1/lib/libOgreOverlay.so.14.3 /gnu/store/ai8h4fwkx6cr7lxq77pwah6x8cpqzji2-ogre-14.3.1/lib/libOgreProperty.so.14.3 /gnu/store/ai8h4fwkx6cr7lxq77pwah6x8cpqzji2-ogre-14.3.1/lib/libOgreTerrain.so.14.3 /gnu/store/ai8h4fwkx6cr7lxq77pwah6x8cpqzji2-ogre-14.3.1/lib/libOgrePaging.so.14.3 /gnu/store/ai8h4fwkx6cr7lxq77pwah6x8cpqzji2-ogre-14.3.1/lib/libOgreRTShaderSystem.so.14.3 /gnu/store/ai8h4fwkx6cr7lxq77pwah6x8cpqzji2-ogre-14.3.1/lib/libOgreVolume.so.14.3 /gnu/store/ai8h4fwkx6cr7lxq77pwah6x8cpqzji2-ogre-14.3.1/lib/libOgreMain.so.14.3 -lpthread /gnu/store/y9b30vxc27wymy861la2j0bj6i7wd8gf-sdl2-2.30.1/lib/libSDL2.so 
ld: /gnu/store/ai8h4fwkx6cr7lxq77pwah6x8cpqzji2-ogre-14.3.1/lib/libOgreBullet.so: undefined reference to `btConvexHullShape::btConvexHullShape(float const*, int, int)'
ld: /gnu/store/ai8h4fwkx6cr7lxq77pwah6x8cpqzji2-ogre-14.3.1/lib/libOgreBullet.so: undefined reference to `btCapsuleShape::btCapsuleShape(float, float)'
ld: /gnu/store/ai8h4fwkx6cr7lxq77pwah6x8cpqzji2-ogre-14.3.1/lib/libOgreBullet.so: undefined reference to `btRigidBody::btRigidBody(float, btMotionState*, btCollisionShape*, btVector3 const&)'
ld: /gnu/store/ai8h4fwkx6cr7lxq77pwah6x8cpqzji2-ogre-14.3.1/lib/libOgreBullet.so: undefined reference to `btCapsuleShapeZ::btCapsuleShapeZ(float, float)'
ld: /gnu/store/ai8h4fwkx6cr7lxq77pwah6x8cpqzji2-ogre-14.3.1/lib/libOgreBullet.so: undefined reference to `btCapsuleShapeX::btCapsuleShapeX(float, float)'
collect2: error: ld returned 1 exit status
make[2]: *** [UnitTests/UnitTest_AttachDetach/CMakeFiles/UnitTest_AttachDetach.dir/build.make:121: bin/UnitTest_AttachDetach] Error 1
make[2]: Leaving directory '/tmp/guix-build-mygui-3.4.3.drv-0/build'
make[1]: *** [CMakeFiles/Makefile2:577: UnitTests/UnitTest_AttachDetach/CMakeFiles/UnitTest_AttachDetach.dir/all] Error 2
make[1]: Leaving directory '/tmp/guix-build-mygui-3.4.3.drv-0/build'
make: *** [Makefile:139: all] Error 2
error: in phase 'build': uncaught exception:
%exception #<&invoke-error program: "make" arguments: ("-j" "1") exit-status: 2 term-signal: #f stop-signal: #f> 
phase `build' failed after 72.3 seconds
command "make" "-j" "1" failed with status 2
build process 18 exited with status 256
builder for `/gnu/store/8vcam46drywwgp8jxzplyyjhnljc9drc-mygui-3.4.3.drv' failed with exit code 1

I'm guessing the issue may be a link order problem that is more likely to happen when dealing with static libraries, as explained here: https://stackoverflow.com/a/409402/2896799, but I haven't investigated yet.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions