Win32 :: ODBC가 Perl 5.10 및 Cygwin에서 ODBC.dll을 찾지 않는 이유는 무엇입니까?

StackOverflow https://stackoverflow.com/questions/825672

문제

Perl ODBC를 사용하여 Microsoft SQL 서버에 연결하려고합니다. 내 문제는 Perl 5.10.0이 Win32 ODBC 드라이버를 사용하는 데 문제가 있다는 것입니다.

Perl Shell을 실행 하고이 한 줄을 실행하면 오류가 발생합니다.

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.

DLL 파일이 존재하는지 확인했습니다.

Cygwin 패키지를 설치했습니다.

  • Perl (5.10.0-5)
  • perl-libwin32 (0.28-2)
도움이 되었습니까?

해결책

이것은 a 알려진 문제. 잡기 libiodbc 소스, 다음 패치를 적용하고 빌드하고 설치하십시오.

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;

업데이트: Cygwin 사람들 이 문제에 대한 할머니가 있습니다, 그러나 지금은 몇 달이되었습니다. 기다리기가 너무 길면 그 동안 가짜가 될 수 있습니다.

#! /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

다른 팁

DLL 파일이 존재하는지 확인했습니다.

그걸 의미 한 것이 였니 /usr/lib/perl5/vendor_perl/5.10/i686-cygwin/auto/Win32/ODBC/ODBC.dll 존재합니까? 그렇다면 읽기 및 실행 허가가 있습니까?

/usr/lib/perl5/5.10/i686-cygwin/dynaloader.pm line 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.

따라서 설치에 문제가있는 것 같습니다. Win32 :: ODBC를 다시 설치할 수 있습니다.

$ cpan Win32::ODBC
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top