Compiling GDAL on CygWin

Petri J. Riipinen petri.riipinen at n...
Thu Jun 28 12:53:43 EDT 2001


>I tried under cygwin just now, and ran into the same problem.
>
>I would advise you to use the internal versions of a few libraries:
>
>./configure --with-libtiff=internal --with-geotiff=internal 
>--with-jpeg=internal
>
>This works for me now, though I had a few problems in the mitab code as well.
>If you run into this either add "--without-ogr" to the configure, or update
>to the latest GDAL code from CVS.

Ok, I managed to compile GDAL almost completely, the compilation stopped in 
the apps-directory, when linking 'gdal_translate', as might be expected 
because it tries to link with the shared lib. Please note that I really 
only need the support for TIFF-files, or rather, GeoTIFF-files. So I 
modified the GDALmake.opt to include only TIFF-format, because all my 
raster files are in that format.

However, now I'm wondering, that why I need to link with ogr.a eventhough I 
have set in GDALmake.opt:
OGR_ENABLED = no

I don't think that I need to have OGR for anything, as I use shapelib to 
read in ESRI Shapefiles. My application doesn't have to be prepared to read 
all possible formats, only ESRI Shapefile and GeoTIFF are needed.

In my own makefile, I link with:
GDALFILES = $(gdaldir)/gdal.a $(gdaldir)/cpl.a $(gdaldir)/gdal.a 
$(gdaldir)/ogr.a

I'm a bit confused also for having to include gdal.a twice on that line, 
otherwise the linking fails.

But then something more frustrating:
--------------------
g++ -mno-cygwin -I/usr/local/include -I/usr/include -I/usr/include/g++-3 
-L/usr/local/lib -Wall -O2 -DWIN32 -D
unix=1 mpc.o cMPCAppCentral.o cDlgAbout.o cRasterCollection.o cMainWindow.o 
cKeyboard.o cShapeCollection.o cSh
apeContainer.o shpopen.o dbfopen.o cList.o cListNode.o Fl_MPCMap.o 
/usr/local/lib/gdal/gdal.a /usr/local/lib/g
dal/cpl.a /usr/local/lib/gdal/gdal.a /usr/local/lib/gdal/ogr.a -lfltk -lz 
-lglu32 -lopengl32 -lgdi32 -lwsock32
-o mpc
/usr/local/lib/gdal/gdal.a(cpl_error.o)(.text+0x2b0):cpl_error.cpp: 
undefined reference to `_impure_ptr'
/usr/local/lib/gdal/gdal.a(cpl_error.o)(.text+0x2d0):cpl_error.cpp: 
undefined reference to `_impure_ptr'
/usr/local/lib/gdal/gdal.a(cpl_error.o)(.text+0x325):cpl_error.cpp: 
undefined reference to `_impure_ptr'
/usr/local/lib/gdal/gdal.a(cpl_string.o)(.text+0x1f7):cpl_string.cpp: 
undefined reference to `__errno'
/usr/local/lib/gdal/gdal.a(cpl_string.o)(.text+0x29e):cpl_string.cpp: 
undefined reference to `__errno'
/usr/local/lib/gdal/gdal.a(cpl_string.o)(.text+0x2df):cpl_string.cpp: 
undefined reference to `__errno'
/usr/local/lib/gdal/gdal.a(cpl_string.o)(.text+0x322):cpl_string.cpp: 
undefined reference to `_impure_ptr'
/usr/local/lib/gdal/gdal.a(cplgetsymbol.o)(.text+0x14):cplgetsymbol.cpp: 
undefined reference to `dlopen'
/usr/local/lib/gdal/gdal.a(cplgetsymbol.o)(.text+0x2a):cplgetsymbol.cpp: 
undefined reference to `dlsym'
/usr/local/lib/gdal/gdal.a(cplgetsymbol.o)(.text+0x36):cplgetsymbol.cpp: 
undefined reference to `dlerror'
/usr/local/lib/gdal/gdal.a(gif_err.o)(.text+0x6c8):gif_err.c: undefined 
reference to `_impure_ptr'
/usr/local/lib/gdal/gdal.a(gif_err.o)(.text+0x6e2):gif_err.c: undefined 
reference to `_impure_ptr'
ETC...
------------

You can see that -lm is missing, i guess that causes the above errors. BUT, 
when I link with -lm, the linking succeeds, but my program hangs on 
startup. Even if I try to print something from the beginning of 
main-function, nothing is printed. It seems as if my main program hangs 
already in some library initialisation code. If I remove all references to 
GDAL in my code and remove the linking of the .a-files, then my program works.

Any ideas?

- Petri

PS. Note that I had to define -Dunix=1 to avoid some ifdef:ed INT64-stuff 
in GDAL-code.
<><><><><><><><>
Petri J. Riipinen
petri.riipinen at n...
<><><><><><><><>




More information about the Gdal-dev mailing list