From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mumit Khan To: Chris Cc: "'wxwin-developers'" , cygwin Subject: Re: troubles while building wxWindows/C++ Mingw executables using Cygwin Date: Wed, 10 Mar 1999 11:18:00 -0000 Message-id: <199903101914.NAA26447@modi.xraylith.wisc.edu> In-reply-to: Your message of "Wed, 10 Mar 1999 10:50:40 +0100." < 36E64070.944A6B90@inria.fr > References: <36E64070.944A6B90@inria.fr> X-SW-Source: 1999-03/msg00329.html Chris writes: > Hi, > I'm trying to build wxWindows/C++ Mingw executables using Cygwin. > I've followed the instructions given by Mumit Khan : > * got egcs-1.1.1-mingw-libs.tar.gz > * installed the target libraries in /usr/local/mingw-libs > * add -mno-cygwin to gcc -c > * add -L/usr/local/mingw-libs to gcc -o > It works well with the small hello.c program (thanks Mumit, the tutorial > is clear and well done) Hi Chris, There are a (potential) minor pitfalls with both wxWindows makefiles and Cygwin -mno-cygwin support that is causing these. 1. /wx/src/msw/textctrl.cpp:71: undefined reference to `streambuf::xsputn(char const *, long)' ... When compiling C++ applications that use the libio stuff, you'll need to have a Mingw compatible _G_config.h. However, Cygwin b20.1 as distributed only supplies the _G_config.h for Cygwin and you're getting a mismatch. For Mingw, the above should be: `streambuf::xsputn(char const *, int)' ... Thanks for pointing this out. I'll add this to the mingw-libs package for egcs-1.1.2. I'm attaching a copy of _G_config.h for i386-mingw32 that should fix this. Just put it somewhere and point to the place with -I so that it picks this one instead of the installed one. 2. /usr/local/mingw-libs/libstdc++.a(iostream.o)(.text+0x18a9): undefined reference to `__imp__iob' /usr/local/mingw-libs/libstdc++.a(streambuf.o)(.text+0x30c): undefined reference to `_errno' The linker is picking the math library for Cygwin, not the empty stub used for Mingw. If you don't have a Mingw math library, you can create one as following: $ ar crv libm.a $ ranlib libm.a and then relink. This should certainly fix _errno problem; I'm hoping that it'll take care of the _imp_iob problem as well. Let me know if this doesn't fix your problem. The problems you're running into unfortunately a fact of life when you're trying to do cross (or pseudo-cross in this case ;-) compilation/linking. You'll probably have to do a bit more digging to make sure all the right includes and libraries are picked up instead of using the Cygwin ones. Regards, Mumit -- Want to unsubscribe from this list? Send a message to cygwin-unsubscribe@sourceware.cygnus.com From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mumit Khan To: Chris Cc: "'wxwin-developers'" , cygwin Subject: Re: troubles while building wxWindows/C++ Mingw executables using Cygwin Date: Wed, 31 Mar 1999 19:45:00 -0000 Message-ID: <199903101914.NAA26447@modi.xraylith.wisc.edu> References: <36E64070.944A6B90@inria.fr> X-SW-Source: 1999-03n/msg00329.html Message-ID: <19990331194500.nPVD2Q7U_4KAF_Bf759diqL8qhhW4ZVwui-z1WWkgS0@z> Chris writes: > Hi, > I'm trying to build wxWindows/C++ Mingw executables using Cygwin. > I've followed the instructions given by Mumit Khan : > * got egcs-1.1.1-mingw-libs.tar.gz > * installed the target libraries in /usr/local/mingw-libs > * add -mno-cygwin to gcc -c > * add -L/usr/local/mingw-libs to gcc -o > It works well with the small hello.c program (thanks Mumit, the tutorial > is clear and well done) Hi Chris, There are a (potential) minor pitfalls with both wxWindows makefiles and Cygwin -mno-cygwin support that is causing these. 1. /wx/src/msw/textctrl.cpp:71: undefined reference to `streambuf::xsputn(char const *, long)' ... When compiling C++ applications that use the libio stuff, you'll need to have a Mingw compatible _G_config.h. However, Cygwin b20.1 as distributed only supplies the _G_config.h for Cygwin and you're getting a mismatch. For Mingw, the above should be: `streambuf::xsputn(char const *, int)' ... Thanks for pointing this out. I'll add this to the mingw-libs package for egcs-1.1.2. I'm attaching a copy of _G_config.h for i386-mingw32 that should fix this. Just put it somewhere and point to the place with -I so that it picks this one instead of the installed one. 2. /usr/local/mingw-libs/libstdc++.a(iostream.o)(.text+0x18a9): undefined reference to `__imp__iob' /usr/local/mingw-libs/libstdc++.a(streambuf.o)(.text+0x30c): undefined reference to `_errno' The linker is picking the math library for Cygwin, not the empty stub used for Mingw. If you don't have a Mingw math library, you can create one as following: $ ar crv libm.a $ ranlib libm.a and then relink. This should certainly fix _errno problem; I'm hoping that it'll take care of the _imp_iob problem as well. Let me know if this doesn't fix your problem. The problems you're running into unfortunately a fact of life when you're trying to do cross (or pseudo-cross in this case ;-) compilation/linking. You'll probably have to do a bit more digging to make sure all the right includes and libraries are picked up instead of using the Cygwin ones. Regards, Mumit -- Want to unsubscribe from this list? Send a message to cygwin-unsubscribe@sourceware.cygnus.com