Skip to content

link error with undefined reference in ubuntu20.04 #1669

@wumin199

Description

@wumin199

Bug Report

I clone source code to my computer then conduct:

mkdir build && cd build
cmake ..
make  -j8

the output is always like this:

[ 98%] Building CXX object dart/gui/osg/CMakeFiles/dart-gui-osg.dir/render/ShapeNode.cpp.o
[ 98%] Building CXX object dart/gui/osg/CMakeFiles/dart-gui-osg.dir/render/SoftMeshShapeNode.cpp.o
[ 98%] Building CXX object dart/gui/osg/CMakeFiles/dart-gui-osg.dir/render/SphereShapeNode.cpp.o
[ 98%] Building CXX object dart/gui/osg/CMakeFiles/dart-gui-osg.dir/render/VoxelGridShapeNode.cpp.o
[100%] Building CXX object dart/gui/osg/CMakeFiles/dart-gui-osg.dir/render/WarningShapeNode.cpp.o
[100%] Linking CXX shared library ../../../lib/libdart-gui-osg.so
/usr/bin/ld: CMakeFiles/dart-gui-osg.dir/DefaultEventHandler.cpp.o: in function `osg::Drawable::EventCallback::cloneType() const':
DefaultEventHandler.cpp:(.text._ZNK3osg8Drawable13EventCallback9cloneTypeEv[_ZNK3osg8Drawable13EventCallback9cloneTypeEv]+0x37): undefined reference to `VTT for osg::Drawable::EventCallback'
/usr/bin/ld: DefaultEventHandler.cpp:(.text._ZNK3osg8Drawable13EventCallback9cloneTypeEv[_ZNK3osg8Drawable13EventCallback9cloneTypeEv]+0x62): undefined reference to `vtable for osg::Drawable::EventCallback'
/usr/bin/ld: CMakeFiles/dart-gui-osg.dir/DefaultEventHandler.cpp.o: in function `virtual thunk to osg::Drawable::EventCallback::cloneType() const':
DefaultEventHandler.cpp:(.text._ZNK3osg8Drawable13EventCallback9cloneTypeEv[_ZNK3osg8Drawable13EventCallback9cloneTypeEv]+0xf7): undefined reference to `VTT for osg::Drawable::EventCallback'
/usr/bin/ld: DefaultEventHandler.cpp:(.text._ZNK3osg8Drawable13EventCallback9cloneTypeEv[_ZNK3osg8Drawable13EventCallback9cloneTypeEv]+0x122): undefined reference to `vtable for osg::Drawable::EventCallback'
/usr/bin/ld: CMakeFiles/dart-gui-osg.dir/DefaultEventHandler.cpp.o: in function `virtual thunk to osg::Drawable::EventCallback::cloneType() const':
DefaultEventHandler.cpp:(.text._ZNK3osg8Drawable13EventCallback9cloneTypeEv[_ZNK3osg8Drawable13EventCallback9cloneTypeEv]+0x1b7): undefined reference to `VTT for osg::Drawable::EventCallback'
/usr/bin/ld: DefaultEventHandler.cpp:(.text._ZNK3osg8Drawable13EventCallback9cloneTypeEv[_ZNK3osg8Drawable13EventCallback9cloneTypeEv]+0x1e2): undefined reference to `vtable for osg::Drawable::EventCallback'
/usr/bin/ld: CMakeFiles/dart-gui-osg.dir/DefaultEventHandler.cpp.o: in function `osg::Drawable::EventCallback::isSameKindAs(osg::Object const*) const':
DefaultEventHandler.cpp:(.text._ZNK3osg8Drawable13EventCallback12isSameKindAsEPKNS_6ObjectE[_ZNK3osg8Drawable13EventCallback12isSameKindAsEPKNS_6ObjectE]+0x13): undefined reference to `typeinfo for osg::Drawable::EventCallback'
/usr/bin/ld: CMakeFiles/dart-gui-osg.dir/DefaultEventHandler.cpp.o: in function `virtual thunk to osg::Drawable::EventCallback::isSameKindAs(osg::Object const*) const':
DefaultEventHandler.cpp:(.text._ZNK3osg8Drawable13EventCallback12isSameKindAsEPKNS_6ObjectE[_ZNK3osg8Drawable13EventCallback12isSameKindAsEPKNS_6ObjectE]+0x53): undefined reference to `typeinfo for osg::Drawable::EventCallback'
/usr/bin/ld: CMakeFiles/dart-gui-osg.dir/DefaultEventHandler.cpp.o: in function `virtual thunk to osg::Drawable::EventCallback::isSameKindAs(osg::Object const*) const':
DefaultEventHandler.cpp:(.text._ZNK3osg8Drawable13EventCallback12isSameKindAsEPKNS_6ObjectE[_ZNK3osg8Drawable13EventCallback12isSameKindAsEPKNS_6ObjectE]+0x93): undefined reference to `typeinfo for osg::Drawable::EventCallback'
/usr/bin/ld: CMakeFiles/dart-gui-osg.dir/DefaultEventHandler.cpp.o: in function `osg::Drawable::EventCallback::clone(osg::CopyOp const&) const':

....

/usr/bin/ld: CMakeFiles/dart-gui-osg.dir/render/VoxelGridShapeNode.cpp.o: in function `dart::gui::osg::render::VoxelGridShapeNode::extractData(bool)':
VoxelGridShapeNode.cpp:(.text+0xbc0): undefined reference to `osg::Drawable::dirtyDisplayList()'
collect2: error: ld returned 1 exit status
make[2]: *** [dart/gui/osg/CMakeFiles/dart-gui-osg.dir/build.make:564: lib/libdart-gui-osg.so.6.13.0] Error 1
make[1]: *** [CMakeFiles/Makefile2:2993: dart/gui/osg/CMakeFiles/dart-gui-osg.dir/all] Error 2
make: *** [Makefile:141: all] Error 2

It seems that something wrong with libdart-gui-osg.so

And there is no libdart-gui-osg in my computer as locate libdart-gui-osg return nothing.

Environment

Select the following information.

  • DART version: master, 6.12.1
  • Ubuntu20.04
  • Compiler name and version number: gcc 9.4.0

Expected Behavior

Please describe the behavior you are expecting.
make successfuly

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugIndicates an unexpected problem or unintended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions