Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

DBD::Sybase - 'make' fails because of incompatible shared object(.so)

by fire_blade (Initiate)
on Sep 25, 2015 at 08:02 UTC ( [id://1142982]=perlquestion: print w/replies, xml ) Need Help??

fire_blade has asked for the wisdom of the Perl Monks concerning the following question:

I am new to perl. I want to write a script to connect to Sybase ASE. I am using a 64 bit linux machine(Linux 2.6.18-194.11.1.el5 x86_64) and i have installed a 64 bit Sybase ASE which is up and running. Now, to write a perl script to connect to ASE, i want DBD::Sybase. While installing it is failing during 'make' with the following error -
perl -MCPAN -e 'install DBD::Sybase' . . . Checking if your kit is complete... Looks good Using DBI 1.634 (for perl 5.008003 on x86_64-linux) installed in /opt/ +perl-5.8.3-24/lib/site_perl/5.8.3/x86_64-linux/auto/DBI/ Writing Makefile for DBD::Sybase cp dbd-sybase.pod blib/lib/DBD/dbd-sybase.pod cp Sybase.pm blib/lib/DBD/Sybase.pm /opt/perl-5.8.3-24/bin/perl -p -e "s/~DRIVER~/Sybase/g" /opt/perl-5.8. +3-24/lib/site_perl/5.8.3/x86_64-linux/auto/DBI/Driver.xst > Sybase.xs +i /opt/perl-5.8.3-24/bin/perl /opt/perl-5.8.3-24/lib/5.8.3/ExtUtils/xsub +pp -typemap /opt/perl-5.8.3-24/lib/5.8.3/ExtUtils/typemap Sybase.xs + > Sybase.xsc && mv Sybase.xsc Sybase.c cc -c -I/opt/sap/OCS-16_0/include -I/opt/perl-5.8.3-24/lib/site_perl/ +5.8.3/x86_64-linux/auto/DBI -I/usr/include/gdbm -fno-strict-aliasing +-I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 - +fPIC -DVERSION=\"1.15\" -DXS_VERSION=\"1.15\" -fpic "-I/opt/perl-5. +8.3-24/lib/5.8.3/x86_64-linux/CORE" Sybase.c cc -c -I/opt/sap/OCS-16_0/include -I/opt/perl-5.8.3-24/lib/site_perl/ +5.8.3/x86_64-linux/auto/DBI -I/usr/include/gdbm -fno-strict-aliasing +-I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 - +fPIC -DVERSION=\"1.15\" -DXS_VERSION=\"1.15\" -fpic "-I/opt/perl-5. +8.3-24/lib/5.8.3/x86_64-linux/CORE" dbdimp.c dbdimp.c: In function ‘syb_st_execute’: dbdimp.c:3906: warning: passing argument 2 of ‘ct_results’ from incomp +atible pointer type dbdimp.c:3930: warning: passing argument 5 of ‘ct_bind’ from incompati +ble pointer type Running Mkbootstrap for DBD::Sybase () chmod 644 Sybase.bs rm -f blib/arch/auto/DBD/Sybase/Sybase.so LD_RUN_PATH="/opt/sap/OCS-16_0/lib" cc -L/opt/sap/OCS-16_0/lib -share +d -L/usr/local/lib64 -L/lib64 -L/usr/lib64 Sybase.o dbdimp.o -o blib +/arch/auto/DBD/Sybase/Sybase.so \ -L/opt/sap/OCS-16_0/lib -lsybct -lsybcs -lsybtcl -lsybcomn -lsy +bintl -lsybblk -ldl -lm \ /usr/bin/ld: skipping incompatible /opt/sap/OCS-16_0/lib/libsybct.so w +hen searching for -lsybct /usr/bin/ld: skipping incompatible /opt/sap/OCS-16_0/lib/libsybct.so w +hen searching for -lsybct /usr/bin/ld: cannot find -lsybct collect2: ld returned 1 exit status make: *** [blib/arch/auto/DBD/Sybase/Sybase.so] Error 1 /usr/bin/make -- NOT OK Running make test Can't test without successful make Running make install make had returned bad status, install seems impossible
'perl -v' gives the following output -
This is perl, v5.8.3 built for x86_64-linux Copyright 1987-2003, Larry Wall Perl may be copied only under the terms of either the Artistic License + or the GNU General Public License, which may be found in the Perl 5 source ki +t. Complete documentation for Perl, including FAQ lists, should be found +on this system using `man perl' or `perldoc perl'. If you have access to + the Internet, point your browser at http://www.perl.com/, the Perl Home Pa +ge.
Unable to figure out a fix for this error. Please help!

Replies are listed 'Best First'.
Re: DBD::Sybase make fails because of incompatible shared object(.so)
by Anonymous Monk on Sep 25, 2015 at 08:15 UTC
      Thanks!

      I went through the link you shared and there somebody suggested to add the following -

      You might need this "add -DSYB_LP64" in the Makefile for 64-bit.

      So i modified the following in Makefile, not sure if this what he meant -

      EXTRALIBS = -L/opt/sap/OCS-16_0/lib -lsybct -lsybcs -lsybtcl -lsybcomn + -lsybintl -lsybblk -DSYB_LP64 LDLOADLIBS = -L/opt/sap/OCS-16_0/lib -lsybct -lsybcs -lsybtcl -lsybcom +n -lsybintl -lsybblk -ldl -lm -DSYB_LP64
      But it didn't work.

      How to set LP64 flag in Makefile.PL? Not sure where to enable LP64. Also, I tried modifying the CONFIG file which is placed in the same folder where Makefile.PL and added "BUILD_TYPE=64" even that didn't work.

      Though i was able to by-pass the error using a dirty hack, which is by replacing all the .so file with 64 bit version of .so file and the make went through fine. During "make test" half of the test failed and "make install" succeeded. And my perl script also compiled.

      But still i want to know the right way to fix this.

        Matching the Makefile is a good approach if you don't find the place in Makefile.PL where the libraries and command line switches are added.

        From your description it seems as if you only added -DSYS_LP64 but omitted -llibsybtcl64. Most likely, you will also need to remove -lsybctl .

        My guess is that you will need to change all mentions of -lsyb* to -lsyb*64 so the build process picks up the 64-bit versions of the libraries.

        So did you check which files are 64 bit versions (like libsybtcl64 ) and make sure they're added to LIBS of ExtUtils::MakeMaker?

        Also, in addition to what corion said, in the sybase Makefile.PL, it tries to determine when to add -DSYB_LP64 and when to omit it .... so you can also simply edit Makefile.PL right before WriteMakefile() to make the changes you need, this survives make clean

Re: DBD::Sybase make fails because of incompatible shared object(.so)
by Anonymous Monk on Sep 25, 2015 at 08:17 UTC
    Seeing how you're dealing with the system perl, use the system tools, so maybe sudo apt-get install libdbd-sybase-perl -y or yum...

      Good news :), I tried one more thing today, which is upgrading my perl from 5.8 to 5.14 and then i tried installing DBD::Sybase.

      But along with that prior installing i did 2 things -

      First - source /opt/sap/SYBASE.sh ## This make sure the required {ENV} variabl +es are set like $SYBASE etc Second, i read somewhere that DBD::Sybase require $PERL5LIB to be set +- export PERL5LIB=$SYBASE/$SYBASE_OCS/perl/sybaseperl_64r/lib/lib:$SYBAS +E/$SYBASE_OCS/perl/sybaseperl_64r/lib/arch:$SYBASE/$SYBASE_OCS/perl/s +ybaseperl_64r/lib

      After doing the above export & source the installation was smooth, it picked automatically the 64 bit .so files, even the 'make test' passed which was not the case when i tried with perl 5.8

      [root@idcbuildbox268 sybase_playground]# perl -MCPAN -e 'install DBD:: +Sybase' Going to read '/root/.cpan/Metadata' Database was generated on Mon, 28 Sep 2015 17:17:02 GMT Running install for module 'DBD::Sybase' Running make for M/ME/MEWP/DBD-Sybase-1.15.tar.gz Checksum for /root/.cpan/sources/authors/id/M/ME/MEWP/DBD-Sybase-1.15. +tar.gz ok CPAN.pm: Going to build M/ME/MEWP/DBD-Sybase-1.15.tar.gz Unknown Client Library version - assuming FreeTDS. By default DBD::Sybase 1.05 and later use the 'CHAINED' mode (where av +ailable) when 'AutoCommit' is turned off. Versions 1.04 and older instead manag +ed the transactions explicitly with a 'BEGIN TRAN' before the first DML statement. Using the 'CHAINED' mode is preferable as it is the way tha +t Sybase implements AutoCommit handling for both its ODBC and JDBC drive +rs. Use 'CHAINED' mode by default (Y/N) [Y]: Running in 64bit mode - looking for '64' libraries... Found -lsybct64 for -lsybct Found -lsybcs64 for -lsybcs Found -lsybtcl64 for -lsybtcl Found -lsybcomn64 for -lsybcomn Found -lsybintl64 for -lsybintl Found -lsybblk64 for -lsybblk BLK api available - found: sybblk64 The DBD::Sybase module need access to a Sybase server to run the tests +. To clear an entry please enter 'undef' Sybase server to use (default: SYBASE): IDCBUILDBOX268 User ID to log in to Sybase (default: sa): sa Password (default: undef): sybase123 Sybase database to use on IDCBUILDBOX268 (default: undef): ariba1 * Writing login information, including password, to file PWD. Checking if your kit is complete... Looks good Using DBI 1.634 (for perl 5.014000 on x86_64-linux) installed in /usr/ +local/lib/perl5/site_perl/5.14.0/x86_64-linux/auto/DBI/ Writing Makefile for DBD::Sybase Writing MYMETA.yml cp dbd-sybase.pod blib/lib/DBD/dbd-sybase.pod cp Sybase.pm blib/lib/DBD/Sybase.pm /usr/local/bin/perl -p -e "s/~DRIVER~/Sybase/g" /usr/local/lib/perl5/s +ite_perl/5.14.0/x86_64-linux/auto/DBI/Driver.xst > Sybase.xsi /usr/local/bin/perl /usr/local/lib/perl5/5.14.0/ExtUtils/xsubpp -type +map /usr/local/lib/perl5/5.14.0/ExtUtils/typemap Sybase.xs > Sybase. +xsc && mv Sybase.xsc Sybase.c cc -c -I/opt/sap/OCS-16_0/include -DSYB_LP64 -I/usr/local/lib/perl5/s +ite_perl/5.14.0/x86_64-linux/auto/DBI -fno-strict-aliasing -pipe -fst +ack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET +_BITS=64 -O2 -DVERSION=\"1.15\" -DXS_VERSION=\"1.15\" -fPIC "-I/usr +/local/lib/perl5/5.14.0/x86_64-linux/CORE" Sybase.c cc -c -I/opt/sap/OCS-16_0/include -DSYB_LP64 -I/usr/local/lib/perl5/s +ite_perl/5.14.0/x86_64-linux/auto/DBI -fno-strict-aliasing -pipe -fst +ack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET +_BITS=64 -O2 -DVERSION=\"1.15\" -DXS_VERSION=\"1.15\" -fPIC "-I/usr +/local/lib/perl5/5.14.0/x86_64-linux/CORE" dbdimp.c Running Mkbootstrap for DBD::Sybase () chmod 644 Sybase.bs rm -f blib/arch/auto/DBD/Sybase/Sybase.so LD_RUN_PATH="/opt/sap/OCS-16_0/lib" cc -L/opt/sap/OCS-16_0/lib -share +d -O2 -L/usr/local/lib -fstack-protector Sybase.o dbdimp.o -o blib/a +rch/auto/DBD/Sybase/Sybase.so \ -L/opt/sap/OCS-16_0/lib -lsybct64 -lsybcs64 -lsybtcl64 -lsybcom +n64 -lsybintl64 -lsybblk64 -ldl -lm \ chmod 755 blib/arch/auto/DBD/Sybase/Sybase.so cp Sybase.bs blib/arch/auto/DBD/Sybase/Sybase.bs chmod 644 blib/arch/auto/DBD/Sybase/Sybase.bs Manifying blib/man3/DBD::Sybase.3 MEWP/DBD-Sybase-1.15.tar.gz /usr/bin/make -- OK 'YAML' not installed, will not store persistent state Running make test ... ... ... ... Result: PASS MEWP/DBD-Sybase-1.15.tar.gz /usr/bin/make test -- OK Running make install Files found in blib/arch: installing files in blib/lib into architectu +re dependent library tree Installing /usr/local/lib/perl5/site_perl/5.14.0/x86_64-linux/auto/DBD +/Sybase/Sybase.so Installing /usr/local/lib/perl5/site_perl/5.14.0/x86_64-linux/auto/DBD +/Sybase/Sybase.bs Installing /usr/local/lib/perl5/site_perl/5.14.0/x86_64-linux/DBD/dbd- +sybase.pod Installing /usr/local/lib/perl5/site_perl/5.14.0/x86_64-linux/DBD/Syba +se.pm Installing /usr/local/share/man/man3/DBD::Sybase.3 Appending installation info to /usr/local/lib/perl5/5.14.0/x86_64-linu +x/perllocal.pod MEWP/DBD-Sybase-1.15.tar.gz /usr/bin/make install -- OK

      Not sure whether this was because of Perl 5.14 upgrade or because of the PERL5LIB env variable or combination :)

      Also, the linux machine on which i was trying is a VM provided to the developers, so it can be that perl was copied instead of compiling & installing. When i upgraded i compiled on the vm and installed, i guess that might also make a difference

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1142982]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (4)
As of 2024-04-23 22:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found