[Geotiff] Problem compiling under MinGW/MSYS
Thom DeCarlo
t.r.decarlo at larc.nasa.gov
Tue Jan 31 09:31:05 EST 2006
> -----Original Message-----
> From: fwarmerdam at gmail.com [mailto:fwarmerdam at gmail.com] On Behalf Of
> Frank Warmerdam
> Sent: Monday, January 30, 2006 12:29 PM
> To: Thom DeCarlo
> Cc: geotiff at lists.maptools.org
> Subject: Re: [Geotiff] Problem compiling under MinGW/MSYS
>
> On 1/30/06, Thom DeCarlo <t.r.decarlo at larc.nasa.gov> wrote:
> > 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 have upgraded the AC_LD_SHARED macro I used to figure
> out what to use for LD in libgeotiff to the same logic used for
> GDAL. Could you try from CVS again and see if the new logic
> works better?
>
> Best regards,
> --
> ---------------------------------------+----------------------------------
> ----
> I set the clouds in motion - turn up | Frank Warmerdam,
> warmerdam at pobox.com
> light and sound - activate the windows | http://pobox.com/~warmerdam
> and watch the world go round - Rush | Geospatial Programmer for Rent
Frank,
I received a response from the MinGW/MSYS list that said I may have a old
version of the Developer's ToolKit and I should check for individual package
updates. Unfortunately, I didn't see this message until after I spent a bit
more time working with what I already had on my machine. I'll try to figure
out what packages I need to download and see what changes.
In the mean time, I deleted all of my geotiff stuff and grabbed a clean
version from the CVS. While running the ./configure I saw one line that said
something to the effect of "Checking for ld -shared... no" and another line
saying "Checking for exp in -lm... yes"
Running the make successfully compiled the program files, but the linker
failed with:
...
ar r libgeotiff.a 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
ranlib libgeotiff.a
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 -lm -L/usr/local/lib
-lz -L/usr/local -ljpeg -o libgeotiff.so.1.2.2
c:\MinGW\bin\ld.exe: cannot find -lm
make: *** [libgeotiff.so.1.2.2] Error 1
I then changed the line in configure.in from "AC_CHECK_LIB(m,exp,,,)" to
"AC_SEARCH_LIBS([sqrt],[m])" and ran the autoconf and ./configure again.
This time configure said something like "Searching for sqrt in m... not
needed".
However, the make did not create a shared library. I then ran
make LD_SHARED="gcc -shared" GEOTIFF_SO=libgeotiff.so.1.2.2
and the shared library was finally created.
--
Thom DeCarlo
---------------------------------------------------------
Given sufficient time and money, all things are possible.
In lieu of time and money, caffeine and aspirin may also work.
More information about the Geotiff
mailing list