dyld: Library not loaded: @rpath/libqconf.dylib
Referenced from: /Users/zhu/work/go/test-go
Reason: image not found
[1] 20779 abort /Users/zhu/work/go/test-go
编译golang项目,编译正常了!但是 执行的时候 报错了! 上的错误!
是因为 @rpath
听说是个变化的变量!我查了很多资料,发现都是编译ios啊等问题里的!
先找到 libqconf.dylib
文件位置,qconf的话在 /usr/local/qconf/lib
再找位置
➜ test-go git:(master) ✗ otool -L /Users/zhu/work/go/test-go
/Users/zhu/work/go/test-go:
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.250.1)
@rpath/libqconf.dylib (compatibility version 0.0.0, current version 0.0.0)
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1575.17.0)
/System/Library/Frameworks/Security.framework/Versions/A/Security (compatibility version 1.0.0, current version 58286.255.3)
再执行
➜ bin git:(master) ✗ install_name_tool -add_rpath /usr/local/qconf/lib /Users/zhu/work/go/test-go/test-go
添加一次就够了!再添加可能会报错!不过不影响
would duplicate path, file already has LC_RPATH for: /usr/local/qconf/lib
别管就行了!
再次执行编译后的代码! 没问题了!
本站(PHP --> Golang)已重构,代码开源
当你能力不能满足你的野心的时候,你就该沉下心来学习