Question

J'essaie d'utiliser Perl ODBC pour me connecter à un serveur Microsoft SQL. Mon problème est que Perl 5.10.0 a un problème d’utilisation du pilote ODBC Win32.

Si je lance un shell Perl et exécute cette ligne, des erreurs se produisent.

use Win32::ODBC;

Can't load '/usr/lib/perl5/vendor_perl/5.10/i686-cygwin/auto/Win32/ODBC/ODBC.dll'
for module Win32::ODBC: No such file or directory at
/usr/lib/perl5/5.10/i686-cygwin/DynaLoader.pm line 201.

J'ai vérifié que le fichier dll existe.

J'ai installé les packages Cygwin:

  • perl (5.10.0-5)
  • perl-libwin32 (0.28-2)
Était-ce utile?

La solution

Cela semble être un problème connu . . Saisissez la la source libiodbc , appliquez ce qui suit corrigez, compilez et installez:

diff -ub  libiodbc-3.52.6/include/iodbcunix.h.orig
--- libiodbc-3.52.6/include/iodbcunix.h.orig        2006-01-26 09:50:59.000000000 +0000
+++ libiodbc-3.52.6/include/iodbcunix.h     2007-12-24 19:33:57.859375000 +0000
@@ -124,6 +124,7 @@
 #if defined (OBSOLETE_WINDOWS_TYPES)
 typedef unsigned char              BYTE;
 #endif
+#ifndef WIN32
 typedef unsigned short             WORD;
 typedef unsigned int               DWORD;
 typedef char *                     LPSTR;
@@ -131,6 +132,7 @@         
 typedef wchar_t *          LPWSTR; 
 typedef const wchar_t *            LPCWSTR;
 typedef DWORD *                    LPDWORD;
+#endif

 #if !defined(BOOL) && !defined(_OBJC_OBJC_H_)
 typedef int                        BOOL;

MISE À JOUR: les collaborateurs de Cygwin disposent d'un TODO pour cela. numéro , mais il a plusieurs mois maintenant. Si l'attente est trop longue, vous pouvez la simuler d'ici là:

#! /bin/bash

# run from the libiodbc build directory

gcc -shared -o cygiodbc-2.dll \
    -Wl,--out-implib=libcygiodbc-2.dll.a \
    -Wl,--export-all-symbols \
    -Wl,--enable-auto-import \
    -Wl,--whole-archive iodbc/.libs/libiodbc.a \
    -Wl,--no-whole-archive

gcc -shared -o cygiodbcinst-2.dll \
    -Wl,--out-implib=libcygiodbcinst-2.dll.a \
    -Wl,--export-all-symbols \
    -Wl,--enable-auto-import \
    -Wl,--whole-archive iodbcinst/.libs/libiodbcinst.a \
    -Wl,--no-whole-archive

cp cygiodbc{,inst}-2.dll /bin

Autres conseils

  

J'ai vérifié que le fichier dll existe.

Voulez-vous dire que /usr/lib/perl5/vendor_perl/5.10/i686-cygwin/auto/Win32/ODBC/ODBC.dll existe? Si oui, avez-vous lu et exécuté l'autorisation?

Il y a un commentaire juste au-dessus de /usr/lib/perl5/5.10/i686-cygwin/DynaLoader.pm ligne 201:

# Many dynamic extension loading problems will appear to come from
# this section of code: XYZ failed at line 123 of DynaLoader.pm.
# Often these errors are actually occurring in the initialisation
# C code of the extension XS file. Perl reports the error as being
# in this perl code simply because this was the last perl code
# it executed.

Il semble donc que quelque chose ne va pas avec votre installation. Vous pouvez essayer de réinstaller Win32 :: ODBC avec:

$ cpan Win32::ODBC
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top