[Geotiff] Problem compiling under MinGW/MSYS

Norman Vine nhv at cape.com
Mon Jan 30 12:16:32 EST 2006


Thom DeCarlo writes:
> 
> I got more info from the MinGW/MSYS mailing list. It seems that, in MinGW,
> we should not be using the "ld" command to link the libraries unless we are
> also going to specify *all* of the required libraries. Instead, use "gcc" or
> "g++" to link and it will pick up all the necessary libraries. I tested this
> on the geotiff library build and it does work. I'm not sure how to get this
> change folded into the geotiff "configure.in" file in the CVS, though.

Thom,

I don't use MSYS but I do use Mingw and I don't see any of the problems 
that you have been reporting

I have MingW installed in a Cygwin system and I build geotiff with

export MINGW_HOME=/usr/mingw
./configure --build=mingw32 --target=mingw32 --prefix=$MINGW_HOME
make
make install

I would expect the same results using MSYS

are you sure your MSYS installation is correct ?

This is with the geotiff distribution from
ftp://ftp.remotesensing.org/pub/geotiff/libgeotiff/libgeotiff-1.2.2.tar.gz

Note since geotiff is a 'C' not a 'C++' library you can use
the MSVC compiled libs with MingW too

HTH

Norman

> Thom
> 
> >From the MinGW/MSYS mailing list:
> 
> On 2006-1-27 2:33 UTC, Thom DeCarlo wrote:
> > 
> > It is starting to feel like there is something in
> > the Makefile that is causing the linker to ignore the standard libraries.
> 
> The usual cause of that is using 'ld' directly. Instead, use
>   'gcc' to link C, or
>   'g++' to link C++
> and then the usually-necessary libraries will be linked for you.
> You can use 'ld' and specify them yourself, but that's too much work.
> 
> > thom at HATTER /s/osg/geotiff/libgeotiff
> > $ make
> > ld -shared xtiff.o geo_free.o geo_get.o geo_names.o geo_new.o
>   ^^
> 
> > geo_print.o geo_set.o geo_tiffp.o geo_write.o geo_trans.o
> > geo_normalize.o geotiff_proj4.o geo_extra.o cpl_serv.o  cpl_csv.o
> > -L/usr/local/lib -lproj -L/usr/local/lib -ltiff   -L/usr/local/lib -lz
> > -L/usr/local -ljpeg -o libgeotiff.so.1.2.2
> > geo_names.o(.text+0xb088):geo_names.c: undefined reference to `sprintf'
> 
> Try 'make LD=gcc'; that might make this makefile work.
> 
> 
> 
> --
> Thom DeCarlo
> ----------------------------------------------------
>     Outside of a dog, a book is a man's best friend.
>     Inside of a dog, it's too dark to read.    -Groucho Marx
> 
> > -----Original Message-----
> > From: Thom DeCarlo
> > Sent: Wednesday, January 25, 2006 10:59 AM
> > To: geotiff at lists.maptools.org
> > Subject: RE: [Geotiff] Problem compiling under MinGW/MSYS
> > 
> > I have more info on this problem. The word I got from the MinGW/MSYS list
> > is
> > that -lm is not required in MinGW builds. The math functions are picked up
> > from the Microsoft libraries. The best way to account for this seems to be
> > changing the line in configure.in that says:
> > 
> > AC_CHECK_LIB(m,exp,,,)
> > 
> > to be:
> > 
> > AC_SEARCH_LIBS([sqrt],[m])
> > 
> > By doing this and running autoconf (after updating autoconf to version
> > 2.59)
> > I was able to create a set of Makefiles that did not include any reference
> > to "-lm".
> > 
> > However, that still didn't fix the linker problems. It seems that there is
> > something in the makefiles that is forcing the linker to ignore the
> > "normal"
> > libraries. Now I'm getting piles of "external reference not found" errors.
> > The things that are not being found are things like sprintf, atoi, atof,
> > and
> > (most annoyingly) all the math functions, though these are showing up as
> > referenced from the proj library.
> > 
> > Now, I know the proj library (4.4.9, pulled from CVS last night) compiled
> > and installed correctly, and the proj utility programs work. So there is
> > definitely something funky happening within the geotiff makefile.
> > 
> > Does anyone have *any* clue what is going on here?
> > 
> > Thanks,
> > Thom
> > 
> > --
> > Thom DeCarlo
> > ---------------------------------
> > Where are we going and why am I in this handbasket?
> > 
> > > -----Original Message-----
> > > From: Thom DeCarlo
> > > Sent: Friday, January 20, 2006 11:32 AM
> > > To: geotiff at lists.maptools.org
> > > Subject: [Geotiff] Problem compiling under MinGW/MSYS
> > >
> > > I updated my geotiff source from CVS last night and tried to do a
> > > ./configure and make. The make failed, complaining that it could not
> > find
> > > "-lm".
> > >
> > > The configure ran successfully with these options:
> > >     ./configure --with-jpeg=/usr/local --with-proj=/usr/local
> > >       --with-libtiff=/usr/local --with-zip=/usr/local
> > > and the config.log says that exp was successfully found in -lm.
> > >
> > > The only libm.a that I found in my MinGW/MSYS environment is in
> > /mingw/lib
> > > and is only 485 bytes in size. When I added "-L/mingw/lib" to the
> > Makefile
> > > LIBS variable the make spewed many errors about not finding a variety of
> > > math functions needed by the proj library.
> > >
> > > The proj library also needed the math library and compiled successfully.
> > >
> > > Can anyone tell me why libgeotiff fails to link with this library? Is
> > > there
> > > something wrong with my MinGW installation?
> > >
> > > TIA,
> > > Thom
> > > --
> > > Thom DeCarlo
> > > ---------------------------------
> > >   /~\ The ASCII
> > >   \ / Ribbon Campaign
> > >    X  Against HTML
> > >   / \ Email!
> > >
> > >
> 
> 
> _______________________________________________
> Geotiff mailing list
> Geotiff at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/geotiff
> 


More information about the Geotiff mailing list