[gdal-dev] Unable to compile Gdal under Cygwin

Even Rouault even.rouault at spatialys.com
Fri Oct 9 10:10:53 PDT 2015


Dmitry,

It seems the error is linked to the Python GNM module when GDAL is not 
configured --with-gnm.

On Linux, this seems to compile, although at runtime, I can see that 
https://s3.amazonaws.com/archive.travis-ci.org/jobs/84538954/log.txt shows 
errors like :

... failed to load gnm_test.py ... skipping.
Traceback (most recent call last):
  File "pymod/gdaltest.py", line 244, in run_all
    exec("import " + module)
  File "<string>", line 1, in <module>
  File "./gnm_test.py", line 43, in <module>
  File "/usr/lib/python2.7/dist-packages/osgeo/gnm.py", line 28, in <module>
    _gnm = swig_import_helper()
  File "/usr/lib/python2.7/dist-packages/osgeo/gnm.py", line 24, in 
swig_import_helper
    _mod = imp.load_module('_gnm', fp, pathname, description)
ImportError: /usr/lib/python2.7/dist-packages/osgeo/_gnm.so: undefined symbol: 
_ZTI10GNMNetwork

I guess that on Cygwin symbol resolution is done at linking time, hence the 
error. Perhaps the building of the Python gnm module should be 
conditionnalized to GNM_ENABLED ?

Even


