OSX 安装oracle instantclient系列包

从oracle下载的几个包解压即可使用,但是这几个包如果不想安装在系统默认的/usr/bin和/usr/lib目录的话,就会有shared library找不到的问题了。参考了这篇文章修复此问题。

其中文中提到的script我运行后是有问题的,原因是因为install_name_tool的版本不对,换成xcode中的command line tool里面的版本就好了。所以更新script如下:

[code]
#!/bin/sh
# script to change the dynamic lib paths and ids for oracle instant client
# exes and libs

# proces all the executable files in this directory
find . -maxdepth 1 -type f \( -perm -1 -o \( -perm -10 -o -perm -100 \) \) -print | while read exe
do
echo adjusting executable $exe
baseexe=`basename $exe`
echo baseexe is $baseexe
otool -L $exe | awk ‘/oracle/ {print $1}’ | while read lib
do
echo adjusting lib $lib
baselib=`basename $lib`
echo baselib is $baselib
if [ “$baseexe” = “$baselib” ]
then
echo changing id to $baselib for $exe
/Applications/Xcode.app/Contents/Developer/usr/bin/install_name_tool -id $baselib $exe
else
echo changing path id for $lib in $exe
/Applications/Xcode.app/Contents/Developer/usr/bin/install_name_tool -change $lib @executable_path/$baselib $exe
fi
done
done
[/code]

By Lu Jun

80后男,就职于软件行业。习于F*** GFW。人生48%时间陪同电子设备和互联网,美剧迷,高清视频狂热者,游戏菜鸟,长期谷粉,临时果粉,略知摄影。

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.