在mac下开发该如何配置dylib

stereoMatching 2013-02-16 11:18:19
输入如下的指令后
otool -L imageInterpolation.app/Contents/MacOS/imageInterpolation


得知openCV的dylib的identification name是
lib/libopencv_core.2.4.dylib (compatibility version 2.4.0, current version 2.4.3)


然后我写了一个改变identification name的script
[code=c]
#!/bin/bash
mkdir /Users/Qt/program/commercial_apps/imageInterpolation/imageInterpolation.app/Contents/Frameworks

cp /usr/local/lib/libopencv_core.2.4.3.dylib /Users/Qt/program/commercial_apps/imageInterpolation/imageInterpolation.app/Contents/Frameworks

install_name_tool -id @executable_path/../Frameworks/libopencv_core.2.4.3.dylib /Users/Qt/program/commercial_apps/imageInterpolation/imageInterpolation.app/Contents/Frameworks/libopencv_core.2.4.3.dylib

[/code

很遗憾的是identification的名字还是没有改变
执行otool后结果还是一样

好像还得配合install_name_tool的另外一个选项,-change
不过我不晓得该怎么用
...全文
423 6 打赏 收藏 举报
写回复
6 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
stereoMatching 2013-02-17
之前贴的解法有点小问题,低下是修改版本

#!/bin/bash

mkdir imageInterpolation.app/Contents/Frameworks

cp /Users/Qt/program/commercial_apps/imageInterpolation/release/libimageViewer.1.0.0.dylib   /Users/Qt/program/commercial_apps/imageInterpolation/imageInterpolation.app/Contents/Frameworks
mv /Users/Qt/program/commercial_apps/imageInterpolation/imageInterpolation.app/Contents/Frameworks/libimageViewer.1.0.0.dylib  \
/Users/Qt/program/commercial_apps/imageInterpolation/imageInterpolation.app/Contents/Frameworks/libimageViewer.1.dylib  

source ~/.mybash_profile #macdeployqt path

macdeployqt /Users/Qt/program/commercial_apps/imageInterpolation/imageInterpolation.app -verbose=2 -dmg

#*****************openCV libraries****************************

#****************update openCV id***********************#

install_name_tool -id @executable_path/../Frameworks/libopencv_core.2.4.dylib      imageInterpolation.app/Contents/Frameworks/libopencv_core.2.4.dylib
install_name_tool -id @executable_path/../Frameworks/libopencv_highgui.2.4.dylib   imageInterpolation.app/Contents/Frameworks/libopencv_highgui.2.4.dylib
install_name_tool -id @executable_path/../Frameworks/libopencv_imgproc.2.4.dylib    imageInterpolation.app/Contents/Frameworks/libopencv_imgproc.2.4.dylib
install_name_tool -id @executable_path/../Frameworks/libopencv_photo.2.4.dylib    imageInterpolation.app/Contents/Frameworks/libopencv_photo.2.4.dylib

#****************change openCV libraries references***********************#

install_name_tool -change  lib/libopencv_core.2.4.dylib      @executable_path/../Frameworks/libopencv_core.2.4.dylib      "imageInterpolation.app/Contents/MacOS/imageInterpolation"
install_name_tool -change  lib/libopencv_highgui.2.4.dylib   @executable_path/../Frameworks/libopencv_highgui.2.4.dylib   "imageInterpolation.app/Contents/MacOS/imageInterpolation"
install_name_tool -change  lib/libopencv_imgproc.2.4.dylib   @executable_path/../Frameworks/libopencv_imgproc.2.4.dylib   "imageInterpolation.app/Contents/MacOS/imageInterpolation"
install_name_tool -change  lib/libopencv_photo.2.4.dylib     @executable_path/../Frameworks/libopencv_photo.2.4.dylib     "imageInterpolation.app/Contents/MacOS/imageInterpolation"

#****************change openCV internal libraries cross-references***********************#

install_name_tool -change  lib/libopencv_core.2.4.dylib      @executable_path/../Frameworks/libopencv_core.2.4.dylib      "imageInterpolation.app/Contents/Frameworks/libopencv_highgui.2.4.dylib"
install_name_tool -change  lib/libopencv_imgproc.2.4.dylib   @executable_path/../Frameworks/libopencv_imgproc.2.4.dylib   "imageInterpolation.app/Contents/Frameworks/libopencv_highgui.2.4.dylib"

install_name_tool -change  lib/libopencv_core.2.4.dylib      @executable_path/../Frameworks/libopencv_core.2.4.dylib       "imageInterpolation.app/Contents/Frameworks/libopencv_imgproc.2.4.dylib"

install_name_tool -change  lib/libopencv_core.2.4.dylib      @executable_path/../Frameworks/libopencv_core.2.4.dylib      "imageInterpolation.app/Contents/Frameworks/libopencv_photo.2.4.dylib"
install_name_tool -change  lib/libopencv_imgproc.2.4.dylib   @executable_path/../Frameworks/libopencv_imgproc.2.4.dylib   "imageInterpolation.app/Contents/Frameworks/libopencv_photo.2.4.dylib"

 
#********************self created library**************  sc = self created

#****************update sc id***********************#

install_name_tool -id @executable_path/../Frameworks/libimageViewer.1.dylib  imageInterpolation.app/Contents/Frameworks/libimageViewer.1.dylib

#****************change sc libraries references***********************#

install_name_tool -change libimageViewer.1.dylib @executable_path/../Frameworks/libimageViewer.1.dylib "imageInterpolation.app/Contents/MacOS/imageInterpolation"

#****************change sc internal libraries cross-references***********************#     

install_name_tool -change  lib/libopencv_core.2.4.dylib      @executable_path/../Frameworks/libopencv_core.2.4.dylib      "imageInterpolation.app/Contents/Frameworks/libimageViewer.1.dylib"
install_name_tool -change  lib/libopencv_highgui.2.4.dylib   @executable_path/../Frameworks/libopencv_highgui.2.4.dylib   "imageInterpolation.app/Contents/Frameworks/libimageViewer.1.dylib"
install_name_tool -change  lib/libopencv_imgproc.2.4.dylib   @executable_path/../Frameworks/libopencv_imgproc.2.4.dylib   "imageInterpolation.app/Contents/Frameworks/libimageViewer.1.dylib"
install_name_tool -change  lib/libopencv_photo.2.4.dylib     @executable_path/../Frameworks/libopencv_photo.2.4.dylib     "imageInterpolation.app/Contents/Frameworks/libimageViewer.1.dylib"

install_name_tool -change  /Users/yyyy/Qt5.0.1/5.0.1/clang_64/lib/QtWidgets.framework/Versions/5/QtWidgets  \
@executable_path/../Frameworks/QtWidgets.framework/Versions/5/QtWidgets   \
"imageInterpolation.app/Contents/Frameworks/libimageViewer.1.dylib"

install_name_tool -change  /Users/yyyy/Qt5.0.1/5.0.1/clang_64/lib/QtGui.framework/Versions/5/QtGui  \
@executable_path/../Frameworks/QtGui.framework/Versions/5/QtGui   \
"imageInterpolation.app/Contents/Frameworks/libimageViewer.1.dylib"

install_name_tool -change  /Users/yyyy/Qt5.0.1/5.0.1/clang_64/lib/QtCore.framework/Versions/5/QtCore  \
@executable_path/../Frameworks/QtCore.framework/Versions/5/QtCore   \
"imageInterpolation.app/Contents/Frameworks/libimageViewer.1.dylib"

exit 0
对shell script还不够熟悉,写的落落长还请见谅
  • 打赏
  • 举报
回复
scream7 2013-02-17
MAC下还还没接触过呢
  • 打赏
  • 举报
回复
自己回复了也没有问题,而且原分全部返还
引用 3 楼 shit_moment 的回复:
没有回帖的话,可以自己删除帖子的
  • 打赏
  • 举报
回复
没有回帖的话,可以自己删除帖子的
  • 打赏
  • 举报
回复
jixingzhong 2013-02-16
可以分享在你的blog中了。
  • 打赏
  • 举报
回复
stereoMatching 2013-02-16
问题好像解决了,感谢这个连接 http://www.dafscollaborative.org/opencv-deploy.html 自己写的scripts

#!/bin/bash

source ~/.mybash_profile #macdeployqt path

macdeployqt /Users/Qt/program/commercial_apps/imageInterpolation/imageInterpolation.app -verbose=2 -dmg

cp /Users/Qt/program/commercial_apps/imageInterpolation/release/libimageViewer.1.0.0.dylib   /Users/Qt/program/commercial_apps/imageInterpolation/imageInterpolation.app/Contents/Frameworks

#*****************openCV libraries****************************

#****************update openCV id***********************#

install_name_tool -id @executable_path/../Frameworks/libopencv_core.2.4.dylib      imageInterpolation.app/Contents/Frameworks/libopencv_core.2.4.dylib
install_name_tool -id @executable_path/../Frameworks/libopencv_highgui.2.4.dylib   imageInterpolation.app/Contents/Frameworks/libopencv_highgui.2.4.dylib
install_name_tool -id @executable_path/../Frameworks/ibopencv_imgproc.2.4.dylib    imageInterpolation.app/Contents/Frameworks/libopencv_imgproc.2.4.dylib
install_name_tool -id @executable_path/../Frameworks/libopencv_photo.2.4.dylib     imageInterpolation.app/Contents/Frameworks/libopencv_photo.2.4.dylib

#****************change openCV libraries references***********************#

install_name_tool -change  lib/libopencv_core.2.4.dylib      @executable_path/../Frameworks/libopencv_core.2.4.dylib      "imageinterpolation.app/Contents/MacOS/imageInterpolation"
install_name_tool -change  lib/libopencv_highgui.2.4.dylib   @executable_path/../Frameworks/libopencv_highgui.2.4.dylib   "imageinterpolation.app/Contents/MacOS/imageInterpolation"
install_name_tool -change  lib/libopencv_imgproc.2.4.dylib   @executable_path/../Frameworks/ibopencv_imgproc.2.4.dylib    "imageinterpolation.app/Contents/MacOS/imageInterpolation"
install_name_tool -change  lib/libopencv_photo.2.4.dylib     @executable_path/../Frameworks/libopencv_photo.2.4.dylib     "imageinterpolation.app/Contents/MacOS/imageInterpolation"

#****************change openCV internal libraries cross-references***********************#

install_name_tool -change  lib/libopencv_core.2.4.dylib      @executable_path/../Frameworks/libopencv_core.2.4.dylib      "imageinterpolation.app/Contents/Frameworks/libopencv_highgui.2.4.dylib"
install_name_tool -change  lib/libopencv_imgproc.2.4.dylib   @executable_path/../Frameworks/libopencv_imgproc.2.4.dylib   "imageinterpolation.app/Contents/Frameworks/libopencv_highgui.2.4.dylib"

install_name_tool -change  lib/libopencv_core.2.4.dylib      @executable_path/../Frameworks/ibopencv_core.2.4.dylib       "imageinterpolation.app/Contents/Frameworks/libopencv_imgproc.2.4.dylib"

install_name_tool -change  lib/libopencv_core.2.4.dylib      @executable_path/../Frameworks/libopencv_core.2.4.dylib      "imageinterpolation.app/Contents/Frameworks/libopencv_photo.2.4.dylib"
install_name_tool -change  lib/libopencv_imgproc.2.4.dylib   @executable_path/../Frameworks/libopencv_imgproc.2.4.dylib   "imageinterpolation.app/Contents/Frameworks/libopencv_photo.2.4.dylib"

 
#********************self created library**************  sc = self created

#****************update sc id***********************#

#install_name_tool -id @executable_path/../Frameworks/libimageViewer.1.0.0.dylib  imageInterpolation.app/Contents/Frameworks/libimageViewer.1.0.0.dylib

#****************change sc libraries references***********************#

#install_name_tool -change @executable_path/../Frameworks/libimageViewer.1.0.0.dylib

#****************change sc internal libraries cross-references***********************#     

install_name_tool -change  lib/libopencv_core.2.4.dylib      @executable_path/../Frameworks/libopencv_core.2.4.dylib      "imageinterpolation.app/Contents/Frameworks/libimageViewer.1.0.0.dylib"
install_name_tool -change  lib/libopencv_highgui.2.4.dylib   @executable_path/../Frameworks/libopencv_highgui.2.4.dylib   "imageinterpolation.app/Contents/Frameworks/libimageViewer.1.0.0.dylib"
install_name_tool -change  lib/libopencv_imgproc.2.4.dylib   @executable_path/../Frameworks/libopencv_imgproc.2.4.dylib   "imageinterpolation.app/Contents/Frameworks/libimageViewer.1.0.0.dylib"
install_name_tool -change  lib/libopencv_photo.2.4.dylib     @executable_path/../Frameworks/libopencv_photo.2.4.dylib     "imageinterpolation.app/Contents/Frameworks/libimageViewer.1.0.0.dylib"

install_name_tool -change  /Users/yyyy/Qt5.0.1/5.0.1/clang_64/lib/QtWidgets.framework/Versions/5/QtWidgets  \
@executable_path/../Frameworks/QtWidgets.framework/Versions/5/QtWidgets   \
"imageinterpolation.app/Contents/Frameworks/libimageViewer.1.0.0.dylib"

install_name_tool -change  /Users/yyyy/Qt5.0.1/5.0.1/clang_64/lib/QtGui.framework/Versions/5/QtGui  \
@executable_path/../Frameworks/QtGui.framework/Versions/5/QtGui   \
"imageinterpolation.app/Contents/Frameworks/libimageViewer.1.0.0.dylib"

install_name_tool -change  /Users/yyyy/Qt5.0.1/5.0.1/clang_64/lib/QtCore.framework/Versions/5/QtCore  \
@executable_path/../Frameworks/QtCore.framework/Versions/5/QtCore   \
"imageinterpolation.app/Contents/Frameworks/libimageViewer.1.0.0.dylib"

exit 0
要在mac下配置第三方的libs真是麻烦透顶 有哪位可以回个贴好让我结贴?
  • 打赏
  • 举报
回复
相关推荐
发帖
C++ 语言

6.2w+

社区成员

C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
帖子事件
创建了帖子
2013-02-16 11:18
社区公告
暂无公告