in reply to Re^3: Installation of DBD::Sybase with Strawberry Perl
in thread Installation of DBD::Sybase with Strawberry Perl

Most of these libraries exist (and the few others are most likely not important indeed). I changed Makefile.PL to -lsybct (..), but got the same result. I set the LIBRARY_PATH then, which reduced the warnings I got from Makefile.PL to
Warning (mostly harmless): No library found for -lsybtcl Warning (mostly harmless): No library found for -lsybcomn Warning (mostly harmless): No library found for -lsybintl
This is much better, because these libraries are not installed by the Sybase driver, but gmake still results in
c:\Strawberry\cpan\build\DBD-Sybase-1.17-0>gmake Skip blib\lib\DBD\dbd-sybase.pod (unchanged) Skip blib\lib\DBD\Sybase.pm (unchanged) Running Mkbootstrap for Sybase () "C:\Strawberry\perl\bin\perl.exe" -MExtUtils::Command -e chmod -- 644 +"Sybase.bs" "C:\Strawberry\perl\bin\perl.exe" -MExtUtils::Command::MM -e cp_nonemp +ty -- Sybase.bs blib\arch\auto\DBD\Sybase\Sybase.bs 644 gcc -c -IC:\SAP/OCS-16_0/include -DNO_BLK=1 -IC:/Strawberry/perl/vend +or/lib/auto/DBI -DWIN32 -DWIN64 -D__USE_MINGW_ANSI_STDIO -DPERL_TEXTM +ODE_SCRIPTS -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO +-fwrapv -fno-strict-aliasing -mms-bitfields -s -O2 -DVERSION=\"1.17 +\" -DXS_VERSION=\"1.17\" "-IC:\STRAWB~1\perl\lib\CORE" Sybase.c In file included from C:\STRAWB~1\perl\lib\CORE/perl.h:5603, from C:/Strawberry/perl/vendor/lib/auto/DBI/DBIXS.h:2 +3, from Sybase.h:16, from Sybase.xs:14: Sybase.xs: In function 'XS_DBD__Sybase__db_ping': Sybase.xs:84:32: warning: implicit declaration of function 'syb_ping'; + did you mean 'syb_init'? [-Wimplicit-function-declaration] ST(0) = sv_2mortal(newSViv(syb_ping(dbh, imp_dbh))); ^~~~~~~~ C:\STRAWB~1\perl\lib\CORE/embed.h:557:46: note: in definition of macro + 'sv_2mortal' #define sv_2mortal(a) Perl_sv_2mortal(aTHX_ a) ^ Sybase.xs:84:24: note: in expansion of macro 'newSViv' ST(0) = sv_2mortal(newSViv(syb_ping(dbh, imp_dbh))); ^~~~~~~ Sybase.xs: In function 'XS_DBD__Sybase__st_cancel': Sybase.xs:96:13: warning: implicit declaration of function 'syb_st_can +cel'; did you mean 'syb_st_finish'? [-Wimplicit-function-declaration] ST(0) = syb_st_cancel(sth, imp_sth) ? &PL_sv_yes : &PL_sv_no; ^~~~~~~~~~~~~ syb_st_finish gcc -c -IC:\SAP/OCS-16_0/include -DNO_BLK=1 -IC:/Strawberry/perl/vend +or/lib/auto/DBI -DWIN32 -DWIN64 -D__USE_MINGW_ANSI_STDIO -DPERL_TEXTM +ODE_SCRIPTS -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO +-fwrapv -fno-strict-aliasing -mms-bitfields -s -O2 -DVERSION=\"1.17 +\" -DXS_VERSION=\"1.17\" "-IC:\STRAWB~1\perl\lib\CORE" dbdimp.c dbdimp.c: In function 'syb_st_execute': dbdimp.c:4076:39: warning: passing argument 2 of 'ct_results' from inc +ompatible pointer type [-Wincompatible-pointer-types] while (ct_results(imp_sth->cmd, &restype) == CS_SUCCEED && rest +ype != CS_CMD_DONE) { ^~~~~~~~ In file included from Sybase.h:19, from dbdimp.c:10: C:\SAP/OCS-16_0/include/ctpublic.h:381:10: note: expected 'CS_INT *' { +aka 'long int *'} but argument is of type 'int *' CS_INT *result_type ~~~~~~~~^~~~~~~~~~~ dbdimp.c:4101:75: warning: passing argument 5 of 'ct_bind' from incomp +atible pointer type [-Wincompatible-pointer-types] if( ct_bind(imp_sth->cmd, i+1, &phs->datafmt, SvPVX(phs-> +sv), &params[i].len, 0) != CS_SUCCEED ) + ^~~~~~~~~~~~~~ In file included from Sybase.h:19, from dbdimp.c:10: C:\SAP/OCS-16_0/include/ctpublic.h:117:10: note: expected 'CS_INT *' { +aka 'long int *'} but argument is of type 'int *' CS_INT *outputlen, ~~~~~~~~^~~~~~~~~ g++ Sybase.def -o blib\arch\auto\DBD\Sybase\Sybase.xs.dll -mdll -s -L" +C:\STRAWB~1\perl\lib\CORE" -L"C:\STRAWB~1\c\lib" Sybase.o dbdimp.o +"C:\STRAWB~1\perl\lib\CORE\libperl532.a" "c:\SAP\OCS-16_0\lib\libsybc +t.lib" "c:\SAP\OCS-16_0\lib\libsybcs.lib" "c:\SAP\OCS-16_0\lib\libsyb +blk.lib" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libm.a" "C:\STRAWB~1\c +\x86_64-w64-mingw32\lib\libmoldname.a" "C:\STRAWB~1\c\x86_64-w64-ming +w32\lib\libkernel32.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libuser3 +2.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libgdi32.a" "C:\STRAWB~1\c +\x86_64-w64-mingw32\lib\libwinspool.a" "C:\STRAWB~1\c\x86_64-w64-ming +w32\lib\libcomdlg32.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libadvap +i32.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libshell32.a" "C:\STRAWB +~1\c\x86_64-w64-mingw32\lib\libole32.a" "C:\STRAWB~1\c\x86_64-w64-min +gw32\lib\liboleaut32.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libneta +pi32.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libuuid.a" "C:\STRAWB~1 +\c\x86_64-w64-mingw32\lib\libws2_32.a" "C:\STRAWB~1\c\x86_64-w64-ming +w32\lib\libmpr.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libwinmm.a" " +C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libversion.a" "C:\STRAWB~1\c\x86 +_64-w64-mingw32\lib\libodbc32.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\li +b\libodbccp32.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libcomctl32.a" + -Wl,--enable-auto-image-base C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x8 +6_64-w64-mingw32/bin/ld.exe: dbdimp.o:dbdimp.c:(.text+0xd51): undefin +ed reference to `ct_options' C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x8 +6_64-w64-mingw32/bin/ld.exe: dbdimp.o:dbdimp.c:(.text+0xe15): undefin +ed reference to `ct_cmd_alloc' C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x8 +6_64-w64-mingw32/bin/ld.exe: dbdimp.o:dbdimp.c:(.text+0xef4): undefin +ed reference to `ct_config' C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x8 +6_64-w64-mingw32/bin/ld.exe: dbdimp.o:dbdimp.c:(.text+0xf34): undefin +ed reference to `ct_config' C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x8 +6_64-w64-mingw32/bin/ld.exe: dbdimp.o:dbdimp.c:(.text+0xfae): undefin +ed reference to `ct_con_alloc' C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x8 +6_64-w64-mingw32/bin/ld.exe: dbdimp.o:dbdimp.c:(.text+0xff1): undefin +ed reference to `ct_con_props' C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x8 +6_64-w64-mingw32/bin/ld.exe: dbdimp.o:dbdimp.c:(.text+0x1028): undefi +ned reference to `ct_con_props' C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x8 +6_64-w64-mingw32/bin/ld.exe: dbdimp.o:dbdimp.c:(.text+0x10be): undefi +ned reference to `ct_con_props' C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x8 +6_64-w64-mingw32/bin/ld.exe: dbdimp.o:dbdimp.c:(.text+0x114a): undefi +ned reference to `ct_con_props' C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x8 +6_64-w64-mingw32/bin/ld.exe: dbdimp.o:dbdimp.c:(.text+0x1188): undefi +ned reference to `ct_con_props' C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x8 +6_64-w64-mingw32/bin/ld.exe: dbdimp.o:dbdimp.c:(.text+0x11d4): more u +ndefined references to `ct_con_props' follow C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x8 +6_64-w64-mingw32/bin/ld.exe: dbdimp.o:dbdimp.c:(.text+0x12c3): undefi +ned reference to `cs_loc_alloc' C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x8 +6_64-w64-mingw32/bin/ld.exe: dbdimp.o:dbdimp.c:(.text+0x130c): undefi +ned reference to `cs_locale' C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x8 +6_64-w64-mingw32/bin/ld.exe: dbdimp.o:dbdimp.c:(.text+0x136f): undefi +ned reference to `cs_locale' C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x8 +6_64-w64-mingw32/bin/ld.exe: dbdimp.o:dbdimp.c:(.text+0x13d2): undefi +ned reference to `cs_locale' C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x8 +6_64-w64-mingw32/bin/ld.exe: dbdimp.o:dbdimp.c:(.text+0x1427): undefi +ned reference to `cs_dt_info' C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x8 +6_64-w64-mingw32/bin/ld.exe: dbdimp.o:dbdimp.c:(.text+0x14a9): undefi +ned reference to `ct_config' ... (und many more lines) ...
All these ct_.. functions are located in libsybct.lib, the cs_.. functions are located in libsybcs.lib.

