Open GilfoyleProger opened 2 years ago
Rewriting the rpath is not optional, it is key to how linuxdeployqt works.
If all goes well, linuxdeployqt should find all required libraries using ldd
and deploy them into the AppDir. If that is not happening, it is most likely due to one of two things, or both:
/usr/lib/x86_64/
). If this is the case, try moving or copying such libraries to the standard library location (e.g., /usr/lib/x86_64/
before running linuxdeployqt
dlopen()
rather than being defined as a hard dependency in the ELF executable or library. If this is the case, try adding a hard dependency on the library using patchelf --add-needed ...
before running linuxdeployqt
.If the above still does not help: Can you post a link to your build script which is calling linuxdeployqt
?
Thank you for your reply.
dlopen
) can't find: libboost_system-mt, libboost_thread-mt and "someChildPrivateLib". These child libraries are dynamically loaded internally by "somePrivateLib".patchelf --add-needed ...
is not quite appropriate because it is not a default tool. Deployment of the project should be universal, we also build it on Jenkins. Please correct me if I'm wrong and the patchelf
tool can be used another way.Unfortunately, I can't send you the build script due to privacy, but I will try to describe some output information:
linuxdeployqt
is then started.dlopen
, and then open "somePrivateLib" via dlopen
, all libraries are successfully found by "somePrivateLib".So, the problem is only related to linking.
Thing is, linuxdeployqt has no way of knowing about the existence of libraries that are loaded via dlopen
, and hence does not deploy its dependencies. Does someChildPrivateLib depend on libraries that are not part of the AppImage? Is the rpath in someChildPrivateLib set in such a way that it can find its dependencies? Try passing linuxdeployqt -executable=/path/in/AppDir/to/someChildPrivateLib.so ...
which should result in linuxdeployqt try to deploy the dependencies of someChildPrivateLib as well.
Also, where are you dlopen
ing the library from? You'd need to construct an absolute path to someChildPrivateLib based on readlink /proc/self/exe
or something like that. Otherwise dlopen
has no chance to know where to find that library.
All someChildPrivateLib dependencies exist in AppImage. Using the command "linuxdeployqt -executable" is unnecessary because all dependencies are fully collected in AppImage (I already checked it). I checked the RPATH of these external libraries with "patchelf" - the RPATH was empty. For test, I used the "dlopen" command with relative path and "QMAKE_LFLAGS += "-Wl,-rpath,'$$ORIGIN/libs'"" to open Boost, "someChildPrivateLib" libraries. But this is not just an AppImage problem. If the AppImage linking problem is solved, it won't fix the problem of running the program from Qt Creator as described in the first comment.
And please can you tell me how linuxdeployqt overwrites the RPATH (which path is set)? Because I can't find information about it anywhere.
You can use patchelf --print-rpath
to see what rpath gets set by linuxdeployqt in the executables and libraries deployed by linuxdeployqt in the AppDir.
I think that in its present form linuxdeployqt is unable to do what you need; so you need to do some manual fixes before/after AppDir creation. Such as setting rpaths manually.
Thanks for advice. And I have one more question. I tried the patchelf --print-rpath
command with binaries after deployment and got this result: $ORIGIN/lib
Why did linuxdeployqt add the "lib" folder to RPATH if the "lib" folder doesn't exist in our project?
Please could you provide more information on how linuxdeployqt generates RPATH for the binaries?
Hi, We use linuxdeployqt to automatically deploy our Qt project in Ubuntu 20.04. Here is an example of qmake config:
deploy.commands = $$PWD/../installer/linuxdeployqt-continuous-x86_64.AppImage \"PROD_NAME\"
deploy.commands += -qmldir=$$QML_DIR
deploy.commands += -qmake=$$QMAKE_QMAKE
deploy.commands += -always-overwrite
...
deploy.commands += -appimage
I have shared libraries (.so) of Boost, "some private lib", which are dynamically loaded by another dynamic library. It seems to me that after running linuxdeployqt, the RPATH is overwritten and as a result:
When linuxdeployqt calling is commented out in qmake, the libraries are successfully found when I run the program from Qt Creator. Can you tell me please, is there any way to avoid overwriting the RPATH variable? I used the "QMAKE_LFLAGS += "-Wl,-rpath,'$$ORIGIN/libs'"" flag, but it is also overwritten after running linuxdeployqt. Is there any way to handle this in qmake or it is a linuxdeployqt bug? Let me know if you need more information.