dyld: library not loaded: /usr/local/lib/libofa.0.dylibReferenced from: /sers/davID/Projekte/Test/build/DeBUG/Test.app/Contents/MacOS/TestReason: image not found
我已经做了一些研究,并用install_name_tool改变了dylib内的路径:
davIDs-macbook:Test davID$otool -L libofa.0.0.0.dylib libofa.0.0.0.dylib:@executable_path/../Frameworks/libofa.0.0.0.dylib (compatibility version 1.0.0,current version 1.0.0)/usr/lib/libSystem.B.dylib (compatibility version 1.0.0,current version 125.2.1)/System/library/Frameworks/Accelerate.framework/Versions/A/Accelerate (compatibility version 1.0.0,current version 4.0.0)/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0,current version 7.9.0)
但Xcode在/usr/lib /中继续搜索:
build/DeBUG/Test.app/Contents/MacOS/Test:/System/library/Frameworks/Cocoa.framework/Versions/A/Cocoa (compatibility version 1.0.0,current version 15.0.0)/System/library/Frameworks/AudioToolBox.framework/Versions/A/AudioToolBox (compatibility version 1.0.0,current version 1.0.0)/opt/local/lib/libz.1.dylib (compatibility version 1.0.0,current version 1.2.5)@executable_path/../Frameworks/Taglib.framework/Versions/A/Taglib (compatibility version 1.0.0,current version 1.0.0)/System/library/Frameworks/QTKit.framework/Versions/A/QTKit (compatibility version 1.0.0,current version 1.0.0)/opt/local/lib/libexpat.1.dylib (compatibility version 7.0.0,current version 7.2.0)/System/library/Frameworks/Quartz.framework/Versions/A/Quartz (compatibility version 1.0.0,current version 1.0.0)/opt/local/lib/libcurl.4.dylib (compatibility version 7.0.0,current version 7.0.0)/usr/local/lib/libofa.0.dylib (compatibility version 1.0.0,current version 1.0.0)/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0,current version 7.9.0)/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0,current version 103.0.0)/usr/lib/libSystem.B.dylib (compatibility version 1.0.0,current version 125.2.0)/usr/lib/libobjc.A.dylib (compatibility version 1.0.0,current version 227.0.0)/System/library/Frameworks/CoreServices.framework/Versions/A/CoreServices (compatibility version 1.0.0,current version 44.0.0)/System/library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0,current version 550.29.0)/System/library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0,current version 751.29.0)/System/library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0,current version 1038.32.0)
有没有办法在Xcode中设置?谢谢
编辑:图书馆不是Xcode项目.它的构建与./configure;使
解决方法 通常我所做的是这样的:>将库的安装目录设置为@rpath.这将将安装名称设置为@ rpath / libofa.0.0.0.dylib.如果你自己构建图书馆,你可以在Xcode中设置;否则,使用install_name_tool来更改它.
>使用库将应用程序的Runpath搜索路径设置为包含库的目录的位置.例如,如果将库放在应用程序的Frameworks目录中,则可以将Runpath搜索路径设置为@executable_path /../ Frameworks(或@loader_path /../ Frameworks).
This blog post和this one更详细.
总结以上是内存溢出为你收集整理的Xcode不断搜索dylib错误的路径全部内容,希望文章能够帮你解决Xcode不断搜索dylib错误的路径所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)