Using Ubuntu, how do I install DBD::Sybase from CPAN?

孤街浪徒 提交于 2019-12-24 00:57:56

问题


Whenever I try to build DBD::Sybase to connect to MSSQL I get an error,

$ 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

I've also gotten this error on other Debian systems.


回答1:


There are two ways to do that,

  • (a) with the freetds that the distro provides
  • or, (b) installing the vanilla freetds upstream and building against that.

The second option (b) is always possible, but then your system may have two different versions of freetds.

The first option can not be done without some hacking and the author will not fix it. He is simply hard headed and wants to fix internal structures to match the OS he uses rather than making it accepting of other configurations.

Internally DBD::Sybase expects there to be a directory, and a $libdir (a subdirectory with lib or lib64). The directories DBD::Sybase requires to build properly are not provided by the Debian package freetds-dev; the Debian package installs to /usr/include which doesn't have a lib or a lib64 subdirectory. You can get around this by fooling make and recreating that structure, first make sure you have freetds-dev installed,

sudo apt-get install freetds-dev

Then link it to create a pseudo-package. On my 64 bit machine, it looks something like this.

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

Now, it should work and you can build DBD::Sybase against system libraries.

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

Viola.




回答2:


To install modules for the system perl, you can install the packages from the Ubuntu repositories. While these may be out of date, library dependencies are resolved aoutomatically. In this case, a

$ sudo apt-get install libdbd-sybase-perl

should do the trick.




回答3:


I believe you have to make the include subdirectory, otherwise the second ln will fail:

mkdir /tmp/freetds/include


来源:https://stackoverflow.com/questions/17818688/using-ubuntu-how-do-i-install-dbdsybase-from-cpan

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!