weird error: FreeCAD does not find some shared object files/directories

Having trouble installing or compiling FreeCAD? Get help here.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
user1234
Veteran
Posts: 3506
Joined: Mon Jul 11, 2016 5:08 pm

weird error: FreeCAD does not find some shared object files/directories

Post by user1234 »

Hello!

FreeCAD does not some shared object files/directories. The most are found but 2 are not found.

Code: Select all

Err: libTKV3d.so.7: cannot open shared object file: No such file or directory
Err: libTKCAF.so.7: cannot open shared object file: No such file or directory
But they are existing. They are needed for FEM and TechDraw. Also all others SO (alsoall in the same directory) are found and 3D modeling in FreeCAD works flawless.

I tried:

- make a clean build
- wipe FreeCAD completely and make a new build
- cleaned of course all cache (ccache)
- build and installed OCCT completely new (in combination with all former steps)
- go some weeks in the commits back (in combination with all former steps)

Now i am running out of ideas. Have someone a hint for me?

Code: Select all

OS: Debian GNU/Linux 11 (bullseye) (X-Cinnamon/lightdm-xsession)
Word size of FreeCAD: 64-bit
Version: 0.21.30437 (Git)
Build type: Release
Branch: master
Hash: 6013781b234f725ac3dfacf8897dddc887acbcff
Python 3.9.2, Qt 5.15.2, Coin 4.0.0, Vtk 9.0.1, OCC 7.6.3
Locale: English/United States (en_US)
Thanks in advance!

Greetings
user1234
user1234
Veteran
Posts: 3506
Joined: Mon Jul 11, 2016 5:08 pm

Re: weird error: FreeCAD does not find some shared object files/directories

Post by user1234 »

Small update and notes:

- also tried C++17
- there was an update some days ago, with an update from linux-compiler-gcc-10-x86, but as i wrote, i build OCCT and FreeCAD from scratch. But when i see in the changelog, there were some fixes about paths [amd64]. Could it be, there is a regression in the compiler?

Greetings
user1234
User avatar
waebbl
Posts: 200
Joined: Thu Aug 16, 2018 3:12 pm

Re: weird error: FreeCAD does not find some shared object files/directories

Post by waebbl »

Have you checked the file types of the both files and ran lddtree on the FreeCAD libraries which link against these libs? IMO the libraries should be symlinks, so check the file types of the link targets as well. Also the linker settings (-Wl,) flags could give some insight.
The FreeCAD binary itself isn't linked against any OCCT libraries on my system, so we need to find out which FreeCAD related library causes the issue. You give very little input about when the error pops up. Were you using a specific workbench?
Are you using external smesh? If so, have you tried rebuilding smesh as well? It's the only possible external library I can see from running lddtree on the FreeCAD libraries while grepping the output for the two libs.
Hope this gives you some ideas where to look further.
wmayer
Founder
Posts: 20309
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: weird error: FreeCAD does not find some shared object files/directories

Post by wmayer »

Have someone a hint for me?
In which directory are the OCCT libs located?
vm4dim
Posts: 130
Joined: Tue Nov 23, 2021 1:05 am

Re: weird error: FreeCAD does not find some shared object files/directories

Post by vm4dim »

I would compare the search result:
      find /usr -iname '*TKV3d*'
      find /usr -iname '*TKCAF*'

and search result other TK*
      find /usr -iname '*TKernel*'
      find /usr -iname '*TKMath*'
User avatar
mfro
Posts: 666
Joined: Sat Sep 23, 2017 8:15 am

Re: weird error: FreeCAD does not find some shared object files/directories

Post by mfro »

Are they existing in a path that's known to ld.so (/etc/ld.so.conf / /etc/ld.so.conf.d)?

