【问题标题】:Using Ubuntu, how do I install DBD::Sybase from CPAN?使用 Ubuntu,如何从 CPAN 安装 DBD::Sybase?
【发布时间】:2013-07-23 00:35:17
【问题描述】:

每当我尝试构建 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 系统上也遇到过这个错误。

【问题讨论】:

    标签: sql-server perl sybase freetds dbd


    【解决方案1】:

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

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

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

    The first option can not be done without some hacking and the author will not fix it.他只是头脑简单,想修复内部结构以匹配他使用的操作系统,而不是让它接受其他配置。

    在内部DBD::Sybase 期望有一个目录和一个$libdir(带有liblib64 的子目录)。 DBD::Sybase 正确构建所需的目录不是由 Debian 软件包 freetds-dev 提供的; Debian 软件包安装到 /usr/include,它没有 liblib64 子目录。您可以通过欺骗make 并重新创建该结构来解决此问题,首先确保您已安装freetds-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
    

    中提琴。

    【讨论】:

    • 在 OS X 上,您需要修复一个愚蠢的错误。编辑 Makefile.pl 并注释掉 @libdir = ('dll'); 因为 /win/ 匹配 "darwin" :(
    【解决方案2】:

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

    $ sudo apt-get install libdbd-sybase-perl
    

    应该可以解决问题。

    【讨论】:

    • 这并不是说你的想法行不通,而是一些 perl 用户不想要很多旧的和过时的发行版提供的 perl 模块,这样他们就可以使用他们需要的一个模块。
    • @EvanCarroll 在您回答中的链接之后,我了解您的实际问题。对错误报告做出反应的方式多么糟糕。我将在这里留下我的答案,因为它显示了诉诸发行包的“简单”方式,即使它非常不理想。
    • 谢谢,我也很感激你称它为一种糟糕的方式来回答错误报告(就是这样)。当一个问题困扰您 5 年,并且每次您尝试提交相同的错误报告只是为了在被拒绝的垃圾箱中发现它已经存在时,这很可悲。哦,好吧,在 StackOverflow 上自行回答这些问题将使我下次在 Google 上的工作更轻松。
    【解决方案3】:

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

    mkdir /tmp/freetds/include
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-11-16
      • 2017-04-01
      • 1970-01-01
      • 2015-03-27
      • 2017-06-23
      相关资源
      最近更新 更多