2

每当我尝试构建DBD::Sybase以连接到 MSSQL 时,都会出现错误,

$ sudo cpanp install DBD::Sybase


Installing DBD::Sybase (1.15)
Running [/usr/bin/perl /usr/bin/cpanp-run-perl /home/ecarroll/.cpanplus/5.14.2/build/DBD-Sybase-1.15/Makefile.PL INSTALLDIRS=site]...
Can't find any Sybase libraries in /etc/lib or /etc/lib64 at /home/ecarroll/.cpanplus/5.14.2/build/DBD-Sybase-1.15/Makefile.PL line 155, <IN> line 44.
BEGIN failed--compilation aborted at /usr/bin/cpanp-run-perl line 11, <IN> line 44.
[ERROR] Could not run '/usr/bin/perl Makefile.PL': Can't find any Sybase libraries in /etc/lib or /etc/lib64 at /home/ecarroll/.cpanplus/5.14.2/build/DBD-Sybase-1.15/Makefile.PL line 155, <IN> line 44.
BEGIN failed--compilation aborted at /usr/bin/cpanp-run-perl line 11, <IN> line 44.
 -- cannot continue

[ERROR] Unable to create a new distribution object for 'DBD::Sybase' -- cannot continue

*** Install log written to:
  /home/ecarroll/.cpanplus/install-logs/DBD-Sybase-1.15-1374605483.log

Error installing 'DBD::Sybase'
Problem installing one or more modules

我在其他 Debian 系统上也遇到了这个错误。

4

3 回答 3

10

有两种方法可以做到这一点,

  • (a) 使用发行版提供的 freetds
  • 或者,(b)在上游安装 vanilla freetds 并针对它进行构建。

第二个选项 (b) 总是可行的,但是您的系统可能有两个不同版本的 freetds。

如果没有一些黑客攻击,第一个选项就无法完成,作者不会修复它。他只是头脑简单,想要修复内部结构以匹配他使用的操作系统,而不是让它接受其他配置。

内部DBD::Sybase期望有一个目录和一个$libdir(带有libor的子目录lib64)。Debian 软件包未提供DBD::Sybase正确构建所需的目录;安装的 Debian 软件包没有 a或子目录。您可以通过欺骗和重新创建该结构来解决此问题,首先确保您已安装,freetds-dev/usr/includeliblib64makefreetds-dev

sudo apt-get install freetds-dev

然后链接它以创建一个伪包。在我的 64 位机器上,它看起来像这样。

mkdir /tmp/freetds
ln -s /usr/lib/x86_64-linux-gnu/ /tmp/freetds/lib64
ln -s /usr/include /tmp/freetds/include/freetds

现在,它应该可以工作了,您可以DBD::Sybase针对系统库进行构建。

sudo SYBASE=/tmp/freetds cpanp install DBD::Sybase

中提琴。

于 2013-07-23T19:35:18.763 回答
4

要为系统 perl 安装模块,您可以从 Ubuntu 存储库安装软件包。虽然这些可能已经过时,但库依赖关系会自动解决。在这种情况下,一个

$ sudo apt-get install libdbd-sybase-perl

应该做的伎俩。

于 2013-07-23T19:19:17.090 回答
2

我相信你必须创建include子目录,否则第二个ln会失败:

mkdir /tmp/freetds/include
于 2014-07-09T15:03:32.267 回答