我正在尝试从我的英特尔mac运行OSX 10.6 snow leopard连接到远程系统上的Oracle 10.2.0.4。我尝试使用Perl CPAN安装DBD :: Oracle(DBI正常工作),但出现编译错误。是否有人可以提供一个易于遵循的指南?
我正在尝试从我的英特尔mac运行OSX 10.6 snow leopard连接到远程系统上的Oracle 10.2.0.4。我尝试使用Perl CPAN安装DBD :: Oracle(DBI正常工作),但出现编译错误。是否有人可以提供一个易于遵循的指南?
看起来由于XCode4的变化(删除PPC架构支持),在10.6.X更新中Perl安装未被更新以删除PPC二进制文件(可能是因为Rosetta仍然存在)。
因此,配置文件仍保留“-arch ppc”,导致所有使用C库编译的CPAN模块编译失败,因为MakeMaker的输出Makefile包含“-arch ppc”。
要解决此问题,可以编辑以下文件:
/System/Library/Perl/5.10.0/darwin-thread-multi-2level/Config_heavy.pl
在第1219行你会看到:
$archflags = exists($ENV{ARCHFLAGS}) ? $ENV{ARCHFLAGS} : '-arch x86_64 -arch i386 -arch ppc';
更改为:
$archflags = exists($ENV{ARCHFLAGS}) ? $ENV{ARCHFLAGS} : '-arch x86_64 -arch i386';
完成此操作后,生成的Makefile将正确无误。
将mac上的perl与oracle协调起来有点棘手-一旦运行起来,它就非常棒,但是让它运行起来有点令人沮丧。
以下内容在几个不同的Intel Macs上为我工作过,其中可能有多余的步骤,并且对于其他平台可能不会相同。
这将需要使用shell、root用户和一些CPAN - 没有太大的负担。
首先创建一个目录,用于存放Oracle pap - 库、即时客户端等。
sudo mkdir /usr/oracle_instantClient64
从Oracle下载并提取所有64位即时客户端软件包到上述目录中。
在该目录中为其中一个文件创建符号链接。
sudo cd /usr/oracle_instantClient64
sudo ln -s /usr/oracle_instantClient64/libclntsh.dylib.10.1 libclntsh.dylib
sudo mkdir -p /b/227/rdbms/
sudo cd /b/227/rdbms/
sudo ln -s /usr/oracle_instantClient64/ lib
需要添加一些环境变量,因此请编辑 /etc/profile 并添加它们,以便所有用户都可以使用:
export ORACLE_HOME=/usr/oracle_instantClient64
export DYLD_LIBRARY_PATH=/usr/oracle_instantClient64
sudo perl -MCPAN -e shell
install DBD::Oracle
如果CPAN安装失败,请退出CPAN并转到您的.cpan/build目录 - 如果您使用的是自动配置的CPAN,则该目录将为
cd ~/.cpan/build
o conf build_dir
export ORACLE_HOME=/usr/oracle_instantClient64
export DYLD_LIBRARY_PATH=/usr/oracle_instantClient64
perl Makefile.pl
make
make install
sudo perl -MCPAN -e shell
install DBI
Correction to this step
perl Makefile.pl
make
install
The last step should be make install
During make, you may encounter an error that looks like :
lipo: can't open input file: /var/tmp//ccIevTzM.out (No such file or directory)
To correct this you must edit the file "Makefile" created after the "perl Makefile.pl" step and remove all occurrences of the following text :
-arch ppc
This will eliminate the error.
The same error described in (2.) will occur during the installation of the DBI module. You must edit the Makefile
created after the perl Makefile.pl
step and remove all occurrences of the following text :
-arch ppc
这是一组非常好的指令。我有一些关于潜在“陷阱”的其他评论。
Correction to this step
perl Makefile.pl
make
install
The last step should be make install
During make, you may encounter an error that looks like :
lipo: can't open input file: /var/tmp//ccIevTzM.out (No such file or directory)
To correct this you must edit the file "Makefile" created after the "perl Makefile.pl" step and remove all occurrences of the following text :
-arch ppc
This will eliminate the error.
The same error described in (2.) will occur during the installation of the DBI module. You must edit the Makefile
created after the perl Makefile.pl
step and remove all occurrences of the following text :
-arch ppc
看起来 "Perl MakeFile.pl" 命令没有正确找到 Perl 的版本,我收到了这个错误信息:
bash-3.2# perl Makefile.PL
Multiple copies of Driver.xst found in: /Library/Perl/5.10.0/darwin-thread-multi-2level/auto/DBI/ /System/Library/Perl/Extras/5.10.0/darwin-thread-multi-2level/auto/DBI/ at Makefile.PL line 37
Using DBI 1.616 (for perl 5.010000 on darwin-thread-multi-2level) installed in /Library/Perl/5.10.0/darwin-thread-multi-2level/auto/DBI/
Configuring DBD::Oracle for perl 5.010000 on darwin (darwin-thread-multi-2level)
Remember to actually *READ* the README file! Especially if you have any problems.
Installing on a darwin, Ver#10.0
Using Oracle in /usr/oracle_instantClient64
Can't find sqlplus. Pity, it would have helped.
I'm having trouble finding your Oracle version number... trying harder
WARNING: I could not determine Oracle client version so I'll just
default to version 8.0.0.0. Some features of DBD::Oracle may not work.
Oracle version based logic in Makefile.PL may produce erroneous results.
You can use "perl Makefile.PL -V X.Y.Z" to specify a your client version.
Oracle version 8.0.0.0 (8.0)
DBD::Oracle no longer supports Oracle client versions before 9.2
Try a version before 1.25 for 9 and 1.18 for 8! at Makefile.PL line 175.
I've triple checked that I've downloaded and installed the proper 64-bit drivers from Oracle. I also checked to make sure that I'm running 64-bit Perl.
perl MakeFile.pl -V 10.2.0.4
编译完成,但在运行“make”时收到错误消息:
Oracle.c:2267: error: ‘SQLT_BIN’ undeclared (first use in this function)
Oracle.c:2277: error: ‘SQLCS_NCHAR’ undeclared (first use in this function)
Oracle.c:2281: error: ‘SQLT_INT’ undeclared (first use in this function)
Oracle.c:2283: error: ‘OCI_FETCH_PRIOR’ undeclared (first use in this function)
Oracle.c:2287: error: ‘OCI_FETCH_NEXT’ undeclared (first use in this function)
lipo: can't open input file: /var/tmp//ccyIFLPN.out (No such file or directory)
make: *** [Oracle.o] Error 1
我意识到这是由于需要从Makefile中删除“-arch ppc”参数,但即使删除了所有32位引用,我仍然看到错误消息。
使用Oracle Driver版本10.2.0.4运行10.6.8 Snow Leopard
我发现解决此问题的关键是确保MakeFile.pl可以找到Oracle版本。
我遇到的问题是Safari从Oracle.com下载zip文件,但解压缩它们并以某种方式破坏库。
相反,我使用了不同的浏览器,并将所有zip文件下载到一个目录中。 然后我运行了以下tar命令:
tar -xf instantclient-basic-10.2.0.4.0-macosx-x64.zip
tar -xf instantclient-sdk-10.2.0.4.0-macosx-x64.zip
tar -xf instantclient-sqlplus-10.2.0.4.0-macosx-x64.zip
将“instantclient_10_2”文件夹中的所有内容复制到先前设置的$ORACLE_HOME目录中
sudo cp -R instantclient_10_2/* $ORACLE_HOME
请不要在您的计算机上重新创建与客户端库包装程序相同的目录结构。
不要执行 mkdir -p /b/227/rdbms/
使用MacOSX库头文件管理工具: otool
和 install_name_tool
例如,我已将库头文件更新为我的部署架构:
otool -L /usr/oracle_instantclient/11.2.0.3.0-64-bit/libclntsh.dylib.11.1
/usr/oracle_instantclient/11.2.0.3.0-64-bit/libclntsh.dylib.11.1:
/ade/b/2649109290/oracle/rdbms/lib/libclntsh.dylib.11.1 (compatibility version 0.0.0, current version 0.0.0)
/ade/b/2649109290/oracle/ldap/lib/libnnz11.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.1.0)
install_name_tool -id /usr/oracle_instantclient/11.2.0.3.0-64-bit/libclntsh.dylib.11.1 \
-change /ade/b/2649109290/oracle/ldap/lib/libnnz11.dylib /usr/oracle_instantclient/11.2.0.3.0-64-bit/libnnz11.dylib /usr/oracle_instantclient/11.2.0.3.0-64-bit/libclntsh.dylib.11.1
otool -L /usr/oracle_instantclient/11.2.0.3.0-64-bit/libclntsh.dylib.11.1
/usr/oracle_instantclient/11.2.0.3.0-64-bit/libclntsh.dylib.11.1:
/usr/oracle_instantclient/11.2.0.3.0-64-bit/libclntsh.dylib.11.1 (compatibility version 0.0.0, current version 0.0.0)
/usr/oracle_instantclient/11.2.0.3.0-64-bit/libnnz11.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.1.0)
otool -L adrci
otool -L genezi
otool -L libclntsh.dylib.11.1
otool -L libheteroxa11.dylib
otool -L libnnz11.dylib
otool -L libocci.dylib.11.1
otool -L libociei.dylib
otool -L libocijdbc11.dylib
otool -L libsqlplus.dylib
otool -L libsqlplusic.dylib
otool -L sqlplus
otool -L uidrvci
export DYLD_LIBRARY_PATH
,因为您知道如何设置系统。cd /usr/lib
ln -s ../oracle_instantclient/11.2.0.3.0-64-bit/libclntsh.dylib.11.1 .
ln -s ../oracle_instantclient/11.2.0.3.0-64-bit/libclntsh.dylib.11.1 libclntsh.dylib
ln -s ../oracle_instantclient/11.2.0.3.0-64-bit/libheteroxa11.dylib .
ln -s ../oracle_instantclient/11.2.0.3.0-64-bit/libnnz11.dylib .
ln -s ../oracle_instantclient/11.2.0.3.0-64-bit/libocci.dylib.11.1 .
ln -s ../oracle_instantclient/11.2.0.3.0-64-bit/libocci.dylib.11.1 libocci.dylib
ln -s ../oracle_instantclient/11.2.0.3.0-64-bit/libociei.dylib .
ln -s ../oracle_instantclient/11.2.0.3.0-64-bit/libocijdbc11.dylib .
ln -s ../oracle_instantclient/11.2.0.3.0-64-bit/libsqlplus.dylib .
ln -s ../oracle_instantclient/11.2.0.3.0-64-bit/libsqlplusic.dylib .