Error no file at “/usr/lib/<libs>” when executing macdeployqt
-
Hello everyone !
I have got an application that needs to be set up with macdeployqt, but when I call it, it tells me that it cannot find some libs into /usr/lib/ directory.
Before calling macdeployqt I have to insert 3 libs (.tx) into my .app. I used otool command to view the dependencies and here is the output of one of them :
RecomputeDimBlock.tx: RecomputeDimBlock.tx (compatibility version 0.0.0, current version 0.0.0) /System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL (compatibility version 1.0.0, current version 1.0.0) /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 1404.0.0) libTD_Db.dylib (compatibility version 0.0.0, current version 0.0.0) libTD_DbRoot.dylib (compatibility version 0.0.0, current version 0.0.0) libTD_Ge.dylib (compatibility version 0.0.0, current version 0.0.0) libTD_Root.dylib (compatibility version 0.0.0, current version 0.0.0) libTD_Alloc.dylib (compatibility version 0.0.0, current version 0.0.0) libTD_Gi.dylib (compatibility version 0.0.0, current version 0.0.0) libTD_SpatialIndex.dylib (compatibility version 0.0.0, current version 0.0.0) libsisl.dylib (compatibility version 0.0.0, current version 0.0.0) /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 120.1.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1225.1.1)
I also insert every "libTD_xx" with my tx. And then, I relink those libs. I have made a bash script to automate those steps :
#!/bin/bash if [ ! -e build/debug/MediaCad.app ] then echo MediaCad.app non trouvé dans build/debug/ echo Sortie du script exit 1 fi #Création du dossier « tx » dans le .app s’il n’existe pas if [ ! -d build/debug/MediaCad.app/Contents/tx ] then mkdir -p build/debug/MediaCad.app/Contents/tx fi #placement des tx et des libs dans le .app for tx in RecomputeDimBlock.tx PlotSettingsValidator.tx ThreadPool.tx libTD_Db.dylib libTD_DbRoot.dylib libTD_Gi.dylib libTD_SpatialIndex.dylib libTD_Ge.dylib libTD_Root.dylib libsisl.dylib libTD_Alloc.dylib do if [ -e tx/$tx ] then echo Copie de $tx dans l’application cp tx/$tx build/debug/MediaCad.app/Contents/tx else echo Impossible de trouver le fichier $tx dans tx/ echo Sortie du script exit 1 fi done #installation des libs cd tx/ for lib in libTD_Db.dylib libTD_DbRoot.dylib libTD_Gi.dylib libTD_SpatialIndex.dylib libTD_Ge.dylib libTD_Root.dylib libsisl.dylib libTD_Alloc.dylib do echo Installation de $lib install_name_tool -id $lib ../build/debug/MediaCad.app/Contents/tx/$lib install_name_tool -change $lib @executable_path/../tx/$lib ../build/debug/MediaCad.app/Contents/MacOS/MediaCad done #Actualisation des dépendances for tx in RecomputeDimBlock.tx PlotSettingsValidator.tx ThreadPool.tx do for lib in libTD_Db.dylib libTD_DbRoot.dylib libTD_Gi.dylib libTD_SpatialIndex.dylib libTD_Ge.dylib libTD_Root.dylib libsisl.dylib libTD_Alloc.dylib do echo Actualisation de $lib pour $tx install_name_tool -change $lib @executable_path/../tx/$lib ../build/debug/MediaCad.app/Contents/tx/$tx done done cd .. #génération du .app echo Début de la construction de l’application /Users/developpement/Qt/5.7/clang_64/bin/macdeployqt build/debug/MediaCad.app echo Application construite
When I execute my script, everything works fine except macdeployqt. Here is the output :
ERROR: no file at "/usr/lib/libTD_Alloc.dylib" ERROR: no file at "/usr/lib/libTD_DbRoot.dylib" ERROR: no file at "/usr/lib/libTD_Gi.dylib" ERROR: no file at "/usr/lib/libTD_Ge.dylib" ERROR: no file at "/usr/lib/libTD_Root.dylib" ERROR: no file at "/usr/lib/libTD_SpatialIndex.dylib" ERROR: no file at "/usr/lib/libsisl.dylib"
Those libs are the ones that I copied inside my .app at the beginning.
I presume that I'm doing something wrong with install_name_tool but I can't see where ? I have spent 4 days on it so that's why I asking my question here. I had the same problem with my own libs berfore, I had resolved the problem by chaning my .pro, but here libs are not belong to me.
I work with OS X 10.11 and Qt 5.7.If something is not clear do not hesitate to tell me, I know my english is not perfect :)
Thank you !
-
I ran into this problem as well. The location '/usr/lib' is treated in a special way. Anything that starts with this path is excluded automatically.
I install my copy of Qt in '/usr/lib/qt5/...'. It is probably not the right place for OSX but it is a left-over from where I usually install Qt in GNU/Linux. I found this path causes problems for macdeployqt as it won't use anything that starts with this path.
The reason they exclude this path is so that parts of the OS don't get included with your app. Some dependencies should be excluded as these are always provided by the OS.
My work around (solution) was to modify the source code for macdeployqt and add an exception to the excluded path for '/usr/lib/qt5'.
There are command line options that might help. I did look at these and they didn't work in my case but they might solve your problem.
-
Hi Rondog, thanks for your response
I have try to create a copy into /usr/lib/ but it says that the operation is not permitted. Since OSX 10.11, it is not possible to write on this directory.
The thing is I am trying to relink my dependense with install_name_tool but it seems that it's not working.
I will take a look on the source code of macdeployqt
-
Hi,
You calls are indeed wrong. Don't put
../build/debug/
in your path. It won't be valid at all once you move the bundle around.While having these libs in
Contents/tx
is wrong from a bundle point of view, if you put these libs there then the@executable_path/../tx/libname.tx
path is correct because@executable_path
will besomething/Contents/MacOS/
.What I would correct is the libTD path to also point to the folder were they are located.
Note that if you have to pass the original path you want to modify to
install_name_tool -change
-
The thing is if I remove
../build/debug
on the first or third call of install_name_tool, it tells me that there is no such file or directory for my libs.
I wrote my script according to a thread found on ODA forum that said :- Copy all required libraries to TeighaViewer.app/Contents/tx/ folder.
- For each library ($odalib) in tx folder perform following commands from the bin/macOsX_x64_*dll folder:
install_name_tool -id $odalib TeighaViewer.app/Contents/tx/$odalib install_name_tool -change $odalib @executable_path/../tx/$odalib TeighaViewer.app/Contents/MacOS/TeighaViewer
- For each library from tx folder update dependency to each library.
for lib in `ls TeighaViewer.app/Contents/tx` do for libdep in `ls TeighaViewer.app/Contents/tx` do install_name_tool -change $libdep @executable_path/../tx/$libdep TeighaViewer.app/Contents/tx/$lib done done
- Run macdeployqt for application to remove absolute path from Qt dependencies
macdeployqt TeighaViewer.app
for the second step I don't perform the command from the folder they ask, should I do this or move my script into my .app folder ?
-
Try the following:
- Build your app from scratch to have new bundle.
- Run macdeployqt on it
- Copy your .tx files in
Contents/Frameworks
- Copy the dependencies of your .tx files in
Contents/Frameworks
- Run
install_name_tool -id @executable_path/../Frameworks/name_of_your.tx
on all your .tx files - Run
install_name_tool -id @executable_path/../Frameworks/name_of_dependency.dylib
on all the dependencies of your .tx files (unless I'm mistaken they are all .dylib files). - Run
install_name_tool -change XXX.dylib @executable_path/../Frameworks/XXX.dylib
on all the .tx and their dependencies. XXX.dylib are the ones not coming from the system so the libTD_XXX libraries and libsisl etc.
[edit] fixed example SGaist
-
-
No,
XXX.something
must be the same. The only .tx argument you need there is the name of the file you callinstall_name_tool
on. -
So, I made every dependence like that :
install_name_tool -change libTD_SpatialIndex.dylib @executable_path/../Frameworks/libTD_SpatialIndex.dylib RecomputeDimBlock.tx install_name_tool -change libTD_SpatialIndex.dylib @executable_path/../Frameworks/libTD_SpatialIndex.dylib PlotSettingsValidator.tx install_name_tool -change libsisl.dylib @executable_path/../Frameworks/libsisl.dylib PlotSettingsValidator.tx install_name_tool -change libsisl.dylib @executable_path/../Frameworks/libsisl.dylib RecomputeDimBlock.tx
and still got the same error :
ERROR: no file at "/usr/lib/libTD_Alloc.dylib" ERROR: no file at "/usr/lib/libTD_DbRoot.dylib" ERROR: no file at "/usr/lib/libTD_Gi.dylib" ERROR: no file at "/usr/lib/libTD_Ge.dylib" ERROR: no file at "/usr/lib/libTD_Root.dylib" ERROR: no file at "/usr/lib/libTD_SpatialIndex.dylib" ERROR: no file at "/usr/lib/libsisl.dylib"
Maybe what I'm trying to do is not the solution of my initial problem (the app can't find .tx). Maybe the problem comes from the ODA library on this version, I don't know... It works well on Windows but it's so strange and specific on Mac, I think I'm not enough experienced to face this kind of problem, and I never touched a Mac before, so it's very hard to get used to it
I have 45min left, I don't think I have time to try something else, thanks for your time and your answers, for each thread I wrote !
-
If you mean that macdeployqt still gives you the same error, then that's normal. We run it before modifying these libraries.
If you want macdeployqt to not scream at these libraries, you can change the original files and put the whole path to them with
-change
.