> Greetings,
> 
> yesterday I cloned the Gdal source repository from
> 
>    https://github.com/OSGeo/gdal.git
> 
> and converted  it to a Mercurial repository,  simply  because that's the
> version control software I'm at home with.  In Mercurial the most recent
> commit of the repository looks like this
> 
>    2015-10-08 13:48:32 +0000 even.rouault at mines-paris.org
> 
>    test_gdal_grid_lib_1(): fix failure when GEOS not available
> 
>    git-svn-id: https://svn.osgeo.org/gdal/trunk@30908
> f0d54148-0727-0410-94bb-9a71ac55c965
> 
>    M autotest/utilities/test_gdal_grid_lib.py
> 
> and the corresponding Git revision of this commit most probably is
> 
>    592b969358dba7119acb24bdac2a204808ff96d4
> 
> I then tried to compile Gdal  under a reasonably current version of Cyg-
> win as a non-privileged user running
> 
>    ./configure --mandir=$REPO/share/man  \
>                --prefix=$REPO            \
>                --with-geotiff=internal   \
>                --with-gif=internal       \
>                --with-jpeg=internal      \
>                --with-libjson-c=internal \
>                --with-libtiff=internal   \
>                --with-libz=internal      \
>                --with-pcidsk=internal    \
>                --with-pcraster=internal  \
>                --with-perl=no            \
>                --with-png=internal       \
>                --with-python=yes         \
>                --with-qhull=internal
>    make clean
>    make install        # This automatically also makes target "default".
> 
> Things went well until  "make" entered directory "swig/python/" where it
> produced plenty of warnings (which may or may not be relevant to my cur-
> rent problem) and terminated with the error message "collect2: error: ld
> returned 1 exit status".  I have included the log from where "make" ent-
> ers directory "swig/python/" up to the final error below.
> 
> On the Gdal webpage at  "http://trac.osgeo.org/gdal/wiki/BuildingOnUnix"
> I found  the hint to  use the "configure" option "--with-pymodir=direct-
> ory", but this is rejected with
> 
>    configure: WARNING: unrecognized options: --with-pymodir
> 
> What am I missing?  Any pointers welcome.
> 
> A few additional remarks:
> 
> "configure" is issuing a message saying "checking for shared library run
> path origin... /bin/sh: ./config.rpath:  No such file or directory", but
> a script "config.rpath" is not (and never was) contained in the reposit-
> ory I cloned.
> 
> "config.status" is issuing a  warning saying "'GDALmake.opt.in' seems to
> ignore the --datarootdir setting",  and according to my own observations
> either "configure" or "GDALmake.opt"  ignore the "--mandir" setting  and
> just use "PREFIX/man", regardless.
> 
> The webpage  already mentioned  above is also  saying that  under Cygwin
> "shared libraries are not supported", which is sort of wrong, since Cyg-
> win uses Windows DLLs which should just be stored in "PREFIX/bin".
> 
> Sincerely,
>   Rainer
> 
>  ----------------------------------------------------------------------
> 
> | Rainer M Woitok                | Phone : (+49 60 93) 487 95 95       |
> | Kolpingstra�e 3                | Mobile: (+49 172) 813 6 831         |
> | D-63846 Laufach                | Mail  : Rainer.Woitok at Gmail.Com     |
> | Germany                        |                                     |
> 
>  ----------------------------------------------------------------------
> 
> make[2]: Entering directory '/home/Rainer/repo/gdal/swig/python' python
> setup.py build running build running build_py creating build creating
> build/lib.cygwin-2.2.1-i686-2.7 copying gdal.py ->
> build/lib.cygwin-2.2.1-i686-2.7 copying ogr.py ->
> build/lib.cygwin-2.2.1-i686-2.7 copying osr.py ->
> build/lib.cygwin-2.2.1-i686-2.7 copying gdalconst.py ->
> build/lib.cygwin-2.2.1-i686-2.7 copying gnm.py ->
> build/lib.cygwin-2.2.1-i686-2.7 creating
> build/lib.cygwin-2.2.1-i686-2.7/osgeo copying osgeo/gdal.py ->
> build/lib.cygwin-2.2.1-i686-2.7/osgeo copying osgeo/gdalconst.py ->
> build/lib.cygwin-2.2.1-i686-2.7/osgeo copying osgeo/gdalnumeric.py ->
> build/lib.cygwin-2.2.1-i686-2.7/osgeo copying osgeo/gdal_array.py ->
> build/lib.cygwin-2.2.1-i686-2.7/osgeo copying osgeo/gnm.py ->
> build/lib.cygwin-2.2.1-i686-2.7/osgeo copying osgeo/ogr.py ->
> build/lib.cygwin-2.2.1-i686-2.7/osgeo copying osgeo/osr.py ->
> build/lib.cygwin-2.2.1-i686-2.7/osgeo copying osgeo/__init__.py ->
> build/lib.cygwin-2.2.1-i686-2.7/osgeo running build_ext building
> 'osgeo._gdal' extension creating build/temp.cygwin-2.2.1-i686-2.7
> creating build/temp.cygwin-2.2.1-i686-2.7/extensions gcc
> -fno-strict-aliasing -ggdb -O2 -pipe -Wimplicit-function-declaration
> -fdebug-prefix-map=/usr/src/ports/python/python-2.7.10-1.i686/build=/usr/sr
> c/debug/python-2.7.10-1
> -fdebug-prefix-map=/usr/src/ports/python/python-2.7.10-1.i686/src/Python-2
> .7.10=/usr/src/debug/python-2.7.10-1 -DNDEBUG -g -fwrapv -O3 -Wall
> -Wstrict-prototypes -I../../port
> -I../../gcore -I../../alg -I../../ogr/ -I../../ogr/ogrsf_frmts
> -I../../gnm -I../../apps -I/usr/include/python2.7
> -I. -I/home/Rainer/repo/gdal/include -c extensions/gdal_wrap.cpp -o
> build/temp.cygwin-2.2.1-i686-2.7/extensions/gdal_wrap.o cc1plus:
> warning: command line option �-Wimplicit-function-declaration� is
> valid for C/ObjC but not for C++ cc1plus: warning: command line option
> �-Wstrict-prototypes� is valid for C/ObjC but not for C++ In file
> included from /usr/include/python2.7/Python.h:133:0,
>                  from extensions/gdal_wrap.cpp:154:
> extensions/gdal_wrap.cpp: In function �PyObject*
> _wrap_MajorObject_SetMetadata__SWIG_0(PyObject*, PyObject*)�:
> /usr/include/python2.7/abstract.h:1354:62: warning: deprecated conversion
> from string constant to �char*� [-Wwrite-strings] #define
> PyMapping_Items(O) PyObject_CallMethod(O,"items",NULL)
>                                                               ^
> extensions/gdal_wrap.cpp:8611:31: note: in expansion of macro
> �PyMapping_Items� PyObject *item_list = PyMapping_Items( obj1 );
>                                ^
> extensions/gdal_wrap.cpp: In function �PyObject*
> _wrap_VirtualMem_GetAddr(PyObject*, PyObject*)�:
> extensions/gdal_wrap.cpp:11596:19: warning: deprecated conversion from
> string constant to �char*� [-Wwrite-strings] buf->format = "B";
>                    ^
> extensions/gdal_wrap.cpp:11601:19: warning: deprecated conversion from
> string constant to �char*� [-Wwrite-strings] buf->format = "h";
>                    ^
> extensions/gdal_wrap.cpp:11606:19: warning: deprecated conversion from
> string constant to �char*� [-Wwrite-strings] buf->format = "H";
>                    ^
> extensions/gdal_wrap.cpp:11611:19: warning: deprecated conversion from
> string constant to �char*� [-Wwrite-strings] buf->format = "i";
>                    ^
> extensions/gdal_wrap.cpp:11616:19: warning: deprecated conversion from
> string constant to �char*� [-Wwrite-strings] buf->format = "I";
>                    ^
> extensions/gdal_wrap.cpp:11621:19: warning: deprecated conversion from
> string constant to �char*� [-Wwrite-strings] buf->format = "f";
>                    ^
> extensions/gdal_wrap.cpp:11626:19: warning: deprecated conversion from
> string constant to �char*� [-Wwrite-strings] buf->format = "F";
>                    ^
> extensions/gdal_wrap.cpp:11631:19: warning: deprecated conversion from
> string constant to �char*� [-Wwrite-strings] buf->format = "B";
>                    ^
> extensions/gdal_wrap.cpp: In function �PyObject*
> _wrap_Band_ComputeStatistics(PyObject*, PyObject*)�:
> extensions/gdal_wrap.cpp:16433:10: warning: variable �result� set but
> not used [-Wunused-but-set-variable] CPLErr result;
>           ^ g++ -shared -Wl,--enable-auto-image-base
> -L. build/temp.cygwin-2.2.1-i686-2.7/extensions/gdal_wrap.o
> -L../../.libs -L../../ -L/usr/lib/python2.7/config -L/usr/lib
> -L/home/Rainer/repo/gdal/lib -lpython2.7 -lgdal -o
> build/lib.cygwin-2.2.1-i686-2.7/osgeo/_gdal.dll building
> 'osgeo._gdalconst' extension gcc -fno-strict-aliasing -ggdb -O2 -pipe
> -Wimplicit-function-declaration
> -fdebug-prefix-map=/usr/src/ports/python/python-2.7.10-1.i686/build=/usr/sr
> c/debug/python-2.7.10-1
> -fdebug-prefix-map=/usr/src/ports/python/python-2.7.10-1.i686/src/Python-2
> .7.10=/usr/src/debug/python-2.7.10-1 -DNDEBUG -g -fwrapv -O3 -Wall
> -Wstrict-prototypes -I../../port
> -I../../gcore -I../../alg -I../../ogr/ -I../../ogr/ogrsf_frmts
> -I../../gnm -I../../apps -I/usr/include/python2.7
> -I. -I/home/Rainer/repo/gdal/include -c extensions/gdalconst_wrap.c -o
> build/temp.cygwin-2.2.1-i686-2.7/extensions/gdalconst_wrap.o gcc -shared
> -Wl,--enable-auto-image-base
> -L. build/temp.cygwin-2.2.1-i686-2.7/extensions/gdalconst_wrap.o
> -L../../.libs -L../../ -L/usr/lib/python2.7/config -L/usr/lib
> -L/home/Rainer/repo/gdal/lib -lpython2.7 -lgdal -o
> build/lib.cygwin-2.2.1-i686-2.7/osgeo/_gdalconst.dll building
> 'osgeo._osr' extension gcc -fno-strict-aliasing -ggdb -O2 -pipe
> -Wimplicit-function-declaration
> -fdebug-prefix-map=/usr/src/ports/python/python-2.7.10-1.i686/build=/usr/sr
> c/debug/python-2.7.10-1
> -fdebug-prefix-map=/usr/src/ports/python/python-2.7.10-1.i686/src/Python-2
> .7.10=/usr/src/debug/python-2.7.10-1 -DNDEBUG -g -fwrapv -O3 -Wall
> -Wstrict-prototypes -I../../port
> -I../../gcore -I../../alg -I../../ogr/ -I../../ogr/ogrsf_frmts
> -I../../gnm -I../../apps -I/usr/include/python2.7
> -I. -I/home/Rainer/repo/gdal/include -c extensions/osr_wrap.cpp -o
> build/temp.cygwin-2.2.1-i686-2.7/extensions/osr_wrap.o cc1plus: warning:
> command line option �-Wimplicit-function-declaration� is valid for
> C/ObjC but not for C++ cc1plus: warning: command line option
> �-Wstrict-prototypes� is valid for C/ObjC but not for C++
> extensions/osr_wrap.cpp:3199:14: warning: �char*
> GDALPythonObjectToCStr(PyObject*, int*)� defined but not used
> [-Wunused-function]
>  static char* GDALPythonObjectToCStr(PyObject* pyObject, int* pbToFree)
>               ^
> extensions/osr_wrap.cpp:3229:13: warning: �void GDALPythonFreeCStr(void*,
> int)� defined but not used [-Wunused-function] static void
> GDALPythonFreeCStr(void* ptr, int bToFree)
>              ^ g++ -shared -Wl,--enable-auto-image-base
> -L. build/temp.cygwin-2.2.1-i686-2.7/extensions/osr_wrap.o -L../../.libs
> -L../../ -L/usr/lib/python2.7/config -L/usr/lib
> -L/home/Rainer/repo/gdal/lib -lpython2.7 -lgdal -o
> build/lib.cygwin-2.2.1-i686-2.7/osgeo/_osr.dll building 'osgeo._ogr'
> extension gcc -fno-strict-aliasing -ggdb -O2 -pipe
> -Wimplicit-function-declaration
> -fdebug-prefix-map=/usr/src/ports/python/python-2.7.10-1.i686/build=/usr/sr
> c/debug/python-2.7.10-1
> -fdebug-prefix-map=/usr/src/ports/python/python-2.7.10-1.i686/src/Python-2
> .7.10=/usr/src/debug/python-2.7.10-1 -DNDEBUG -g -fwrapv -O3 -Wall
> -Wstrict-prototypes -I../../port
> -I../../gcore -I../../alg -I../../ogr/ -I../../ogr/ogrsf_frmts
> -I../../gnm -I../../apps -I/usr/include/python2.7
> -I. -I/home/Rainer/repo/gdal/include -c extensions/ogr_wrap.cpp -o
> build/temp.cygwin-2.2.1-i686-2.7/extensions/ogr_wrap.o cc1plus: warning:
> command line option �-Wimplicit-function-declaration� is valid for
> C/ObjC but not for C++ cc1plus: warning: command line option
> �-Wstrict-prototypes� is valid for C/ObjC but not for C++ In file
> included from /usr/include/python2.7/Python.h:133:0,
>                  from extensions/ogr_wrap.cpp:154:
> extensions/ogr_wrap.cpp: In function �PyObject*
> _wrap_MajorObject_SetMetadata__SWIG_0(PyObject*, PyObject*)�:
> /usr/include/python2.7/abstract.h:1354:62: warning: deprecated conversion
> from string constant to �char*� [-Wwrite-strings] #define
> PyMapping_Items(O) PyObject_CallMethod(O,"items",NULL)
>                                                               ^
> extensions/ogr_wrap.cpp:5403:31: note: in expansion of macro
> �PyMapping_Items� PyObject *item_list = PyMapping_Items( obj1 );
>                                ^ g++ -shared
> -Wl,--enable-auto-image-base
> -L. build/temp.cygwin-2.2.1-i686-2.7/extensions/ogr_wrap.o -L../../.libs
> -L../../ -L/usr/lib/python2.7/config -L/usr/lib
> -L/home/Rainer/repo/gdal/lib -lpython2.7 -lgdal -o
> build/lib.cygwin-2.2.1-i686-2.7/osgeo/_ogr.dll building 'osgeo._gnm'
> extension gcc -fno-strict-aliasing -ggdb -O2 -pipe
> -Wimplicit-function-declaration
> -fdebug-prefix-map=/usr/src/ports/python/python-2.7.10-1.i686/build=/usr/sr
> c/debug/python-2.7.10-1
> -fdebug-prefix-map=/usr/src/ports/python/python-2.7.10-1.i686/src/Python-2
> .7.10=/usr/src/debug/python-2.7.10-1 -DNDEBUG -g -fwrapv -O3 -Wall
> -Wstrict-prototypes -I../../port
> -I../../gcore -I../../alg -I../../ogr/ -I../../ogr/ogrsf_frmts
> -I../../gnm -I../../apps -I/usr/include/python2.7
> -I. -I/home/Rainer/repo/gdal/include -c extensions/gnm_wrap.cpp -o
> build/temp.cygwin-2.2.1-i686-2.7/extensions/gnm_wrap.o cc1plus: warning:
> command line option �-Wimplicit-function-declaration� is valid for
> C/ObjC but not for C++ cc1plus: warning: command line option
> �-Wstrict-prototypes� is valid for C/ObjC but not for C++ In file
> included from /usr/include/python2.7/Python.h:133:0,
>                  from extensions/gnm_wrap.cpp:154:
> extensions/gnm_wrap.cpp: In function �PyObject*
> _wrap_MajorObject_SetMetadata__SWIG_0(PyObject*, PyObject*)�:
> /usr/include/python2.7/abstract.h:1354:62: warning: deprecated conversion
> from string constant to �char*� [-Wwrite-strings] #define
> PyMapping_Items(O) PyObject_CallMethod(O,"items",NULL)
>                                                               ^
> extensions/gnm_wrap.cpp:4014:31: note: in expansion of macro
> �PyMapping_Items� PyObject *item_list = PyMapping_Items( obj1 );
>                                ^
> g++ -shared -Wl,--enable-auto-image-base -L.
> build/temp.cygwin-2.2.1-i686-2.7/extensions/gnm_wrap.o -L../../.libs
> -L../../ -L/usr/lib/python2.7/config -L/usr/lib
> -L/home/Rainer/repo/gdal/lib -lpython2.7 -lgdal -o
> build/lib.cygwin-2.2.1-i686-2.7/osgeo/_gnm.dll
> build/temp.cygwin-2.2.1-i686-2.7/extensions/gnm_wrap.o: In function
> `GNMNetworkShadow_GetName':
> /home/Rainer/repo/gdal/swig/python/extensions/gnm_wrap.cpp:3369: undefined
> reference to `GNMGetName'
> build/temp.cygwin-2.2.1-i686-2.7/extensions/gnm_wrap.o: In function
> `GNMNetworkShadow_GetFeatureByGlobalFID':
> /home/Rainer/repo/gdal/swig/python/extensions/gnm_wrap.cpp:3372: undefined
> reference to `GNMGetFeatureByGlobalFID'
> build/temp.cygwin-2.2.1-i686-2.7/extensions/gnm_wrap.o: In function
> `GNMNetworkShadow_GetPath':
> /home/Rainer/repo/gdal/swig/python/extensions/gnm_wrap.cpp:3520: undefined
> reference to `GNMGetPath'
> build/temp.cygwin-2.2.1-i686-2.7/extensions/gnm_wrap.o: In function
> `GNMNetworkShadow_DisconnectAll':
> /home/Rainer/repo/gdal/swig/python/extensions/gnm_wrap.cpp:3523: undefined
> reference to `GNMDisconnectAll'
> build/temp.cygwin-2.2.1-i686-2.7/extensions/gnm_wrap.o: In function
> `GNMGenericNetworkShadow_DisconnectFeatures':
> /home/Rainer/repo/gdal/swig/python/extensions/gnm_wrap.cpp:3627: undefined
> reference to `GNMDisconnectFeatures'
> build/temp.cygwin-2.2.1-i686-2.7/extensions/gnm_wrap.o: In function
> `GNMGenericNetworkShadow_DisconnectFeaturesWithId':
> /home/Rainer/repo/gdal/swig/python/extensions/gnm_wrap.cpp:3630: undefined
> reference to `GNMDisconnectFeaturesWithId'
> build/temp.cygwin-2.2.1-i686-2.7/extensions/gnm_wrap.o: In function
> `GNMGenericNetworkShadow_DeleteAllRules':
> /home/Rainer/repo/gdal/swig/python/extensions/gnm_wrap.cpp:3639: undefined
> reference to `GNMDeleteAllRules'
> build/temp.cygwin-2.2.1-i686-2.7/extensions/gnm_wrap.o: In function
> `GNMGenericNetworkShadow_GetRules':
> /home/Rainer/repo/gdal/swig/python/extensions/gnm_wrap.cpp:3645: undefined
> reference to `GNMGetRules'
> build/temp.cygwin-2.2.1-i686-2.7/extensions/gnm_wrap.o: In function
> `GNMGenericNetworkShadow_ChangeBlockState':
> /home/Rainer/repo/gdal/swig/python/extensions/gnm_wrap.cpp:3662: undefined
> reference to `GNMChangeBlockState'
> build/temp.cygwin-2.2.1-i686-2.7/extensions/gnm_wrap.o: In function
> `GNMGenericNetworkShadow_ChangeAllBlockState':
> /home/Rainer/repo/gdal/swig/python/extensions/gnm_wrap.cpp:3665: undefined
> reference to `GNMChangeAllBlockState'
> build/temp.cygwin-2.2.1-i686-2.7/extensions/gnm_wrap.o: In function
> `GNMGenericNetworkShadow_DeleteRule':
> /home/Rainer/repo/gdal/swig/python/extensions/gnm_wrap.cpp:3642: undefined
> reference to `GNMDeleteRule'
> build/temp.cygwin-2.2.1-i686-2.7/extensions/gnm_wrap.o: In function
> `GNMGenericNetworkShadow_CreateRule':
> /home/Rainer/repo/gdal/swig/python/extensions/gnm_wrap.cpp:3636: undefined
> reference to `GNMCreateRule'
> build/temp.cygwin-2.2.1-i686-2.7/extensions/gnm_wrap.o: In function
> `GNMGenericNetworkShadow_ConnectPointsByLines':
> /home/Rainer/repo/gdal/swig/python/extensions/gnm_wrap.cpp:3648: undefined
> reference to `GNMConnectPointsByLines'
> build/temp.cygwin-2.2.1-i686-2.7/extensions/gnm_wrap.o: In function
> `GNMNetworkShadow_GetVersion':
> /home/Rainer/repo/gdal/swig/python/extensions/gnm_wrap.cpp:3366: undefined
> reference to `GNMGetVersion'
> build/temp.cygwin-2.2.1-i686-2.7/extensions/gnm_wrap.o: In function
> `GNMGenericNetworkShadow_ConnectFeatures':
> /home/Rainer/repo/gdal/swig/python/extensions/gnm_wrap.cpp:3623: undefined
> reference to `GNMConnectFeatures'
> build/temp.cygwin-2.2.1-i686-2.7/extensions/gnm_wrap.o: In function
> `GNMGenericNetworkShadow_ReconnectFeatures':
> /home/Rainer/repo/gdal/swig/python/extensions/gnm_wrap.cpp:3633: undefined
> reference to `GNMReconnectFeatures' collect2: error: ld returned 1 exit
> status
> error: command 'g++' failed with exit status 1
> GNUmakefile:64: recipe for target 'build' failed
> make[2]: *** [build] Error 1
> make[2]: Leaving directory '/home/Rainer/repo/gdal/swig/python'
> GNUmakefile:30: recipe for target 'build' failed
> make[1]: *** [build] Error 2
> make[1]: Leaving directory '/home/Rainer/repo/gdal/swig'
> GNUmakefile:102: recipe for target 'swig-modules' failed
> make: *** [swig-modules] Error 2
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the gdal-dev mailing list