GCC --enable-auto-import problem

Václav Haisman v.haisman@sh.cvut.cz
Fri Jun 5 16:50:00 GMT 2009


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Huang Bambo wrote, On 5.6.2009 3:02:
> In cygwin 1.7:
> 
> 1. download db-4.7.25 from oracle at
> http://www.oracle.com/database/berkeley-db/index.html (havn't tested
> on other version)
> 2. configure like : ../dist/configure --prefix=/home/Bambo/db-for-1.7
> --enable-cxx --enable-pthread_api
> 3. make, it will take you a few minutes
> 4. write a program like :
> #include <db_cxx.h>
> 
> int main( void )
> {
>        Db db( NULL, 0 );
>        return 0;
> }
> 
> 5.compile like :g++ -o t test.cpp -L/home/Bambo/db-for-1.7/lib
> -ldb_cxx -I/home/Bambo/db-for-1.7/include
> will compile and link ok with information:
> Info: resolving typeinfo for std::exception by linking to
> __imp___ZTISt9exception (auto-import)
> /usr/lib/gcc/i686-pc-cygwin/4.3.2/../../../../i686-pc-cygwin/bin/ld:
> warning: auto-importing has been activated without
> --enable-auto-import specified on the command line.
> This should work unless it involves constant data structures
> referencing symbols from auto-imported DLLs.
> 
> and the file t.exe can't run, direct run in windows command shell will
> report "can't load" with error code 0x00000005.
> ( use:"ldd t.exe" to find dlls used by the file will hung ldd)
> 
> 6.compile like:g++ -o t test.cpp -L/home/Bambo/db-for-1.7/lib -ldb_cxx
> -I/home/Bambo/db-for-1.7/include -Wl,--enable-auto-import
> Then everything goes fine.
> ldd t.exe will report:
> 
> $ ldd t.exe
>        ntdll.dll => /cygdrive/c/WINDOWS/system32/ntdll.dll (0x7c920000)
>        kernel32.dll => /cygdrive/c/WINDOWS/system32/kernel32.dll (0x7c800000)
>        cygwin1.dll => /usr/bin/cygwin1.dll (0x61000000)
>        ADVAPI32.DLL => /cygdrive/c/WINDOWS/system32/ADVAPI32.DLL (0x77da0000)
>        RPCRT4.dll => /cygdrive/c/WINDOWS/system32/RPCRT4.dll (0x77e50000)
>        Secur32.dll => /cygdrive/c/WINDOWS/system32/Secur32.dll (0x77fc0000)
>        cyggcc_s-1.dll => /usr/bin/cyggcc_s-1.dll (0x67f00000)
>        cygstdc++-6.dll => /usr/bin/cygstdc++-6.dll (0x6c480000)
> 
> 
> Who can tell me why??? Everything goes fine under cygwin 1.5 with
> gcc3(gcc4 not tested), even
> without "-Wl,--enable-auto-import"
This is a known problem. The explanation is rather technical and long, IIRC.
Just use -Wl,--enable-auto-import for all GCC 4.3 compiled code and you are fine.

- --
VH
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)

iFYEAREIAAYFAkopTLkACgkQhQBMvHf/WHn+QADfZdJ2NcGAByHR0/ci1VPbHV4T
4hk3rxUlHl6ObADg2K6ViJnTxXfC+n5PhGR24BB9SkN4sJgv47fmjg==
=1zce
-----END PGP SIGNATURE-----

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list