X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Message-ID: <4A294CB9.9020902@sh.cvut.cz> Date: Fri, 05 Jun 2009 18:50:01 +0200 From: =?UTF-8?B?VsOhY2xhdiBIYWlzbWFu?= User-Agent: Thunderbird 2.0.0.21 (Windows/20090302) MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: GCC --enable-auto-import problem References: In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Reply-To: cygwin AT cygwin DOT com Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com -----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 > > 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/