Hi all,

I tried to reproduce this with a standard linux system. So I used my OpenSuse Leap42 Box.

Steps to reproduce:

1. Download gdal-2.1.0 tarball
2. extract to some folder
3. ./configure --prefix=/usr/local --with-python
4. make

This builds fine using libtool.

5. extract gdal tarball to another folder (just to be sure)
6. export CC=gcc
7. export CXX=g++
8. ./configure --prefix=/usr/local --with-python
9. make

This fails in swig/python with the error mentioned in the OP. See attached excerpt of the build log.

I haven't found anything related to this special problem yet. But it turns out, that something is happening in the combination of `configure` and `libtool` when CC and CXX are exported in the environment. It is actually working, if you add `--without-libtool` to the call to `configure`.

To come back to my OP, we are using this approach (exporting CC and CXX) to build different packages, but only experiencing this issue with gdal so far.

It would be very helpful, if gdal-devs could have a look into this.

Thanks again!

Cheers,
Kai




Am 27.06.2016 um 20:49 schrieb Kai Mühlbauer:
Hi all,

while trying to build gdal on linux (on CircleCi in a CentOS based
docker image using conda/conda-forge) like this:

------------------------------------------------------------
export CC=gcc
export CXX=g++
export CFLAGS="${CFLAGS}"
export CXXFLAGS="${CXXFLAGS} -DBOOST_MATH_DISABLE_FLOAT128"
export LDFLAGS="${LDFLAGS}"
export LINKFLAGS="${LDFLAGS}"
export CFLAGS="${CFLAGS} -m${ARCH}"
export CXXFLAGS="${CXXFLAGS} -m${ARCH}"

export LDFLAGS="$LDFLAGS -L$PREFIX/lib"
export CPPFLAGS="$CPPFLAGS -I$PREFIX/include"

./configure --prefix=$PREFIX \
             --with-hdf4=$PREFIX \
             --with-hdf5=$PREFIX \
             --with-xerces=$PREFIX \
             --with-netcdf=$PREFIX \
             --with-geos=$PREFIX/bin/geos-config \
             --with-kea=$PREFIX/bin/kea-config \
             --with-static-proj4=$PREFIX \
             --with-libz=$PREFIX \
             --with-png=$PREFIX \
             --with-jpeg=$PREFIX \
             --with-libjson-c=$PREFIX \
             --with-expat=$PREFIX \
             --with-freexl=$PREFIX \
             --with-libtiff=$PREFIX \
             --with-xml2=$PREFIX \
             --with-openjpeg=$PREFIX \
             --with-spatialite=$PREFIX \
             --with-pg=$PREFIX/bin/pg_config \
             --with-sqlite3=$PREFIX \
             --with-curl \
             --with-python \
             --disable-rpath

make
make install
-----------------------------------------------------------

we are experiencing the same issue like posted here:

http://www.michael-joost.de/gdal_install.html

Everything works OK, until the build descends into the swig/python
subdir, then the two compile commands work using libtool. But when it
comes to linking, we get this error:

/bin/bash -pthread -shared -L/home/sam/miniconda3/envs/_build/lib
-Wl,-rpath=/home/sam/miniconda3/envs/_build/lib,--no-as-needed
-L/home/sam/miniconda3/envs/_build/lib
-L/home/sam/miniconda3/envs/_build/lib -m64 -Wall
-Wdeclaration-after-statement -Wextra -Winit-self -Wunused-parameter
-Wmissing-prototypes -Wmissing-declarations -Wformat
-Werror=format-security -Wno-format-nonliteral -Wlogical-op -Wshadow
-Werror=vla -Wdeclaration-after-statement -DOGR_ENABLED
-I/home/sam/miniconda3/envs/_build/include
-I/home/sam/miniconda3/conda-bld/work/gdal-2.1.0/port
-I/home/sam/miniconda3/envs/_build/include
-I/home/sam/miniconda3/envs/_build/include
-I/home/sam/miniconda3/envs/_build
-I/home/sam/miniconda3/envs/_build/include
-I/home/sam/miniconda3/envs/_build/include
-I/home/sam/miniconda3/envs/_build
-I/home/sam/miniconda3/envs/_build/include
-I/home/sam/miniconda3/envs/_build
-I/home/sam/miniconda3/envs/_build/include -DGDAL_COMPILATION
build/temp.linux-x86_64-3.4/extensions/gdal_wrap.o -L../../.libs
-L../../ -L/home/sam/miniconda3/envs/_build/lib
-L/home/sam/miniconda3/conda-bld/work/gdal-2.1.0/lib -lpython3.4m -lgdal
-o build/lib.linux-x86_64-3.4/osgeo/_gdal.cpython-34m.so
/bin/bash: -d: invalid option
error: command '/bin/bash' failed with exit status 1
make[2]: *** [build] Error 1
make[2]: Leaving directory
`/home/sam/miniconda3/conda-bld/work/gdal-2.1.0/swig/python'
make[1]: *** [build] Error 2
make[1]: Leaving directory
`/home/sam/miniconda3/conda-bld/work/gdal-2.1.0/swig'

