[SOLVED] Trying to compile against a different version of OCC

Having trouble installing or compiling FreeCAD? Get help here.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
mconsidine
Posts: 125
Joined: Wed Jan 18, 2023 10:41 pm
Location: Randolph, VT USA

[SOLVED] Trying to compile against a different version of OCC

Post by mconsidine »

First:

Code: Select all

OS: Linux Mint 21 (X-Cinnamon/cinnamon)
Word size of FreeCAD: 64-bit
Version: 0.21.0.33044 (Git)
Build type: Unknown
Branch: master
Hash: 3fabd940dd3322b247fe2a82f68b754c087f3b34
Python 3.10.6, Qt 5.15.3, Coin 4.0.1, Vtk 9.1.0, OCC 7.7.1
Locale: English/United States (en_US)
Installed mods: 
  * OpenSCAD_Alt_Import 1.0.0
  * ProDarkThemePreferencePack 1.0.0
  * toSketch 1.0.1
  * Render 2023.2.3
  * Manipulator 1.5.0
  * Help 1.0.3
  * POV-Ray-Rendering
  * MeshRemodel 1.8919.0
  * freecad.gears 1.0.0
  * CubeMenu
  * fasteners 0.4.56
  * Silk 0.1.3
  * Dracula 0.0.4
  * Curves 0.6.8
  * ThreadProfile 1.85.0
I am trying to compile FC against the latest running-with-scissors verstion of OCC, namely 7.7.1 My system install has version 7.6.3 and FC compiles against it without error. So I compiled 7.7.1 to a new folder and installed to a new folder such that it doesn't overwrite my existing install. The OCC build/install completed without error. So did building FC to a new folder. As you can see from the above profile, FC sees 7.7.1 as the OCC install.

When I start FC, though, I get

Code: Select all

Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "/usr/lib/python3/dist-packages/shiboken2/files.dir/shibokensupport/__feature__.py", line 142, in _import
    return original_import(name, *args, **kwargs)
  File "/home/matt/Downloads/freecad-install_771/Mod/Draft/Draft.py", line 145, in <module>
    from draftfunctions.draftify import draftify
  File "/usr/lib/python3/dist-packages/shiboken2/files.dir/shibokensupport/__feature__.py", line 142, in _import
    return original_import(name, *args, **kwargs)
  File "/home/matt/Downloads/freecad-install_771/Mod/Draft/draftfunctions/draftify.py", line 37, in <module>
    import draftmake.make_circle as make_circle
  File "/usr/lib/python3/dist-packages/shiboken2/files.dir/shibokensupport/__feature__.py", line 142, in _import
    return original_import(name, *args, **kwargs)
  File "/home/matt/Downloads/freecad-install_771/Mod/Draft/draftmake/make_circle.py", line 33, in <module>
    import Part
  File "/usr/lib/python3/dist-packages/shiboken2/files.dir/shibokensupport/__feature__.py", line 142, in _import
    return original_import(name, *args, **kwargs)
ImportError: libTKIGES.so.7.7: cannot open shared object file: No such file or directory
Since the libTKxxxxx.so.7.7 files only live in the new "install" folder for OCCT I'm guessing that at some point FC is looking in default locations like /usr/lib for libraries, rather than in the install path for OCC that FC was compiled against. It works fine against 7.6.3 because *that* version I installed on the system.

I cannot figure out where additionally FC needs to be told to check-for-a-non-default-OCC-install-first. Can anyone assist?

TIA,
mconsidine
Last edited by mconsidine on Tue May 02, 2023 9:56 pm, edited 1 time in total.
User avatar
naxq0
Posts: 51
Joined: Wed Apr 25, 2018 7:45 am

Re: Trying to compile against a different version of OCC

Post by naxq0 »

You can take a look at the OpenCASCADE_DIR variable in cmake using cmake -LA or ccmake .

For me it's pointing to /usr/local/lib/cmake/opencascade

If you previously built and installed another version of opencascade, there's a chance that cmake is using the *.cmake files from the previous opencasde.

I'm not sure if this is the fix, but you could try setting that OpenCASCADE_DIR variable to point to your new OCCT's *.cmake files at /where/you/have/occt/build/CMakeFiles/Export/lib/cmake/opencascade
wmayer
Founder
Posts: 20309
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Trying to compile against a different version of OCC

Post by wmayer »

You have to set the environment variable LD_LIBRARY_PATH that points to the directory of the OCC libs. I suggest to write a shell script FreeCAD.sh with this content:

Code: Select all

#!/bin/sh

export LD_LIBRARY_PATH=/Path_to_your_OCC_771_install/lib
./FreeCAD
Then start FreeCAD.sh instead of FreeCAD
mconsidine
Posts: 125
Joined: Wed Jan 18, 2023 10:41 pm
Location: Randolph, VT USA

Re: Trying to compile against a different version of OCC

Post by mconsidine »

@wmayer Thank you for looking into this. I'll try that out this evening and report back.
Appreciatively,
mconsidine
User avatar
adrianinsaval
Veteran
Posts: 5551
Joined: Thu Apr 05, 2018 5:15 pm

Re: Trying to compile against a different version of OCC

Post by adrianinsaval »

btw, freecad 0.21 on flathub-beta repo now uses occt 7.7.1 too in case you prefer something precompiled.
mconsidine
Posts: 125
Joined: Wed Jan 18, 2023 10:41 pm
Location: Randolph, VT USA

Re: Trying to compile against a different version of OCC

Post by mconsidine »

@wmayer Your suggestion worked perfectly. Thank you!
@adrianinsaval That's good to know for when I screw up my own install :)
Thanks to everyone for the review and help. Much appreciated.
Rgds,
mconsidine
Post Reply