如何在OSX Snow Leopard 10.6上安装perl DBD :: Oracle [英] How do you install perl DBD::Oracle on OSX Snow Leopard 10.6

查看:93
本文介绍了如何在OSX Snow Leopard 10.6上安装perl DBD :: Oracle的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从运行OSX 10.6雪豹的Intel Mac连接到远程系统上的Oracle 10.2.0.4.我尝试使用perl CPAN安装DBD :: Oracle(DBI正常工作),但是出现编译错误.有人可以提供易于遵循的指南吗?

I'm trying to connect to Oracle 10.2.0.4 on a remote system from my intel mac running OSX 10.6 snow leopard. I've tried using perl CPAN to install DBD::Oracle (DBI worked ok) but get compilation errors. Could someone provide an easy to follow guide?

推荐答案

要在Mac上安装perl以使其与oracle很好地配合会有点麻烦-一旦运行,那就太棒了,让它运行起来有点令人沮丧.

Getting a mac install of perl to play nicely with oracle is a bit of a pain - once it's running it is fantastic, getting it running is a little frustrating..

以下内容对我来说适用于一些不同的Intel Mac,其中可能有多余的步骤,其他平台可能会有所不同.

The below has worked for me on a few different intel macs, there could well be superfluous steps in there and it is likely not going to be the same for other platforms.

这将需要使用shell,root用户和一些CPANing-没什么麻烦

This will require use of shell, the root user and a bit of CPANing - nothing too onerous

首先为oracle pap创建目录-库,即时客户端等

First off create a directory for the oracle pap - libraries, instant client etc

sudo mkdir /usr/oracle_instantClient64

oracle 到以上目录

在该目录中为其中的文件之一创建符号链接

Create a symlink within that directory for one of the files in there

sudo cd /usr/oracle_instantClient64
sudo ln -s /usr/oracle_instantClient64/libclntsh.dylib.10.1 libclntsh.dylib

以下目录被硬编码到oracle即时客户端中-天知道为什么-因此需要创建它并对其进行符号链接

The following dir is hardcoded into the oracle instant client - god knows why - so need to create and symlink it

sudo mkdir -p /b/227/rdbms/
sudo cd /b/227/rdbms/
sudo ln -s /usr/oracle_instantClient64/ lib

需要添加几个环境变量,因此请编辑/etc/profile并添加它们,以使它们对于所有用户都存在:

Need to add a couple of environment variables, so edit /etc/profile and add them so they exist for all users:

export ORACLE_HOME=/usr/oracle_instantClient64
export DYLD_LIBRARY_PATH=/usr/oracle_instantClient64

现在尝试通过CPAN安装DBD :: Oracle-这将失败,但是这意味着将下载所有依赖项并为我们检索模块

Now try and install DBD::Oracle through CPAN - this will fail, but it means any dependencies will be downloaded and it retrieves the module for us

sudo perl -MCPAN -e shell
install DBD::Oracle

如果此操作失败,请退出CPAN并转到您的.cpan/build目录-如果您使用了CPAN的自动配置,它将是

When this fails exit CPAN and head to your .cpan/build dir - if you used automatic config of CPAN it'll be

cd ~/.cpan/build

如果您没有自动配置,则可以在CPAN中使用以下命令找到构建目录

if you didn't auto configure you can find your build directory with the following command in CPAN

o conf build_dir

在构建目录中查找刚刚创建的DBD :: Oracle目录(将其称为DBD-Oracle-1.28-?之类的东西),并将其插入CD.

Once in the build dir look for the DBD::Oracle dir which has just been created (it'll be called something like DBD-Oracle-1.28-?) and cd into it.

现在,我们需要切换到root用户.根未在osx中​​默认启用-有关启用的详细信息,请参见苹果网站

Now we need to switch to the root user. Root isn't enabled as default in osx - for details on enabling see this post on the apple website

以root身份登录后,我们需要为root设置上述环境变量:

Once logged in as root we need to set the above environment variables for root:

export ORACLE_HOME=/usr/oracle_instantClient64
export DYLD_LIBRARY_PATH=/usr/oracle_instantClient64

现在,当仍然以root用户身份登录时,我们需要为模块运行makefile,然后进行make,然后安装

Now while still logged in as root we need to run the makefile for the module, then make, then install

perl Makefile.pl
make
make install

假设所有操作均无错误,请从根目录注销:我们已完成DBD操作!如果这样做不起作用,是时候让Google解决您遇到的任何错误

Assuming that all worked without error log out of root: we're DBD'd up! If this didn't work it's time to bust out google on whatever errors you're seeing

现在只需安装DBI模块

Now just to install the DBI module

sudo perl -MCPAN -e shell
install DBI

现在,您已经准备好了-尽情享受充满神秘的新生活

Now you're all set - enjoy your perly oracley new life

来自user852637的其他信息:

Additional info from user852637:

  1. 此步骤的正确性

  1. Correction to this step

perl Makefile.pl
make
install

最后一步应该是make install

在制作过程中,您可能会遇到类似以下错误:

During make, you may encounter an error that looks like :

lipo:无法打开输入文件:/var/tmp//ccIevTzM.out(没有此类文件或目录)

lipo: can't open input file: /var/tmp//ccIevTzM.out (No such file or directory)

要解决此问题,您必须编辑在"perl Makefile.pl"步骤之后创建的文件"Makefile",并删除以下所有出现的文本:

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 

这将消除错误.

在安装DBI模块期间,将发生与(2.)中所述的相同错误.您必须编辑在perl Makefile.pl步骤之后创建的Makefile,并删除所有出现的以下文本:

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 

这篇关于如何在OSX Snow Leopard 10.6上安装perl DBD :: Oracle的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