Replies are listed 'Best First'.
Re^5: Installation of DBD::Sybase with Strawberry Perl
by syphilis (Archbishop) on Mar 10, 2021 at 03:01 UTC
    <UPDATE> I missed that you had effectively covered most of what I originally wrote in this post.
    If libsybct.lib and libsybcs.lib are in the path specified in LIBRARY_PATH then the reason they're not being linked in is that the name specified in the "-l..." switch is incorrect.
    If "-lsybct" is not working, try variations like "-llibsybct.lib", "-llibsybct", "-lsybct.lib" ... until you hit the rendition that works.

    If libsybct.lib and libsybcs.lib are not in the path specified in LIBRARY_PATH, then add that location to LIBRARY_PATH:
    set LIBRARY_PATH=%LIBRARY_PATH%;C:\path\to\libs;C:\path\to_other\libs
    AFAICS, the only issue is that there's still one or two libs that aren't being linked in.
    Perhaps there's another location that needs to be added to LIBRARY_PATH, or perhaps the wrong filename is being specified.

    You can identify those libraries by doing a plain text search of all lib files for the undefined references.
    It's a bit of a rough hack, but it has always worked fine for me. Once you've found the lib file that contains the string "ct_options", then you've probably found the lib file that will resolve that symbol.
    Similarly, for "ct_cmd_alloc", "ct_config", etc.
    My guess would be that there's one lib that resolves the undefined "ct_*" symbols and another that resolves the undefined "cs_*" symbols.
    Once you've established the name(s) and location(s) of the relevant lib(s), then you should hopefully have all the info needed for you to fix the problem.


    Cheers,
    Rob

      Rob, it's a static link: c:\SAP\OCS-16_0\lib\libsybct.lib

        Rob, it's a static link: c:\SAP\OCS-16_0\lib\libsybct.lib

        Yes, I hadn't noticed that.
        So how do we account for the presence of the undefined references, given that the pertinent libs appear to have been linked in ?
        I'm out of touch with considerations about using MSVC-produced libraries (which these apparently are) with MinGW toolchain.

        <AFTERTHOUGHT> Could it be that these '.lib' files are in fact import libs, not static libs ? In that case, they wouldn't resolve those specified "undefined references".

        Cheers,
        Rob
