This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: boost program_options library with cygwin

On Thu, Nov 10, 2005 at 10:25:40AM -0800, Brian Dessent wrote:
> 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.

Thanks for your guideline. It made things much more clear to me.


Unsubscribe info:
Problem reports:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]