Subject: | DBD-Sybase build under 32/64 Cygwin patch |
The Cygwin part of the Makefile.PL is not working correctly since the 15.0 version of Sybase.
The libraries naming convention has changed, i.e., from libct.dll to libsybct.dll.
In addition, the Cygwin build requires lib*.a files, that are a shim for linking a code processed by gcc toolkit to the Windows shared libraries .dll files. The 64 and 32 bit lib versions do require slightly different treatment from the nm/dlltool commands processing.
To alleviate those problems, two items are suggested.
1. Makefile.PL patch implements correct support of all Sybase version libraries as well as 32 and 64 bit compilation/linking for the Cygwin platform.
diff -u Makefile.PL.orig/Makefile.PL Makefile.PL>Makefile.patch
--- Makefile.PL.orig/Makefile.PL 2012-10-26 20:11:54.000000000 +0100
+++ Makefile.PL 2014-03-05 15:10:35.008288200 +0000
@@ -197,8 +197,18 @@
"-L$SYBASE/lib -llibct.olb -llibcs.olb -llibtcl.olb -llibcomn.olb -llibintl.olb -llibblk.olb $attr{EXTRA_LIBS}";
}
elsif ( $^O =~ /cygwin/ ) {
- $lib_string = "-L$SYBASE/lib -lct -lcs -lblk";
- $inc_string .= " -D_MSC_VER=800";
+ $inc_string .= " -D_MSC_VER=800";
+ my $bits64 = "";
+ if ($Config{ptrsize} == 8){
+ $bits64 = 64;
+ $inc_string .= " -DSYB_LP64";
+ }
+ if ($version ge '15') {
+ $lib_string = "-L$SYBASE/lib -lsybct$bits64 -lsybcs$bits64 -lsybblk$bits64";
+ }
+ else {
+ $lib_string = "-L$SYBASE/lib -lct$bits64 -lcs$bits64 -lblk$bits64";
+ }
}
else {
2. The makecygwinlibs.sh script is an external script that generates lib*.a files for gcc Cygwin build process. The script is an incremental improvement of the original command lines that Michael P. has used originally to generate *.a files posted at his site.
The patches were successfully used for the DBD Sybase Cygwin builds with both 32 and 64 bit Cygwin Perl binaries.
Bonus point.
If an error message "the context allocation routine failed when it tried to load localization files!!" is received when you try to run DBD-Sybase, i.e. by running :
$ perl -e 'use DBD::Sybase; print $DBD::Sybase::VERSION;'
you get:
The context allocation routine failed when it tried to load localization files!!
One or more following problems may caused the failureā¦.
The problem is that the Cygwin runtime is not correctly passes along the system environment variables and thus the Sybase driver cannot locate Sybase system files.
The solution is to execute a windows setx command that creates user-level env variable that Cygwin/perl runtime can successfully process.
$ setx SYBASE $SYBASE
Best regards
Yuriy
Subject: | makecygwinlibs.sh |
Message body not shown because it is not plain text.