On Saturday 18 July 2009 22:38:04 Greg Chicares wrote:
> On 2009-07-18 21:03Z, Myles Prather wrote:
You are running a *native* MinGW ranlib from a Cygwin shell, right?
> > I'm having a very odd problem. Ranlib says it can't find a file
> > that is clearly there. When I cd to the directory where the file
> > is and run ranlib, it works fine. ???
There's absolutely nothing odd, or even unexpected in this, [in which
some lines appear to have run together, possibly as a result of HTML
posting; please configure your mailer to post plain text *only*]...
> > smprather ~/SDL-1.2.13 % ls -l /usr/local/lib/libSDL.a
> > -rw-r--r-- 1 smprather None 1170920 Jul 18 15:56
> > /usr/local/lib/libSDL.a smprather ~/SDL-1.2.13 % ranlib
> > /usr/local/lib/libSDL.a c:\MinGW\bin\ranlib.exe:
> > '/usr/local/lib/libSDL.a': No such file Exit 1
Here, you are passing a Cygwin path to a native application, which
expects a native Windows path. Unless you've taken special care, in
your Cygwin installation, to make Cygwin's root directory, /, map to
the root of your current drive[*], d:\, (an unlikely scenario), then
the native application will simply interpret that Cygwin path as
which almost certainly isn't what you want. (Unlike MSYS, AFAIK
Cygwin's shell will *not* translate paths specified on the command
line to native equivalents, when invoking native applications).
[*] using "d:" here, as a generic substitute for whatever your actual
current drive may be.
> > smprather ~/SDL-1.2.13 % cd /usr/local/lib/
> > smprather lib % ranlib libSDL.a
Here, you are simply passing a file name, and leaving the native
application to find it in the current directory; there is no Cygwin
vs. native path confusion, and the file is where you've told the
application to look for it, so it works as expected.
> Are you still trying to mix Cygwin and MinGW? MinGW is a native
> compiler; it doesn't understand Cygwin paths. And if you're
> trying to link objects and libraries built with a mixture of
> MinGW and Cygwin gcc, you may encounter worse problems later on
> if you find a way around the path issues now.
> Consider using either (MinGW + MSYS), or Cygwin, but not both.
Sound advice, indeed. However, it is possible to use MinGW tools
with complete success, from a Cygwin shell; (IIRC, it is how Aaron,
and Danny before him, built the MinGW-GCC tool chains). It does,
however, require extreme care to avoid mixing native and Cygwin
libraries, and to pass paths in the proper native format.