run Qt app with dependent libraries on mac with no admin rights

≡放荡痞女 提交于 2020-01-06 19:49:12

问题


I am trying to build and run (and fix) an application that was written in Qt 4.8 for windows and then built on Linux. Trying to run it on Mac now.

The app requires certain lib dependencies - some of them built separately that I have control over, and a couple purchased sdks.

I can build the app fine, having set the location of all the dependent dylibs in the pro file.

Unfortunately I cannot execute the app, because the linker doesn't know where my dependencies are located... i guess it ignores my pro file.

I have tried to place the dependent dylibs in the same directory as the app (which I built either as a bundle or not) but I am still getting an error about missing dependencies.

I have read that I can put my libs in places where the linker will automatically find them, like /usr/local/lib. Unfortunately I don't have admin access. is there any other place to place them ?

What I am trying right now: packaging it, using the install_name_tool ... it is very tedious and I don't know if it will work... But that means I will have to run the packaging steps every time I rebuild the app - which is likely lots of times !

What can I do to place my dependencies in a location that the linker will find, with no access to sudo ? (or unable to view System folders... though I seem able to ls from terminal....very odd that I can... but no write rights on system folders)

Or what tool can I use on mac, with no admin rights, to make linker recognize a path to he libraries ?


回答1:


I am following this answer

http://qt-project.org/forums/viewthread/5469:

macx {
 LIBS += ../mylib/mylib-build-desktop/mylib.dylib

 PRE_TARGETDEPS = ../mylib/mylib-build-desktop/mylib.dylib

 mylib.path = Contents/MacOS
 mylib.files = ../mylib/mylib-build-desktop/mylib.1.dylib
 QMAKE_BUNDLE_DATA += mylib
}


来源:https://stackoverflow.com/questions/26552717/run-qt-app-with-dependent-libraries-on-mac-with-no-admin-rights

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!