Thu, 06/23/2022 - 20:05
Hello,
I've built from github branch 7.6 and installed in a separate directory so I can examine the headers and libraries. I've got a toy app I'm playing with, as my task it to build a Python wrapper for a converter from BREP to Voxels. I'm using C++ and CMake on Ubuntu 18.04 so no prebuilt packages for me, hence why I manually built it.
I'm finding and linking against TKSTEP, TKXSBase and TKernel. However after compilation, linking fails with:
CMakeFiles/converter.dir/src/main.cpp.o: In function `opencascade::handle<NCollection_BaseAllocator>::EndScope()':
main.cpp:(.text._ZN11opencascade6handleI25NCollection_BaseAllocatorE8EndScopeEv[_ZN11opencascade6handleI25NCollection_BaseAllocatorE8EndScopeEv]+0x23): undefined reference to `Standard_Transient::DecrementRefCounter() const'
CMakeFiles/converter.dir/src/main.cpp.o: In function `opencascade::handle<TopLoc_SListNodeOfItemLocation>::EndScope()':
main.cpp:(.text._ZN11opencascade6handleI30TopLoc_SListNodeOfItemLocationE8EndScopeEv[_ZN11opencascade6handleI30TopLoc_SListNodeOfItemLocationE8EndScopeEv]+0x23): undefined reference to `Standard_Transient::DecrementRefCounter() const'
CMakeFiles/converter.dir/src/main.cpp.o: In function `opencascade::handle<TopoDS_TShape>::EndScope()':
main.cpp:(.text._ZN11opencascade6handleI13TopoDS_TShapeE8EndScopeEv[_ZN11opencascade6handleI13TopoDS_TShapeE8EndScopeEv]+0x23): undefined reference to `Standard_Transient::DecrementRefCounter() const'
CMakeFiles/converter.dir/src/main.cpp.o: In function `NCollection_Sequence<opencascade::handle<Standard_Transient> >::Clear(opencascade::handle<NCollection_BaseAllocator> const&)':
main.cpp:(.text._ZN20NCollection_SequenceIN11opencascade6handleI18Standard_TransientEEE5ClearERKNS1_I25NCollection_BaseAllocatorEE[_ZN20NCollection_SequenceIN11opencascade6handleI18Standard_TransientEEE5ClearERKNS1_I25NCollection_BaseAllocatorEE]+0x1f): undefined reference to `NCollection_BaseSequence::ClearSeq(void (*)(NCollection_SeqNode*, opencascade::handle<NCollection_BaseAllocator>&))'
CMakeFiles/converter.dir/src/main.cpp.o: In function `opencascade::handle<XSControl_WorkSession>::EndScope()':
main.cpp:(.text._ZN11opencascade6handleI21XSControl_WorkSessionE8EndScopeEv[_ZN11opencascade6handleI21XSControl_WorkSessionE8EndScopeEv]+0x23): undefined reference to `Standard_Transient::DecrementRefCounter() const'
CMakeFiles/converter.dir/src/main.cpp.o: In function `NCollection_Sequence<TopoDS_Shape>::Clear(opencascade::handle<NCollection_BaseAllocator> const&)':
main.cpp:(.text._ZN20NCollection_SequenceI12TopoDS_ShapeE5ClearERKN11opencascade6handleI25NCollection_BaseAllocatorEE[_ZN20NCollection_SequenceI12TopoDS_ShapeE5ClearERKN11opencascade6handleI25NCollection_BaseAllocatorEE]+0x1f): undefined reference to `NCollection_BaseSequence::ClearSeq(void (*)(NCollection_SeqNode*, opencascade::handle<NCollection_BaseAllocator>&))'
CMakeFiles/converter.dir/src/main.cpp.o: In function `opencascade::handle<NCollection_BaseAllocator>::BeginScope()':
main.cpp:(.text._ZN11opencascade6handleI25NCollection_BaseAllocatorE10BeginScopeEv[_ZN11opencascade6handleI25NCollection_BaseAllocatorE10BeginScopeEv]+0x23): undefined reference to `Standard_Transient::IncrementRefCounter() const'
CMakeFiles/converter.dir/src/main.cpp.o: In function `opencascade::handle<Standard_Transient>::EndScope()':
main.cpp:(.text._ZN11opencascade6handleI18Standard_TransientE8EndScopeEv[_ZN11opencascade6handleI18Standard_TransientE8EndScopeEv]+0x23): undefined reference to `Standard_Transient::DecrementRefCounter() const'
collect2: error: ld returned 1 exit status
CMakeFiles/converter.dir/build.make:94: recipe for target 'converter' failed
make[2]: *** [converter] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/converter.dir/all' failed
make[1]: *** [CMakeFiles/converter.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
I've looked, iterated, searched, googled, used readelf -s
and probed to see where those are exported, and I can't understand why there's undefined references. Is this a linking library order or am I missing a library I should be linking against, or one I should have, but didn't build?
Sun, 02/12/2023 - 21:37
Any solution to that?
Have a similar problem: