Unable to load dynamic library image - Mac OS X

China☆狼群 提交于 2019-12-25 05:18:09

问题


I've been fighting Xcode for two days now trying to get a dylib built and then loaded by an executable and am having persistent dyld: Library not loaded: errors.

I am now at the point where I have my executable in one directory (/Users/drew/Development/Tools/bin - my personal bin directory) and the dylib in another directory (/Users/drew/Development/lib - my personal lib directory).

The application is a command line app and the otool -L output for it is as below

otool -L configcompiler
configcompiler:
  "/Users/drew/Development/lib/WSWebScraper dylib.dylib" (compatibility version 1.0.0, current version 1.0.0)
  /usr/lib/libxml2.2.dylib (compatibility version 10.0.0, current version 10.8.0)
  /System/Library/Frameworks/CoreData.framework/Versions/A/CoreData (compatibility version 1.0.0, current version 407.5.0)
  /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 945.0.0)
  /usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)
  /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 169.3.0)
  /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 744.0.0)

The dylib file definitely exists in the 'lib' location

ls -l "/Users/drew/Development/lib/WSWebScraper dylib.dylib"
  -rwxr-xr-x  1 drew  staff  246996 20 Aug 11:43 /Users/drew/Development/lib/WSWebScraper dylib.dylib

...but the application reports the error as below.

./configcompiler
dyld: Library not loaded: "/Users/drew/Development/lib/WSWebScraper dylib.dylib"
  Referenced from: /Users/drew/Development/Tools/bin/./configcompiler
  Reason: image not found
  Trace/BPT trap: 5

I've been staring at this for too long now and probably can't spot the glaringly obvious - another pair of eyes may spot the error. Thanks for any assistance you can give.

Andrew

来源:https://stackoverflow.com/questions/12036457/unable-to-load-dynamic-library-image-mac-os-x

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