[gdal-dev] Pip install: error: 'VSILFILE' was not declared

Nicholas Williams nicholas+osgeo at nicholaswilliams.net
Thu Nov 5 08:28:34 PST 2015


I'm on Ubuntu 12.04. I ran this:

apt-get install -y autoconf automake libtool make g++ gdal-bin
libgdal1-1.7.0 libgdal1-dev python-gdal

That installed GDAL 1.7.3.

Then I ran this:

export CPLUS_INCLUDE_PATH=/usr/include/gdal
export C_INCLUDE_PATH=/usr/include/gdal

Then I `pip install`-ed a requirements.txt file with this in it:

https://pypi.python.org/packages/source/G/GDAL/GDAL-1.7.1.tar.gz#md5=38b838d528b309a28a3aa24d4fcef3cd

First I tried it without the two exports above and got these errors:

fatal error: cpl_port.h: No such file or directory
compilation terminated

I quickly found on Google that I needed those two exports to solve that
problem. So I tried it with the two exports, and that solved that fatal
error, but it revealed a whole new problem (the output was very long, so I
truncated all the repetitive stuff off; I can supply full output on
request):

  Running setup.py install for GDAL
    warning: build_py: byte-compiling is disabled, skipping.
    building 'osgeo._gdal' extension
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall
-Wstrict-prototypes -fPIC -I../../port -I../../gcore -I../../alg
-I../../ogr/ -I/usr/include/python2.7
-I/usr/lib/python2.7/dist-packages/numpy/core/include -I/usr/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 Ada/C/ObjC but not for C++ [enabled by default]
    extensions/gdal_wrap.cpp:2999:67: error: ‘VSILFILE’ has not been
declared
    extensions/gdal_wrap.cpp: In function ‘int wrapper_VSIFReadL(void**,
int, int, int*)’:
...
    extensions/gdal_wrap.cpp: In function ‘int wrapper_VSIFWriteL(int,
char*, int, int, int*)’:
    extensions/gdal_wrap.cpp:3473:1: warning: control reaches end of
non-void function [-Wreturn-type]
    error: command 'gcc' failed with exit status 1
Complete output from command /usr/bin/python -c "import setuptools,
tokenize;__file__='/tmp/pip-60DWKf-build/setup.py';exec(compile(getattr(tokenize,
'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))"
install --record /tmp/pip-OEZ4Vd-record/install-record.txt
--single-version-externally-managed --compile:
    running install
    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/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/osr.py -> 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/ogr.py -> build/lib.linux-x86_64-2.7/osgeo
    warning: build_py: byte-compiling is disabled, skipping.
    running build_ext
    building 'osgeo._gdal' extension
    creating build/temp.linux-x86_64-2.7
    creating build/temp.linux-x86_64-2.7/extensions

gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall
-Wstrict-prototypes -fPIC -I../../port -I../../gcore -I../../alg
-I../../ogr/ -I/usr/include/python2.7
-I/usr/lib/python2.7/dist-packages/numpy/core/include -I/usr/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 Ada/C/ObjC but not for C++ [enabled by default]
    extensions/gdal_wrap.cpp:2999:67: error: ‘VSILFILE’ has not been
declared
    extensions/gdal_wrap.cpp: In function ‘int wrapper_VSIFReadL(void**,
int, int, int*)’:
    extensions/gdal_wrap.cpp:3034:72: error: cannot convert ‘int*’ to
‘FILE* {aka _IO_FILE*}’ for argument ‘4’ to ‘size_t VSIFReadL(void*,
size_t, size_t, FILE*)’
    extensions/gdal_wrap.cpp: In function ‘int PyProgressProxy(double,
const char*, void*)’:
    extensions/gdal_wrap.cpp:3236:2: warning: the address of
‘_Py_NoneStruct’ will never be NULL [-Waddress]
    extensions/gdal_wrap.cpp: In function ‘int wrapper_VSIStatL(const
char*, StatBuf*, int)’:
    extensions/gdal_wrap.cpp:3457:52: error: ‘VSIStatExL’ was not declared
in this scope
    extensions/gdal_wrap.cpp: At global scope:
    extensions/gdal_wrap.cpp:3465:67: error: ‘VSILFILE’ has not been
declared
    extensions/gdal_wrap.cpp: In function ‘int wrapper_VSIFWriteL(int,
char*, int, int, int*)’:
    extensions/gdal_wrap.cpp:3472:42: error: cannot convert ‘int*’ to
‘FILE* {aka _IO_FILE*}’ for argument ‘4’ to ‘size_t VSIFWriteL(const void*,
size_t, size_t, FILE*)’
    extensions/gdal_wrap.cpp: At global scope:
    extensions/gdal_wrap.cpp:3801:5: error: ‘GDALAsyncReaderH’ does not
name a type
    extensions/gdal_wrap.cpp:3807:8: error: ‘GDALAsyncReaderH’ does not
name a type
    extensions/gdal_wrap.cpp: In function ‘void
DeleteAsyncReaderWrapper(GDALAsyncReaderWrapperH)’:
    extensions/gdal_wrap.cpp:3826:20: error: ‘struct
GDALAsyncReaderWrapper’ has no member named ‘hAsyncReader’
...

Googling those errors, I also find solutions that say I need to use the two
exports above, but given that I AM using those exports, and that it solved
my earlier fatal error, I'm guessing that's not the problem here.

I've tried instead pip installing GDAL-1.9.1.tar.gz and GDAL-2.0.1.tar, but
those just fail earlier with different fatal errors. I'm under the
impression here that I need to match the Python GDAL library version with
the libgdal and python-gdal versions, so I think GDAL-1.7.1.tar.gz is
right. But I can't get the requirement to successfully install.

Help?

Thanks,

Nick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20151105/8f4ffd2a/attachment.html>


More information about the gdal-dev mailing list