| delorie.com/archives/browse.cgi | search | 
| X-Recipient: | archive-cygwin AT delorie DOT com | 
| X-SWARE-Spam-Status: | No, hits=-2.0 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_PASS | 
| X-Spam-Check-By: | sourceware.org | 
| MIME-Version: | 1.0 | 
| In-Reply-To: | <f4d6f44b0906040220x43a62dddr33e784821d02471f@mail.gmail.com> | 
| References: | <f4d6f44b0906040220x43a62dddr33e784821d02471f AT mail DOT gmail DOT com> | 
| Date: | Fri, 5 Jun 2009 09:00:45 +0800 | 
| Message-ID: | <f4d6f44b0906041800y740b2819ub7fe3ea8f382707@mail.gmail.com> | 
| Subject: | GCC --enable-auto-import problem | 
| From: | Huang Bambo <bambo DOT huang AT gmail DOT com> | 
| To: | cygwin AT cygwin DOT com | 
| Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm | 
| List-Id: | <cygwin.cygwin.com> | 
| List-Unsubscribe: | <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com> | 
| List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> | 
| List-Archive: | <http://sourceware.org/ml/cygwin/> | 
| List-Post: | <mailto:cygwin AT cygwin DOT com> | 
| List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> | 
| Sender: | cygwin-owner AT cygwin DOT com | 
| Mail-Followup-To: | cygwin AT cygwin DOT com | 
| Delivered-To: | mailing list cygwin AT cygwin DOT com | 
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=3D/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 )
{
=A0 =A0 =A0 =A0Db db( NULL, 0 );
=A0 =A0 =A0 =A0return 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
=A0 =A0 =A0 =A0ntdll.dll =3D> /cygdrive/c/WINDOWS/system32/ntdll.dll (0x7c9=
20000)
=A0 =A0 =A0 =A0kernel32.dll =3D> /cygdrive/c/WINDOWS/system32/kernel32.dll =
(0x7c800000)
=A0 =A0 =A0 =A0cygwin1.dll =3D> /usr/bin/cygwin1.dll (0x61000000)
=A0 =A0 =A0 =A0ADVAPI32.DLL =3D> /cygdrive/c/WINDOWS/system32/ADVAPI32.DLL =
(0x77da0000)
=A0 =A0 =A0 =A0RPCRT4.dll =3D> /cygdrive/c/WINDOWS/system32/RPCRT4.dll (0x7=
7e50000)
=A0 =A0 =A0 =A0Secur32.dll =3D> /cygdrive/c/WINDOWS/system32/Secur32.dll (0=
x77fc0000)
=A0 =A0 =A0 =A0cyggcc_s-1.dll =3D> /usr/bin/cyggcc_s-1.dll (0x67f00000)
=A0 =A0 =A0 =A0cygstdc++-6.dll =3D> /usr/bin/cygstdc++-6.dll (0x6c480000)
Who can tell me why??? Everything goes fine under cygwin 1.5 with gcc
3,( gcc4 in cygwin 1.5 not tested), even
without "-Wl,--enable-auto-import"
--
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/
| webmaster | delorie software privacy | 
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |