OSGeo / gdal

GDAL is an open source MIT licensed translator library for raster and vector geospatial data formats.
https://gdal.org
Other
4.79k stars 2.51k forks source link

Another configure: error: PROJ 6 symbols not found issue #3485

Closed afernandezody closed 3 years ago

afernandezody commented 3 years ago

Hello, The configuration of GDAL v3.2.1 is returning the error: PROJ 6 symbols not found (not the first thread discussing this error). The system is running on CentOS8 and the PROJ version is 7.2.1 with the library built as a static one. The configuration command reads: ./configure --with-static-proj4=/usr/local --prefix=/usr/local --without-pam --with-png=/usr/local --with-gif=internal --with-libtiff=internal --with-geotiff=internal --with-jpeg=/usr/local --with-libz=/usr/local --with-sqlite3=no --with-expat=no --with-curl=no --without-ld-shared --with-hdf4=no --with-hdf5=no --with-pg=no --without-grib --disable-shared --with-freexl=no --with-geos=no --with-openjpeg=no --with-mysql=no --with-ecw=no --with-fgdb=no --with-odbc=no --with-xml2=no --with-ogdi=no --with-pcraster=no --with-xerces=no Here, the flags just follow the recommendations on how to build NCL but I also tried ./configure --with-proj=/usr/local with the same results. The config file shows many 'undefined reference' errors

configure:24801: checking for PROJ >= 6 library
configure:24834: checking for proj_create_from_wkt in -lproj
configure:24859: g++ -o conftest -DHAVE_AVX_AT_COMPILE_TIME -DHAVE_SSSE3_AT_COMPILE_TIME -DHAVE_SSE_AT_COMPILE_TIME -g -O2   conftest.cpp -lproj  -lproj  -lz -L/usr/local -L/usr/local/lib -lpthread -lm -lrt -ldl  >&5
/usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64/libproj.a(grids.o): In function `osgeo::proj::GTiffDataset::openTIFF(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
/opt/proj-7.2.1/src/grids.cpp:826: undefined reference to `TIFFClientOpen'
/opt/proj-7.2.1/src/grids.cpp:815: undefined reference to `TIFFSetTagExtender'
/usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64/libproj.a(grids.o): In function `osgeo::proj::GTiffDataset::~GTiffDataset()':
/opt/proj-7.2.1/src/grids.cpp:770: undefined reference to `TIFFClose'
/usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64/libproj.a(grids.o): In function `osgeo::proj::GTiffGrid::GTiffGrid(projCtx_t*, tiff*, osgeo::proj::BlockCache&, osgeo::proj::File*, unsigned int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int, int, osgeo::proj::ExtentAndRes const&, osgeo::proj::TIFFDataType, unsigned short, unsigned short, bool)':
/opt/proj-7.2.1/src/grids.cpp:445: undefined reference to `TIFFCurrentDirOffset'
/opt/proj-7.2.1/src/grids.cpp:446: undefined reference to `TIFFIsTiled'
/opt/proj-7.2.1/src/grids.cpp:449: undefined reference to `TIFFGetField'
/opt/proj-7.2.1/src/grids.cpp:450: undefined reference to `TIFFGetField'
/opt/proj-7.2.1/src/grids.cpp:458: undefined reference to `TIFFGetField'
/opt/proj-7.2.1/src/grids.cpp:466: undefined reference to `TIFFGetField'
/opt/proj-7.2.1/src/grids.cpp:533: undefined reference to `TIFFGetField'
/usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64/libproj.a(grids.o):/opt/proj-7.2.1/src/grids.cpp:453: more undefined references to `TIFFGetField' follow
/usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64/libproj.a(grids.o): In function `osgeo::proj::GTiffDataset::nextGrid()':
/opt/proj-7.2.1/src/grids.cpp:842: undefined reference to `TIFFSetSubDirectory'
/opt/proj-7.2.1/src/grids.cpp:871: undefined reference to `TIFFGetField'
/opt/proj-7.2.1/src/grids.cpp:877: undefined reference to `TIFFGetField'
/opt/proj-7.2.1/src/grids.cpp:903: undefined reference to `TIFFGetField'
/opt/proj-7.2.1/src/grids.cpp:911: undefined reference to `TIFFGetField'
/opt/proj-7.2.1/src/grids.cpp:926: undefined reference to `TIFFIsTiled'
/opt/proj-7.2.1/src/grids.cpp:926: undefined reference to `TIFFTileSize64'
/opt/proj-7.2.1/src/grids.cpp:915: undefined reference to `TIFFIsCODECConfigured'
/opt/proj-7.2.1/src/grids.cpp:927: undefined reference to `TIFFStripSize64'
/opt/proj-7.2.1/src/grids.cpp:940: undefined reference to `TIFFGetField'
/opt/proj-7.2.1/src/grids.cpp:993: undefined reference to `TIFFGetField'
/opt/proj-7.2.1/src/grids.cpp:1010: undefined reference to `TIFFGetField'
/opt/proj-7.2.1/src/grids.cpp:1071: undefined reference to `TIFFReadDirectory'
/opt/proj-7.2.1/src/grids.cpp:1072: undefined reference to `TIFFCurrentDirOffset'
/opt/proj-7.2.1/src/grids.cpp:1024: undefined reference to `TIFFGetField'
/usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64/libproj.a(grids.o): In function `osgeo::proj::GTiffGrid::valueAt(unsigned short, int, int, float&) const':
/opt/proj-7.2.1/src/grids.cpp:614: undefined reference to `TIFFCurrentDirOffset'
/opt/proj-7.2.1/src/grids.cpp:615: undefined reference to `TIFFSetSubDirectory'
/opt/proj-7.2.1/src/grids.cpp:630: undefined reference to `TIFFReadEncodedTile'
/opt/proj-7.2.1/src/grids.cpp:635: undefined reference to `TIFFReadEncodedStrip'
/opt/proj-7.2.1/src/grids.cpp:620: undefined reference to `TIFFTileSize64'
/opt/proj-7.2.1/src/grids.cpp:620: undefined reference to `TIFFStripSize64'

with another 400 lines of undefined references. Thanks.

rouault commented 3 years ago

Static linking makes life more difficult usually. You may want to add the --with-proj-extra-lib-for-test=-ltiff switch to GDAL configure

afernandezody commented 3 years ago

Agreed. That's why I asked the NCL Team earlier this morning if it was mandatory to build the PROJ library as static.

afernandezody commented 3 years ago

Hi @rouault, I didn't hear back from the NCL Team so I had to sort this out on my own and hope that NCL will accept the configuration. At the end, I ended up recompiling PROJ without any constrain so it built both static and shared libraries (when I tried only shared, it was still producing the error, not sure why). Then, building gdal completed smoothly. Thank you for the help.