[Solved] Path OSX - Library not loaded: @rpath/libfreeimage-3.17.0.dylib

Having trouble installing or compiling FreeCAD? Get help here.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
iyd2019
Posts: 108
Joined: Tue Oct 15, 2019 9:19 am

[Solved] Path OSX - Library not loaded: @rpath/libfreeimage-3.17.0.dylib

Post by iyd2019 »

Hi there,

After installing the last bundle FreeCAD_0.19-18524-OSX-x86_64-conda-Qt5-Py3.dmg, I got this error trying to import a STEP file:

Code: Select all

Path WB not found
Traceback (most recent call last):
  File "<string>", line 1, in <module>
<class 'ImportError'>: dlopen(/Applications/FreeCAD.app/Contents/Resources/lib/ImportGui.so, 2): Library not loaded: @rpath/libfreeimage-3.17.0.dylib
  Referenced from: /Applications/FreeCAD.app/Contents/Resources/lib/libTKService.7.dylib
  Reason: image not found
Which I solved creating a symlink

Code: Select all

cd /Applications/FreeCAD.app/Contents/Resources/lib
ln -s libfreeimage-3.18.0.dylib libfreeimage-3.17.0.dylib
Best regards
chrisb
Veteran
Posts: 53924
Joined: Tue Mar 17, 2015 9:14 am

Re: Path OSX - Library not loaded: @rpath/libfreeimage-3.17.0.dylib

Post by chrisb »

Hi and welcome to the forum!
Thanks for reporting.

I have moved your post from Path to Install/Compile forum.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Path OSX - Library not loaded: @rpath/libfreeimage-3.17.0.dylib

Post by Kunda1 »

Split this comment off in to it's own thread
Thanks for reporting @iyd2019 the issue and the workaround. Could you also just as a gesture of completeness, post you Help > About FreeCAD > Copy to clipboard ? Thanks

I wonder if this has anything to do with the 'OSX not being built correctly recently on Conda' or something thread recently ? (can't find the thread ATM)
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
User avatar
looo
Veteran
Posts: 3941
Joined: Mon Nov 11, 2013 5:29 pm

Re: Path OSX - Library not loaded: @rpath/libfreeimage-3.17.0.dylib

Post by looo »

I guess this issue is related to the build error reported here:
https://forum.freecadweb.org/viewtopic. ... 40#p340689

For now I added your fix here:
https://github.com/FreeCAD/FreeCAD-AppI ... dev.sh#L48

In the long run I guess we need to pin freeimage and update every freeimage dependent package. Or find a solution for osx, because this is not a problem for linux / win.
chrisb
Veteran
Posts: 53924
Joined: Tue Mar 17, 2015 9:14 am

Re: Path OSX - Library not loaded: @rpath/libfreeimage-3.17.0.dylib

Post by chrisb »

IIRC on linux there would exist a symlink libfreeimage->libfreeimage-3.17.0.dylib. Every program using the library would only use the symlink. If a new version of the lib is installed, then a new symlink is created.

Could this principle be used for FreeCAD on MacOS too?
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
iyd2019
Posts: 108
Joined: Tue Oct 15, 2019 9:19 am

Re: Path OSX - Library not loaded: @rpath/libfreeimage-3.17.0.dylib

Post by iyd2019 »

Kunda1 wrote: Tue Oct 15, 2019 10:36 am Could you also just as a gesture of completeness, post you Help > About FreeCAD > Copy to clipboard ? Thanks
Sure:

OS: macOS Mojave (10.14)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.18524 (Git)
Build type: Release
Branch: master
Hash: bea009c1d52b97655dab2d5c0fbddec30989a902
Python version: 3.7.3
Qt version: 5.12.5
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: Spanish/Spain (es_ES)


Best regards
User avatar
looo
Veteran
Posts: 3941
Joined: Mon Nov 11, 2013 5:29 pm

Re: Path OSX - Library not loaded: @rpath/libfreeimage-3.17.0.dylib

Post by looo »

chrisb wrote: Tue Oct 15, 2019 10:52 am IIRC on linux there would exist a symlink libfreeimage->libfreeimage-3.17.0.dylib. Every program using the library would only use the symlink. If a new version of the lib is installed, then a new symlink is created.

Could this principle be used for FreeCAD on MacOS too?
I guess libraries from conda-forge normally do so. But something has changed with the update from freeimage 3.17 to 3.18. See my issue here:
https://github.com/conda-forge/freeimag ... k/issues/9

But the runtime error seems to be a bit different than the build-error

edit1:
Looking at the build output of occt it seems like it links directly against lib/libfreeimage-3.17.0.dylib. So there seems to be something wrong with the occt-configuration.

edit2: let's see if building occt with freeimage 3.18 will fix the linking issue. If it does we can simple migrate to occt7.4 to fix this issue.

edit3: rebuilding occt with freeimage 3.18 somehow uses the static library and is claiming about a different osx version:

Code: Select all

ld: warning: object file ($PREFIX/lib/libfreeimage.a(Colors.o-x86_64)) was built for newer OSX version (10.11) than being linked (10.9)
edit4: ok so I guess the solution is to build occt without freeimage enabled. We do so for windows and there were no complaints about it, so this should be fine.
User avatar
looo
Veteran
Posts: 3941
Joined: Mon Nov 11, 2013 5:29 pm

Re: Path OSX - Library not loaded: @rpath/libfreeimage-3.17.0.dylib

Post by looo »

Occt7.4 without freeimage dependency should be available soon. I will start the occt7.4 migration next week. Hopefully this issue is fixed once the migration has finished.
User avatar
looo
Veteran
Posts: 3941
Joined: Mon Nov 11, 2013 5:29 pm

Re: Path OSX - Library not loaded: @rpath/libfreeimage-3.17.0.dylib

Post by looo »

Ok, occt 7.4 and 7.3 are now build without freeimage. Maybe someone can report back if everything works as expected.
chrisb
Veteran
Posts: 53924
Joined: Tue Mar 17, 2015 9:14 am

Re: Path OSX - Library not loaded: @rpath/libfreeimage-3.17.0.dylib

Post by chrisb »

I will test when it is available on the download site.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Post Reply