I am getting increasingly frustrated with this issue, but I have been trying to reinstall GDAL in order to install the new version of QGIS. When I try to install it using pip install GDAL
I get the following:
Installing collected packages: GDAL
Running setup.py install for GDAL
building 'osgeo._gdal' extension
cc -fno-strict-aliasing -fno-common -dynamic -I/usr/local/include -I/usr/local/opt/sqlite/include -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I../../port -I../../gcore -I../../alg -I../../ogr/ -I/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I/usr/local/lib/python2.7/site-packages/numpy/core/include -I/Library/Frameworks/GDAL.framework/Versions/1.9/include -c extensions/gdal_wrap.cpp -o build/temp.macosx-10.7-x86_64-2.7/extensions/gdal_wrap.o
extensions/gdal_wrap.cpp:2230:11: warning: explicitly assigning a variable of type 'int' to itself [-Wself-assign]
res = SWIG_AddCast(res);
~~~ ^ ~~~
extensions/gdal_wrap.cpp:2233:11: warning: explicitly assigning a variable of type 'int' to itself [-Wself-assign]
res = SWIG_AddCast(res);
~~~ ^ ~~~
extensions/gdal_wrap.cpp:3515:12: error: use of undeclared identifier 'GDALGetMetadataDomainList'
return GDALGetMetadataDomainList( self );
^
extensions/gdal_wrap.cpp:3753:5: error: unknown type name 'CPLVirtualMem'
CPLVirtualMem *vmem;
^
extensions/gdal_wrap.cpp:3761:5: error: unknown type name 'GDALTileOrganization'
GDALTileOrganization eTileOrganization;
^
extensions/gdal_wrap.cpp:3836:15: warning: unused variable 'start_addr' [-Wunused-variable]
char* start_addr = (char*)CPLVirtualMemGetAddr( self->vmem ) + start_offset;
^
extensions/gdal_wrap.cpp:4237:9: error: unknown type name 'CPLVirtualMem'
CPLVirtualMem* vmem = GDALDatasetGetVirtualMem( self,
^
extensions/gdal_wrap.cpp:4237:31: error: use of undeclared identifier 'GDALDatasetGetVirtualMem'
CPLVirtualMem* vmem = GDALDatasetGetVirtualMem( self,
^
extensions/gdal_wrap.cpp:4263:237: error: unknown type name 'GDALTileOrganization'
SWIGINTERN CPLVirtualMemShadow *GDALDatasetShadow_GetTiledVirtualMem(GDALDatasetShadow *self,GDALRWFlag eRWFlag,int nXOff,int nYOff,int nXSize,int nYSize,int nTileXSize,int nTileYSize,GDALDataType eBufType,int band_list,int *pband_list,GDALTileOrganization eTileOrganization,size_t nCacheSize,char **options=NULL){
^
extensions/gdal_wrap.cpp:4266:9: error: unknown type name 'CPLVirtualMem'
CPLVirtualMem* vmem = GDALDatasetGetTiledVirtualMem( self,
^
extensions/gdal_wrap.cpp:4620:9: error: unknown type name 'CPLVirtualMem'
CPLVirtualMem* vmem = GDALRasterBandGetVirtualMem( self,
^
extensions/gdal_wrap.cpp:4620:31: error: use of undeclared identifier 'GDALRasterBandGetVirtualMem'
CPLVirtualMem* vmem = GDALRasterBandGetVirtualMem( self,
^
extensions/gdal_wrap.cpp:4647:9: error: unknown type name 'CPLVirtualMem'
CPLVirtualMem* vmem = GDALGetVirtualMemAuto( self,
^
extensions/gdal_wrap.cpp:4647:31: error: use of undeclared identifier 'GDALGetVirtualMemAuto'
CPLVirtualMem* vmem = GDALGetVirtualMemAuto( self,
^
extensions/gdal_wrap.cpp:4667:9: error: unknown type name 'CPLVirtualMem'
CPLVirtualMem* vmem = GDALRasterBandGetTiledVirtualMem( self,
^
extensions/gdal_wrap.cpp:4667:31: error: use of undeclared identifier 'GDALRasterBandGetTiledVirtualMem'; did you mean 'GDALRasterBandShadow_GetVirtualMem'?
CPLVirtualMem* vmem = GDALRasterBandGetTiledVirtualMem( self,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
GDALRasterBandShadow_GetVirtualMem
extensions/gdal_wrap.cpp:4619:33: note: 'GDALRasterBandShadow_GetVirtualMem' declared here
SWIGINTERN CPLVirtualMemShadow *GDALRasterBandShadow_GetVirtualMem(GDALRasterBandShadow *self,GDALRWFlag eRWFlag,int nXOff,int nYOff,int nXSize,int nYSize,int nBufXSize,int nBufYSize,GDALDataType eBufType,size_t nCacheSize,size_t nPageSizeHint,char **options=NULL){
^
extensions/gdal_wrap.cpp:4685:41: error: use of undeclared identifier 'GTO_BSQ'
vmemshadow->eTileOrganization = GTO_BSQ;
^
extensions/gdal_wrap.cpp:4867:16: error: use of undeclared identifier 'GDALRATChangesAreWrittenToFile'
return GDALRATChangesAreWrittenToFile( self );
^
extensions/gdal_wrap.cpp:7845:31: warning: conversion from string literal to 'char *' is deprecated [-Wdeprecated-writable-strings]
PyObject *item_list = PyMapping_Items( obj1 );
^
/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/include/python2.7/abstract.h:1354:50: note: expanded from macro 'PyMapping_Items'
#define PyMapping_Items(O) PyObject_CallMethod(O,"items",NULL)
^
extensions/gdal_wrap.cpp:11385:21: warning: conversion from string literal to 'char *' is deprecated [-Wdeprecated-writable-strings]
buf->format = "B";
^
extensions/gdal_wrap.cpp:11390:21: warning: conversion from string literal to 'char *' is deprecated [-Wdeprecated-writable-strings]
buf->format = "h";
^
extensions/gdal_wrap.cpp:11395:21: warning: conversion from string literal to 'char *' is deprecated [-Wdeprecated-writable-strings]
buf->format = "H";
^
extensions/gdal_wrap.cpp:11400:21: warning: conversion from string literal to 'char *' is deprecated [-Wdeprecated-writable-strings]
buf->format = "i";
^
extensions/gdal_wrap.cpp:11405:21: warning: conversion from string literal to 'char *' is deprecated [-Wdeprecated-writable-strings]
buf->format = "I";
^
extensions/gdal_wrap.cpp:11410:21: warning: conversion from string literal to 'char *' is deprecated [-Wdeprecated-writable-strings]
buf->format = "f";
^
extensions/gdal_wrap.cpp:11415:21: warning: conversion from string literal to 'char *' is deprecated [-Wdeprecated-writable-strings]
buf->format = "F";
^
extensions/gdal_wrap.cpp:11420:21: warning: conversion from string literal to 'char *' is deprecated [-Wdeprecated-writable-strings]
buf->format = "B";
^
extensions/gdal_wrap.cpp:13656:3: error: unknown type name 'GDALTileOrganization'
GDALTileOrganization arg12 ;
^
extensions/gdal_wrap.cpp:13768:24: error: unknown type name 'GDALTileOrganization'
arg12 = static_cast< GDALTileOrganization >(val12);
^
extensions/gdal_wrap.cpp:23687:14: warning: explicitly assigning a variable of type 'void *' to itself [-Wself-assign]
clientdata = clientdata;
~~~~~~~~~~ ^ ~~~~~~~~~~
13 warnings and 17 errors generated.
error: command 'cc' failed with exit status 1
Complete output from command /usr/local/opt/python/bin/python2.7 -c "import setuptools;__file__='/private/var/folders/y2/thsw8bnj0xz0vp55gcykptfw0000gn/T/pip_build_root/GDAL/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/y2/thsw8bnj0xz0vp55gcykptfw0000gn/T/pip-bLqvAE-record/install-record.txt --single-version-externally-managed:
running install
running build
running build_py
creating build
creating build/lib.macosx-10.7-x86_64-2.7
copying gdal.py -> build/lib.macosx-10.7-x86_64-2.7
copying ogr.py -> build/lib.macosx-10.7-x86_64-2.7
copying osr.py -> build/lib.macosx-10.7-x86_64-2.7
copying gdalconst.py -> build/lib.macosx-10.7-x86_64-2.7
copying gdalnumeric.py -> build/lib.macosx-10.7-x86_64-2.7
creating build/lib.macosx-10.7-x86_64-2.7/osgeo
copying osgeo/__init__.py -> build/lib.macosx-10.7-x86_64-2.7/osgeo
copying osgeo/gdal.py -> build/lib.macosx-10.7-x86_64-2.7/osgeo
copying osgeo/gdal_array.py -> build/lib.macosx-10.7-x86_64-2.7/osgeo
copying osgeo/gdalconst.py -> build/lib.macosx-10.7-x86_64-2.7/osgeo
copying osgeo/gdalnumeric.py -> build/lib.macosx-10.7-x86_64-2.7/osgeo
copying osgeo/ogr.py -> build/lib.macosx-10.7-x86_64-2.7/osgeo
copying osgeo/osr.py -> build/lib.macosx-10.7-x86_64-2.7/osgeo
running build_ext
building 'osgeo._gdal' extension
creating build/temp.macosx-10.7-x86_64-2.7
creating build/temp.macosx-10.7-x86_64-2.7/extensions
cc -fno-strict-aliasing -fno-common -dynamic -I/usr/local/include -I/usr/local/opt/sqlite/include -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I../../port -I../../gcore -I../../alg -I../../ogr/ -I/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I/usr/local/lib/python2.7/site-packages/numpy/core/include -I/Library/Frameworks/GDAL.framework/Versions/1.9/include -c extensions/gdal_wrap.cpp -o build/temp.macosx-10.7-x86_64-2.7/extensions/gdal_wrap.o
extensions/gdal_wrap.cpp:2230:11: warning: explicitly assigning a variable of type 'int' to itself [-Wself-assign]
res = SWIG_AddCast(res);
~~~ ^ ~~~
extensions/gdal_wrap.cpp:2233:11: warning: explicitly assigning a variable of type 'int' to itself [-Wself-assign]
res = SWIG_AddCast(res);
~~~ ^ ~~~
extensions/gdal_wrap.cpp:3515:12: error: use of undeclared identifier 'GDALGetMetadataDomainList'
return GDALGetMetadataDomainList( self );
^
extensions/gdal_wrap.cpp:3753:5: error: unknown type name 'CPLVirtualMem'
CPLVirtualMem *vmem;
^
extensions/gdal_wrap.cpp:3761:5: error: unknown type name 'GDALTileOrganization'
GDALTileOrganization eTileOrganization;
^
extensions/gdal_wrap.cpp:3836:15: warning: unused variable 'start_addr' [-Wunused-variable]
char* start_addr = (char*)CPLVirtualMemGetAddr( self->vmem ) + start_offset;
^
extensions/gdal_wrap.cpp:4237:9: error: unknown type name 'CPLVirtualMem'
CPLVirtualMem* vmem = GDALDatasetGetVirtualMem( self,
^
extensions/gdal_wrap.cpp:4237:31: error: use of undeclared identifier 'GDALDatasetGetVirtualMem'
CPLVirtualMem* vmem = GDALDatasetGetVirtualMem( self,
^
extensions/gdal_wrap.cpp:4263:237: error: unknown type name 'GDALTileOrganization'
SWIGINTERN CPLVirtualMemShadow *GDALDatasetShadow_GetTiledVirtualMem(GDALDatasetShadow *self,GDALRWFlag eRWFlag,int nXOff,int nYOff,int nXSize,int nYSize,int nTileXSize,int nTileYSize,GDALDataType eBufType,int band_list,int *pband_list,GDALTileOrganization eTileOrganization,size_t nCacheSize,char **options=NULL){
^
extensions/gdal_wrap.cpp:4266:9: error: unknown type name 'CPLVirtualMem'
CPLVirtualMem* vmem = GDALDatasetGetTiledVirtualMem( self,
^
extensions/gdal_wrap.cpp:4620:9: error: unknown type name 'CPLVirtualMem'
CPLVirtualMem* vmem = GDALRasterBandGetVirtualMem( self,
^
extensions/gdal_wrap.cpp:4620:31: error: use of undeclared identifier 'GDALRasterBandGetVirtualMem'
CPLVirtualMem* vmem = GDALRasterBandGetVirtualMem( self,
^
extensions/gdal_wrap.cpp:4647:9: error: unknown type name 'CPLVirtualMem'
CPLVirtualMem* vmem = GDALGetVirtualMemAuto( self,
^
extensions/gdal_wrap.cpp:4647:31: error: use of undeclared identifier 'GDALGetVirtualMemAuto'
CPLVirtualMem* vmem = GDALGetVirtualMemAuto( self,
^
extensions/gdal_wrap.cpp:4667:9: error: unknown type name 'CPLVirtualMem'
CPLVirtualMem* vmem = GDALRasterBandGetTiledVirtualMem( self,
^
extensions/gdal_wrap.cpp:4667:31: error: use of undeclared identifier 'GDALRasterBandGetTiledVirtualMem'; did you mean 'GDALRasterBandShadow_GetVirtualMem'?
CPLVirtualMem* vmem = GDALRasterBandGetTiledVirtualMem( self,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
GDALRasterBandShadow_GetVirtualMem
extensions/gdal_wrap.cpp:4619:33: note: 'GDALRasterBandShadow_GetVirtualMem' declared here
SWIGINTERN CPLVirtualMemShadow *GDALRasterBandShadow_GetVirtualMem(GDALRasterBandShadow *self,GDALRWFlag eRWFlag,int nXOff,int nYOff,int nXSize,int nYSize,int nBufXSize,int nBufYSize,GDALDataType eBufType,size_t nCacheSize,size_t nPageSizeHint,char **options=NULL){
^
extensions/gdal_wrap.cpp:4685:41: error: use of undeclared identifier 'GTO_BSQ'
vmemshadow->eTileOrganization = GTO_BSQ;
^
extensions/gdal_wrap.cpp:4867:16: error: use of undeclared identifier 'GDALRATChangesAreWrittenToFile'
return GDALRATChangesAreWrittenToFile( self );
^
extensions/gdal_wrap.cpp:7845:31: warning: conversion from string literal to 'char *' is deprecated [-Wdeprecated-writable-strings]
PyObject *item_list = PyMapping_Items( obj1 );
^
/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/include/python2.7/abstract.h:1354:50: note: expanded from macro 'PyMapping_Items'
#define PyMapping_Items(O) PyObject_CallMethod(O,"items",NULL)
^
extensions/gdal_wrap.cpp:11385:21: warning: conversion from string literal to 'char *' is deprecated [-Wdeprecated-writable-strings]
buf->format = "B";
^
extensions/gdal_wrap.cpp:11390:21: warning: conversion from string literal to 'char *' is deprecated [-Wdeprecated-writable-strings]
buf->format = "h";
^
extensions/gdal_wrap.cpp:11395:21: warning: conversion from string literal to 'char *' is deprecated [-Wdeprecated-writable-strings]
buf->format = "H";
^
extensions/gdal_wrap.cpp:11400:21: warning: conversion from string literal to 'char *' is deprecated [-Wdeprecated-writable-strings]
buf->format = "i";
^
extensions/gdal_wrap.cpp:11405:21: warning: conversion from string literal to 'char *' is deprecated [-Wdeprecated-writable-strings]
buf->format = "I";
^
extensions/gdal_wrap.cpp:11410:21: warning: conversion from string literal to 'char *' is deprecated [-Wdeprecated-writable-strings]
buf->format = "f";
^
extensions/gdal_wrap.cpp:11415:21: warning: conversion from string literal to 'char *' is deprecated [-Wdeprecated-writable-strings]
buf->format = "F";
^
extensions/gdal_wrap.cpp:11420:21: warning: conversion from string literal to 'char *' is deprecated [-Wdeprecated-writable-strings]
buf->format = "B";
^
extensions/gdal_wrap.cpp:13656:3: error: unknown type name 'GDALTileOrganization'
GDALTileOrganization arg12 ;
^
extensions/gdal_wrap.cpp:13768:24: error: unknown type name 'GDALTileOrganization'
arg12 = static_cast< GDALTileOrganization >(val12);
^
extensions/gdal_wrap.cpp:23687:14: warning: explicitly assigning a variable of type 'void *' to itself [-Wself-assign]
clientdata = clientdata;
~~~~~~~~~~ ^ ~~~~~~~~~~
13 warnings and 17 errors generated.
error: command 'cc' failed with exit status 1
The main point being the last line: error: command 'cc' failed with exit status
. I have tried virtually every fix I found on Stackoverflow and everywhere else, from the export CFLAG strategy to deleting files. I still get that error.
Can anyone help please.
I've just run into this (hence finding your question). I solved it by making sure that the version of (Python's) GDAL
I was trying to install matched that of the libgdal
on the system.
In my case pip was pulling in GDAL==1.11.0
, whereas the version of libgdal
I had was 1.10.1+dfsg-5ubuntu1
. Running pip install GDAL==1.10.0
(maybe with the actual version substituted) should do the right thing.
Your compiler error is GDAL 1.11.0
expecting symbols that are only there in the most recent version of libgdal
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With