[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: problem with libtool under windows and cygwin
From: |
Charles Wilson |
Subject: |
Re: problem with libtool under windows and cygwin |
Date: |
Thu, 09 Apr 2009 08:38:00 -0400 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.21) Gecko/20090302 Thunderbird/2.0.0.21 Mnenhy/0.7.6.666 |
Andreas Otto wrote:
>
> as special restriction I use the build-tools from cygwin
> but it is no cygwin library at all because I use the
> build-in mingw compiler
>
> gcc -mno-cygwin
This is *not* a "built-in mingw compiler. It's a hack that sometimes
works, but always causes problems. It is deprecated and will be removed
from cygwin's gcc-4 releases. It will be replaced by a true cross
compiler (cygwin-host, mingw-target).
> and the library is a real windows libraray ...
>
> question: howto avoid the cyg prefix ?
Tell configure (and therefore, libtool) that your eventual $host will be
mingw:
configure --build=cygwin --host=mingw CC="gcc -mno-cygwin"
(The CC= part may be required for now, until cygwin begins distributing
a "real" cross-compiler. OR, you could instead invoke the *mingw*
project's CC from a cygwin environment. See the mingw-users mailing
list; there was a discussion about that topic just this week.)
While all of the above may solve your problem for *nix and mingw, what
if you want to build an actual cygwin version? I think you really need
platform-dependent code. My Java's a little rusty, but
MyLoadLibrary(String module_basename)
{
if System.platform() == "cygwin" {
String MODULE_PREFIX = "cyg"
} else {
String MODULE_PREFIX = "lib"
}
System.loadLibrary(MODULE_PREFIX + module_basename)
}
Naturally, you can make this a lot cleaner with additional abstraction
(a portability class, where MODULE_PREFIX is a final member so the
System.platform() test only happens once). You could do fancy things in
MyLoadLibrary so that module_basename can have the "lib" prefix and it
just gets stripped off and replaced with MODULE_PREFIX only when
necessary -- this way the rest of your code can "pretend" that it always
uses "libfoo". etc. etc.
--
Chuck