Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm 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 Message-ID: <437390A3.72A386D6@dessent.net> Date: Thu, 10 Nov 2005 10:25:40 -0800 From: Brian Dessent MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: boost program_options library with cygwin References: <20051109160408 DOT GB5162 AT porschberg DOT osp-dd DOT de> <43722405 DOT F29D93A2 AT dessent DOT net> <20051110102239 DOT GB10788 AT porschberg DOT osp-dd DOT de> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Reply-To: cygwin AT cygwin DOT com Thomas Porschberg wrote: > because libcppunit was built as cygwin-library. I resolved the > problem by compiling the library from sources with -mno-cygwin > flag. And then I used this library for both, my application > cygwin-build and my application mingw-build. > If I understand you right, this is at least dangerous. I have Yes, it's dangerous, and I'm surprised it works. Basically, you have to treat Cygwin and mingw as two completely separate platforms. You'll have to compile two versions of your code and every library that it links with. In the case of the Cygwin version of the library, you can use the copy installed by setup.exe from the Cygwin mirrors. But it is not a goal of the Cygwin project to provide packaged versions of mingw libraries (except for a couple of common cases like zlib) so don't expect to use any of the libraries found on a Cygwin mirror when compiling for mingw. You'll have to do this yourself, or get them from the mingw site. To do this sanely under Cygwin, it seems to me like you could do something like the following (untested) for each package/library: mkdir cygwin-build && cd cygwin-build CC="gcc" ../configure --prefix=/usr/local/cygwin \ CFLAGS="-I/usr/local/cygwin/include" \ LDFLAGS="-L/usr/local/cygwin/lib" # etc.. make && make install cd .. mkdir mingw-build && cd mingw-build CC="gcc -mno-cygwin" ../configure --prefix=/usr/local/mingw \ CFLAGS="-I/usr/local/mingw/include" \ LDFLAGS="-L/usr/local/mingw/lib" # etc.. make && make install This keeps the separation between installed packages such that everything installed under /usr/local/cygwin is Cygwin, and everything installed under /usr/local/mingw is mingw. The reason for not using just /usr/local is that the compiler picks up libraries installed there by default, so you wouldn't want it picking up a cygwin lib when compiling in mingw mode, and so on. You could also do it by using mounts. Mount one /usr/local, do a Cygwin compile and install of all packages, then unmount and remount a different /usr/local and redo everything in mingw mode. However you handle it, you have to keep this separation. I would not try to mix them under the same --prefix unless you really know what you're doing. You can even just forget about using -mno-cygwin and have an install of Cygwin and an install of mingw+MSYS, and treat them as if they have no idea about each other, just as you would if you were supporting e.g. Cygwin and MS VC++. Also, it's important to realize that the -mno-cygwin flag is provided as a convenience to turn the Cygwin build environment into mingw mode, but the mingw project is an independant effort from Cygwin. Porting mingw applications is not really on-topic for this list. If you have questions about compiling with mingw you should ask on their mailing list. Brian -- 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/