Changes between Version 14 and Version 15 of BuildingWithMinGW


Ignore:
Timestamp:
Jul 15, 2011, 9:33:06 AM (13 years ago)
Author:
Even Rouault
Comment:

BuildingWithMinGW: mention how to disable generation of libgdal.a

Legend:

Unmodified
Added
Removed
Modified
  • BuildingWithMinGW

    v14 v15  
    99And you should have libgdal-1.dll in your c:\msys\1.0\local\bin and libgdal-1.dll.a in c:\msys\1.0\local\lib.
    1010
    11 '''linking:'''
     11'''Linking issues:'''
    1212
    1313Edit libtool at line 6114 to sed out the MSYS-anchored absolute path and replace it by a relative path or possibly a Windows drive-based absolute path.
     
    1616
    1717Edit GNUmakefile on lines 6-12 and replace $(GDAL_ROOT) with . (a dot).
     18
     19By default both libgdal.a and libgdal.dll are generated. However, command line utilities such as gdalinfo.exe, etc... will statically link against libgdal.a, instead of libgdal.dll, which leak to huge binary files. You can edit GNUmakefile as such to avoid producing libgdal.a :
     20
     21
     22{{{
     23Index: GNUmakefile
     24===================================================================
     25--- GNUmakefile (revision 22722)
     26+++ GNUmakefile (copie de travail)
     27@@ -1,13 +1,13 @@
     28 
     29 include GDALmake.opt
     30 
     31-GDAL_OBJ       =       $(GDAL_ROOT)/frmts/o/*.o \
     32-                       $(GDAL_ROOT)/gcore/*.o \
     33-                       $(GDAL_ROOT)/port/*.o \
     34-                       $(GDAL_ROOT)/alg/*.o
     35+GDAL_OBJ       =       ./frmts/o/*.o \
     36+                       ./gcore/*.o \
     37+                       ./port/*.o \
     38+                       ./alg/*.o
     39 
     40 ifeq ($(OGR_ENABLED),yes)
     41-GDAL_OBJ += $(GDAL_ROOT)/ogr/ogrsf_frmts/o/*.o
     42+GDAL_OBJ += ./ogr/ogrsf_frmts/o/*.o
     43 endif
     44 
     45 include ./ogr/file.lst
     46@@ -28,13 +28,8 @@
     47        $(LD_SHARED) $(GDAL_SLIB_SONAME) $(GDAL_OBJ) $(GDAL_LIBS) $(LDFLAGS) $(LIBS) \
     48                -o $(GDAL_SLIB)
     49 
     50-$(GDAL_LIB):   $(GDAL_OBJ) GDALmake.opt
     51-       rm -f libgdal.a
     52-       $(AR) r $(GDAL_LIB) $(GDAL_OBJ)
     53-       $(RANLIB) $(GDAL_LIB)
     54-
     55-$(GDAL_SLIB):  $(GDAL_OBJ) $(GDAL_LIB)
     56-       $(LD_SHARED) $(GDAL_SLIB_SONAME) $(GDAL_OBJ) $(GDAL_LIBS) $(LDFLAGS) $(LIBS) \
     57+$(GDAL_SLIB):  $(GDAL_OBJ)
     58+       $(LD_SHARED) $(GDAL_SLIB_SONAME) $(GDAL_OBJ) $(LDFLAGS) $(LIBS) \
     59                -o $(GDAL_SLIB)
     60 
     61 $(LIBGDAL):    $(GDAL_OBJ:.o=.lo)
     62@@ -47,7 +42,7 @@
     63 endif
     64 
     65 check-lib:     port-target core-target frmts-target ogr-target
     66-       $(MAKE) $(LIBGDAL-yes)
     67+       $(MAKE) $(GDAL_SLIB)
     68 
     69 port-target:
     70        (cd port; $(MAKE))
     71}}}
    1872
    1973'''expat:'''
     
    129183
    130184
    131 '''Python bindings :'''
     185'''Python bindings:'''
    132186
    133187If you use the regular Python Windows binaries, you need to edit $PYTHON_ROOT\lib\distutils\ccompiler.py (at least true for Python 2.7) and change the "_default_compilers" mapping as following, in order GCC to be used instead of MSVC when building the GDAL Python bindings :