[gdal-dev] GDAL python bindings build error (gcc command replaced by bash)

Kai Muehlbauer kai.muehlbauer at uni-bonn.de
Fri Jul 1 04:17:54 PDT 2016


Hi James,

I did experience the same issue. See

https://lists.osgeo.org/pipermail/gdal-dev/2016-July/044678.html

Although I did not find the root cause of this, I found that in my use 
case, copying and unsetting CC and CXX environment variables did the trick.

So what I did is:

export CF_CC=$CC
export CF_CXX=$CXX
unset CC CXX
./configure CC=$CF_CC \
             CXX=$CF_CXX \
             --prefix=$PREFIX
make

Hoping for more insight by gdal-devs.

Cheers,
Kai


Am 25.05.2016 um 17:13 schrieb James Nunn:
> Hi
>
> I'm building gdal on linux (64bit ubuntu 16) with python bindings, and I'm
> coming across a strange error right at the end of the python build steps
> where exactly 4 commands which *should* be run with `x86_64-linux-gnu-gcc`
> are instead run as `/bin/bash`.
>
> Here are the last few lines of output before the error is encountered (look
> for /bin/bash -pthread ... command after the python header warnings:
>
> make[1]: Entering directory '/home/james/src/gdal/gdal/swig'
> for dir in python ; do (cd $dir; make build) || exit; done
> make[2]: Entering directory '/home/james/src/gdal/gdal/swig/python'
> rm -f setup_vars.ini
> echo 'GNM_ENABLED=no' >> setup_vars.ini
> python setup.py build
> running build
> running build_py
> creating build
> creating build/lib.linux-x86_64-2.7
> copying gdal.py -> build/lib.linux-x86_64-2.7
> copying ogr.py -> build/lib.linux-x86_64-2.7
> copying osr.py -> build/lib.linux-x86_64-2.7
> copying gdalconst.py -> build/lib.linux-x86_64-2.7
> copying gdalnumeric.py -> build/lib.linux-x86_64-2.7
> creating build/lib.linux-x86_64-2.7/osgeo
> copying osgeo/gnm.py -> build/lib.linux-x86_64-2.7/osgeo
> copying osgeo/gdalnumeric.py -> build/lib.linux-x86_64-2.7/osgeo
> copying osgeo/gdal_array.py -> build/lib.linux-x86_64-2.7/osgeo
> copying osgeo/gdalconst.py -> build/lib.linux-x86_64-2.7/osgeo
> copying osgeo/osr.py -> build/lib.linux-x86_64-2.7/osgeo
> copying osgeo/__init__.py -> build/lib.linux-x86_64-2.7/osgeo
> copying osgeo/gdal.py -> build/lib.linux-x86_64-2.7/osgeo
> copying osgeo/ogr.py -> build/lib.linux-x86_64-2.7/osgeo
> running build_ext
> building 'osgeo._gdal' extension
> creating build/temp.linux-x86_64-2.7
> creating build/temp.linux-x86_64-2.7/extensions
> x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall
> -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g
> -fstack-protector -Wformat -Werror=format-security -fPIC -I../../port
> -I../../gcore -I../../alg -I../../ogr/ -I../../ogr/ogrsf_frmts -I../../gnm
> -I../../apps -I/usr/include/python2.7
> -I/home/james/local/farmenv/local/lib/python2.7/site-packages/numpy/core/include
> -I/home/james/src/gdal/gdal/include -c extensions/gdal_wrap.cpp -o
> build/temp.linux-x86_64-2.7/extensions/gdal_wrap.o
> 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:155:
> 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:9115:31: note: in expansion of macro
> ‘PyMapping_Items’
>           PyObject *item_list = PyMapping_Items( obj1 );
>                                 ^
> /bin/bash -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions
> -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g
> -fwrapv -O2 -Wall -Wstrict-prototypes -Wdate-time -D_FORTIFY_SOURCE=2 -g
> -fstack-protector -Wformat -Werror=format-security -Wl,-Bsymbolic-functions
> -Wl,-z,relro -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector -Wformat
> -Werror=format-security build/temp.linux-x86_64-2.7/extensions/gdal_wrap.o
> -L../../.libs -L../../ -L/home/james/src/gdal/gdal/lib -lgdal -o
> build/lib.linux-x86_64-2.7/osgeo/_gdal.so
> /bin/bash: -d: invalid option
> error: command '/bin/bash' failed with exit status 1
> GNUmakefile:74: recipe for target 'build' failed
> make[2]: *** [build] Error 1
> make[2]: Leaving directory '/home/james/src/gdal/gdal/swig/python'
> GNUmakefile:30: recipe for target 'build' failed
> make[1]: *** [build] Error 2
> make[1]: Leaving directory '/home/james/src/gdal/gdal/swig'
> GNUmakefile:104: recipe for target 'swig-modules' failed
> make: *** [swig-modules] Error 2
>
>
> If I manually re-run the failing commands replacing `/bin/bash` with
> `x86_64-linux-gnu-gcc`, the entire build eventually succeeds.
>
>
> Can anyone shed light on why the command is being replaced?
>
>
> Regards
>
> James
>
>
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>

-- 
Kai Muehlbauer
Meteorological Institute University of Bonn
Auf dem Huegel 20       | +49 228 739083
D-53121 Bonn            | kai.muehlbauer at uni-bonn.de


More information about the gdal-dev mailing list