Re^5: Installation of DBD::Sybase with Strawberry Perl
by bliako (Abbot) on Mar 09, 2021 at 21:11 UTC

    In order to make sure that the library does contain function references use nm -a or some windows equivalent.

    But why does the Makefile runs the compiler with these 2 flags: -DWIN32 -DWIN64. They seem contradictory to me? If you are linking 32 bit libraries with 64 bit perl you are most likely have problems.

    bw, bliako

      But why does the Makefile runs the compiler with these 2 flags: -DWIN32 -DWIN64

      They're actually part of perl's ccflags:
      C:\perl -V:ccflags ccflags=' -DWIN32 -DWIN64 -D__USE_MINGW_ANSI_STDIO -DPERL_TEXTMODE_SCR +IPTS -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -fwrapv + -fno-strict-aliasing -mms-bitfields';

      WIN32 is a symbol that's defined on all Windows systems (both 32-bit and 64-bit). I don't think there's any need to specify it.
      Defining WIN64 specifies that you want to operate in 64-bit mode, and that the compiler is 64-bit..

      Cheers,
      Rob

        Oh ok thanks, so I understand that WIN32 has nothing to do with 32bit vs 64bit. It's just the presence or absence of WIN64 that does that. Then perhaps it is worth to check if sybase libs are 64bit as well although that may throw other error messages.