Using internet search I found that it could be related to wrongly set
environment variables. But I can't find any problems so far. Using
configure with --without-libtool leads to stable build without errors.

Although we can build gdal this way, we like to find the root cause of
this libtool-problem. Any hints appreciated!

Cheers,
Kai
_______________________________________________
gdal-dev mailing list
[email protected]
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            | [email protected]
 
make[2]: Entering directory '/home/kai/conda/gdal-2.1.0/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/gdalnumeric.py -> build/lib.linux-x86_64-2.7/osgeo
copying osgeo/gdalconst.py -> build/lib.linux-x86_64-2.7/osgeo
copying osgeo/__init__.py -> build/lib.linux-x86_64-2.7/osgeo
copying osgeo/gnm.py -> build/lib.linux-x86_64-2.7/osgeo
copying osgeo/osr.py -> build/lib.linux-x86_64-2.7/osgeo
copying osgeo/gdal_array.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
/bin/sh /local/kai/conda/gdal-2.1.0/libtool --mode=compile --tag=CC gcc -fno-strict-aliasing -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -DNDEBUG -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -DOPENSSL_LOAD_CONF -fPIC -I../../port -I../../gcore -I../../alg -I../../ogr/ -I../../ogr/ogrsf_frmts -I../../gnm -I../../apps -I/usr/include/python2.7 -I/usr/lib64/python2.7/site-packages/numpy/core/include -I/local/kai/conda/gdal-2.1.0/include -c extensions/gdal_wrap.cpp -o build/temp.linux-x86_64-2.7/extensions/gdal_wrap.o
libtool: compile:  gcc -fno-strict-aliasing -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -DNDEBUG -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -DOPENSSL_LOAD_CONF -fPIC -I../../port -I../../gcore -I../../alg -I../../ogr/ -I../../ogr/ogrsf_frmts -I../../gnm -I../../apps -I/usr/include/python2.7 -I/usr/lib64/python2.7/site-packages/numpy/core/include -I/local/kai/conda/gdal-2.1.0/include -c extensions/gdal_wrap.cpp  -fPIC -DPIC -o build/temp.linux-x86_64-2.7/extensions/.libs/gdal_wrap.o
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 );
                               ^
libtool: compile:  gcc -fno-strict-aliasing -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -DNDEBUG -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -DOPENSSL_LOAD_CONF -fPIC -I../../port -I../../gcore -I../../alg -I../../ogr/ -I../../ogr/ogrsf_frmts -I../../gnm -I../../apps -I/usr/include/python2.7 -I/usr/lib64/python2.7/site-packages/numpy/core/include -I/local/kai/conda/gdal-2.1.0/include -c extensions/gdal_wrap.cpp -o build/temp.linux-x86_64-2.7/extensions/gdal_wrap.o >/dev/null 2>&1
/bin/sh -pthread -shared build/temp.linux-x86_64-2.7/extensions/gdal_wrap.o -L../../.libs -L../../ -L/usr/lib64 -L/local/kai/conda/gdal-2.1.0/lib -lpython2.7 -lgdal -o build/lib.linux-x86_64-2.7/osgeo/_gdal.so
/bin/sh: -d: Ungültige Option
error: command '/bin/sh' failed with exit status 1
GNUmakefile:74: recipe for target 'build' failed
make[2]: *** [build] Error 1
make[2]: Leaving directory '/home/kai/conda/gdal-2.1.0/swig/python'
GNUmakefile:30: recipe for target 'build' failed
make[1]: *** [build] Error 2
make[1]: Leaving directory '/home/kai/conda/gdal-2.1.0/swig'
GNUmakefile:104: recipe for target 'swig-modules' failed
make: *** [swig-modules] Error 2
_______________________________________________
gdal-dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to