在没有管理员权限的情况下在Mac上运行带有依赖库的Qt应用
我试图为Windows构建和运行(和修复)以Qt 4.8编写的应用程序,然后在Linux上构建该应用程序.现在尝试在Mac上运行它.
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.
该应用程序需要某些lib依赖项-其中一些是我可以控制的,它们是单独构建的,还购买了一些SDK.
The app requires certain lib dependencies - some of them built separately that I have control over, and a couple purchased sdks.
在pro文件中设置所有相关dylib的位置后,我可以很好地构建该应用程序.
I can build the app fine, having set the location of all the dependent dylibs in the pro file.
不幸的是,我无法执行该应用程序,因为链接器不知道我的依赖项位于何处...我想它会忽略我的pro文件.
Unfortunately I cannot execute the app, because the linker doesn't know where my dependencies are located... i guess it ignores my pro file.
我试图将依赖的dylib放置在与应用程序相同的目录中(无论是否以捆绑方式构建),但仍然出现有关缺少依赖项的错误.
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.
我读到我可以将我的库放在链接器会自动找到它们的地方,例如/usr/local/lib.不幸的是我没有管理员权限.还有其他放置它们的地方吗?
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 ?
我现在正在尝试的事情:使用install_name_tool打包它...非常繁琐,我不知道它是否可以工作...但这意味着我每次都必须运行打包步骤重建应用-可能很多次!
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 !
我该怎么做才能将我的依赖项放置在链接器可以找到的位置,而不能访问sudo? (或无法查看系统文件夹...虽然我似乎可以从终端ls ..我可以...但很奇怪,但是对系统文件夹没有写权限)
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)
或者在没有管理员权限的情况下,我可以在Mac上使用什么工具来使链接器识别库的路径?
Or what tool can I use on mac, with no admin rights, to make linker recognize a path to he libraries ?
我正在关注此答案
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
}