Linking Error When Compiling

Having trouble installing or compiling FreeCAD? Get help here.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
ezzieyguywuf
Posts: 656
Joined: Tue May 19, 2015 1:11 am

Linking Error When Compiling

Post by ezzieyguywuf »

I am trying to compile freecad and get the following error:
[ 2%] Linking CXX shared library ../../../lib/libDriver.so
/usr/bin/ld: cannot find -lTKFillet
/usr/bin/ld: cannot find -lTKMesh
/usr/bin/ld: cannot find -lTKernel
/usr/bin/ld: cannot find -lTKG2d
/usr/bin/ld: cannot find -lTKG3d
/usr/bin/ld: cannot find -lTKMath
/usr/bin/ld: cannot find -lTKIGES
/usr/bin/ld: cannot find -lTKSTL
/usr/bin/ld: cannot find -lTKShHealing
/usr/bin/ld: cannot find -lTKXSBase
/usr/bin/ld: cannot find -lTKBin
/usr/bin/ld: cannot find -lTKBool
/usr/bin/ld: cannot find -lTKBO
/usr/bin/ld: cannot find -lTKBRep
/usr/bin/ld: cannot find -lTKTopAlgo
/usr/bin/ld: cannot find -lTKGeomAlgo
/usr/bin/ld: cannot find -lTKGeomBase
/usr/bin/ld: cannot find -lTKOffset
/usr/bin/ld: cannot find -lTKPrim
/usr/bin/ld: cannot find -lTKSTEP
/usr/bin/ld: cannot find -lTKSTEPBase
/usr/bin/ld: cannot find -lTKSTEPAttr
/usr/bin/ld: cannot find -lTKHLR
/usr/bin/ld: cannot find -lTKFeat
/usr/bin/ld: cannot find -lTKCAF
/usr/bin/ld: cannot find -lTKXCAF
/usr/bin/ld: cannot find -lTKLCAF
/usr/bin/ld: cannot find -lTKXDESTEP
/usr/bin/ld: cannot find -lTKXDEIGES
/usr/bin/ld: cannot find -lTKMeshVS
I've been able to compile it before without any issues. I did have a few copies of opencascade floating around, and uninstalled the one I had in /usr/local. I've made sure using cmake-gui, though, that FreeCAD searches in /opt/opencascade for the include files and libraries. Any idea what I may be missing?
wmayer
Founder
Posts: 20308
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Linking Error When Compiling

Post by wmayer »

I guess that it linked exactly this version under /usr/local. Make sure that OCC_LIBRARY_DIR points to the new directory. However, sometimes it's really hard to fix the cmake cache files and then it's easier to delete your whole build directory and start cmake configure from scratch.
ezzieyguywuf
Posts: 656
Joined: Tue May 19, 2015 1:11 am

Re: Linking Error When Compiling

Post by ezzieyguywuf »

I tried the following:

1) Create new build directory
2) run cmake .. from new build directory
3) run cmake-gui .. and set the following variables:
- OCE_DIR = /opt/opencascade
- OCC_INCLUDE_DIR = /opt/opencascade, default was /usr/local somewhere
- OCC_LIBRARY = /opt/opencascade/lib, default was /opt/opencascade/lib/libSomething.so, can't remember which specific so file

Same issue. It seems like FreeCAd tries to re-find the OCE_DIR and it can't, b/c it resets it to Null.
User avatar
wandererfan
Veteran
Posts: 6317
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: Linking Error When Compiling

Post by wandererfan »

ezzieyguywuf wrote:Same issue. It seems like FreeCAd tries to re-find the OCE_DIR and it can't, b/c it resets it to Null.
For what it's worth, I often have to change OCE-DIR and run configure several times in Cmake-gui before the change sticks. Sometimes changing something unrelated like CMAKE_CXX_COMPILER will knock OCE-DIR back to a useless value.

Eventually the change sticks.

wf
ezzieyguywuf
Posts: 656
Joined: Tue May 19, 2015 1:11 am

Re: Linking Error When Compiling

Post by ezzieyguywuf »

The oce_dir thing confuses me. It asks for a for with a cmake file for oce. But I'm using occ. and then there are vars for occ_include_dir and occ_lib_dir but none for oce. I'm left scratching my head as to what's what.

Well, I promised my dear wife I'd take a break for a week, so I'll investigate this then.
User avatar
wandererfan
Veteran
Posts: 6317
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: Linking Error When Compiling

Post by wandererfan »

ezzieyguywuf wrote:It asks for a for with a cmake file for oce. But I'm using occ.
As far as Cmake is concerned, "OCC" and "OCE" are interchangeable.
ezzieyguywuf
Posts: 656
Joined: Tue May 19, 2015 1:11 am

Re: Linking Error When Compiling

Post by ezzieyguywuf »

I think there is some sort of error in the CMakeLists.txt file.

When I use cmake-gui to set the OCC_LIBRARY variable, if I set it to the directory that contains my libraries it ends up searching one directory higher. I saw this by running make VERBOSE=1. If I select one of the object files in the library directory, then it ends up searching the correct directory.
wmayer
Founder
Posts: 20308
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Linking Error When Compiling

Post by wmayer »

No, you must specify a file path and not a directory path.
ezzieyguywuf
Posts: 656
Joined: Tue May 19, 2015 1:11 am

Re: Linking Error When Compiling

Post by ezzieyguywuf »

But which file must be specified? There are tons of so files in the library directory. Why does the OCC_INCLUDE variable accept a directory rather than a file?
wmayer
Founder
Posts: 20308
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Linking Error When Compiling

Post by wmayer »

It should work with any file there.
Post Reply