OCC by default installs to /usr/local (which isn't normally known to ld.so, at least on my system).
Cheers,
Markus
user1234
Veteran
Posts: 3506
Joined: Mon Jul 11, 2016 5:08 pm

Re: weird error: FreeCAD does not find some shared object files/directories

Post by user1234 »

Thanks for all the answers!

waebbl wrote: Sat Sep 24, 2022 8:32 am You give very little input about when the error pops up. Were you using a specific workbench?
True. This occur when i start FreeCAD and load the Workbenches via autoload (start preferences), load it per hand in the preferences or change the workbenches. So the problem seems to be TechDraw.so and Fem.so (i load all WB at start, so this 2 are the only problematic SO).


waebbl wrote: Sat Sep 24, 2022 8:32 am Have you checked the file types of the both files and ran lddtree on the FreeCAD libraries which link against these libs? IMO the libraries should be symlinks, so check the file types of the link targets as well.
lddtree does not work for me, only ldd. This is not really useful since it does not work on runtime since the WB loads afterwards. The files are sysmlinks and get in the end to the correct SO.

When do

Code: Select all

ldd TechDraw.so
i get

Code: Select all

        libTKCAF.so.7 => not found
	libTKVCAF.so.7 => not found
	libTKV3d.so.7 => not found
	libTKService.so.7 => not found
	libTKCAF.so.7 => not found
	libTKCDF.so.7 => not found
	libTKCDF.so.7 => not found

and when i do

Code: Select all

ldd Fem.so
i get

Code: Select all

	libTKV3d.so.7 => not found
	libTKService.so.7 => not found
(only missing mentioned).

All found SO are in /usr/local/lib/. But the not found SO are in /usr/local/lib/. This is weird (at least for me).


waebbl wrote: Sat Sep 24, 2022 8:32 am Also the linker settings (-Wl,) flags could give some insight.
Gives not really insight, maybe i am using it incorrect.


waebbl wrote: Sat Sep 24, 2022 8:32 am Are you using external smesh?
No. I have installed it, but cmake takes the correct internal smesh. Also TechDraw needs no smesh and the Mesh WB also have no issue.


mfro wrote: Sat Sep 24, 2022 11:21 am Are they existing in a path that's known to ld.so (/etc/ld.so.conf / /etc/ld.so.conf.d)?
Yes, /usr/local/lib.


wmayer wrote: Sat Sep 24, 2022 8:44 am In which directory are the OCCT libs located?
/usr/local/lib


vm4dim wrote: Sat Sep 24, 2022 9:41 am I would compare the search result:
find /usr -iname '*TKV3d*'
find /usr -iname '*TKCAF*'

Code: Select all

/usr/local/lib/libTKV3d.so
/usr/local/lib/libTKV3d.so.7.6.3
/usr/local/lib/libTKV3d.so.7

/usr/local/lib/libTKCAF.so.7.6.3
/usr/local/lib/libTKCAF.so.7
/usr/local/lib/libTKCAF.so
vm4dim wrote: Sat Sep 24, 2022 9:41 am and search result other TK*
find /usr -iname '*TKernel*'
find /usr -iname '*TKMath*'

Code: Select all

/usr/share/texlive/texmf-dist/tex/generic/xint/xintkernel.sty
/usr/local/lib/libTKernel.so.7.6.3
/usr/local/lib/libTKernel.so
/usr/local/lib/libTKernel.so.7

/usr/local/lib/libTKMath.so.7
/usr/local/lib/libTKMath.so
/usr/local/lib/libTKMath.so.7.6.3
/usr/include/vtk-9.0/vtkMathConfigure.h
/usr/include/vtk-9.0/vtkMathTextFreeTypeTextRenderer.h
/usr/include/vtk-9.0/vtkMath.h
/usr/include/vtk-9.0/vtkMathTextUtilities.h
/usr/include/vtk-9.0/vtkMathUtilities.h


Just in case, while writng this post, i found the program for lbbtree. The odd thing is when i do here lddtree TechDraw.so and lddtree Fem.so, the SO are found. For example a part of the output:

Code: Select all

.....
scanelf: rpath_security_checks(): Security problem NULL DT_RUNPATH in /home/user/Programs/FreeCADmaster/build/Mod/Import/Import.so
        libTKIGES.so.7 => /usr/local/lib/libTKIGES.so.7
        libTKXSBase.so.7 => /usr/local/lib/libTKXSBase.so.7
        libTKXCAF.so.7 => /usr/local/lib/libTKXCAF.so.7
            libTKVCAF.so.7 => /usr/local/lib/libTKVCAF.so.7
            libTKV3d.so.7 => /usr/local/lib/libTKV3d.so.7
            libTKService.so.7 => /usr/local/lib/libTKService.so.7
                libX11.so.6 => /lib/x86_64-linux-gnu/libX11.so.6
As far as a know, there was one a time a similar problem, https://forum.freecad.org/viewtopic.php ... 5&start=30.

Just a few thoughts: a few days/(maybe weeks?) i compiled FreeCAD with OCCT7.4.0 because to test a regression and i generally have more then one build (development/toponaming, some test branches, .....). But inbetween i compiled FreeCAD with OCCT7.6.3 and used TechDraw. So i thought, maybe somehow FreeCAD while opening for example TechDraw.so it found a testbranch TechDraw SO with the incorrect paths. But i deleted all branches and made everything from the scratch again, so this could not be the case.

Anyway, i am running out of time and can only maybe tomorrow or next weekend. Inbetween i will not have access to a/the computer.

Thanks for all folks!

Greetings
user1234
wmayer
Founder
Posts: 20309
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: weird error: FreeCAD does not find some shared object files/directories

Post by wmayer »

/usr/local/lib
You should do an

Code: Select all

export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
in a terminal before starting FreeCAD from there.

For a permanent solution you can add the path /usr/local/lib to the file occt.conf and put it into the directory /etc/ld.so.conf.d/
and run ldconfig as root.

If you prefer a less invasive solution you can create the starter file FreeCAD.desktop with this content:

Code: Select all

[Desktop Entry]
Name=FreeCAD
GenericName=CAD Application
Exec=/usr/bin/env LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH" /home/user/Programs/FreeCADmaster/build/bin/FreeCAD %F
Terminal=false
Type=Application
StartupNotify=true
Icon=freecad
user1234
Veteran
Posts: 3506
Joined: Mon Jul 11, 2016 5:08 pm

Re: weird error: FreeCAD does not find some shared object files/directories

Post by user1234 »

wmayer wrote: Sun Sep 25, 2022 10:54 am You should do an

Code: Select all

export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
in a terminal before starting FreeCAD from there.
Thanks! The problem then i get some undefined symbols. Anyway, just out of curiosity i tried to you the official OCCT from Debian (7.5.1) and that worked (yes, i had should tried that before, since i did use since years). For the moment i can life with that, since (sadly) i am rarely work with FreeCAD atm. Just a notice: the only thing what changes between the flawless running FreeCAD was a that update (the only intersing things are the compiler and libc6), a git pull, a cmake update and make (in that order), so i blame the compiler. Maybe later i solves that automatic.

Thanks all!

Greetings
user1234

edit: wording was wrong
edit2: again, wtf
user1234
Veteran
Posts: 3506
Joined: Mon Jul 11, 2016 5:08 pm

Re: weird error: FreeCAD does not find some shared object files/directories

Post by user1234 »

@wmayer: just a follow up, yesterday there was a compiler update and now it works flawless again.

Greetings
user1234
Post Reply