[R-sig-Geo] rgdal configure errors for proj test

Bennet Fauber bennet @end|ng |rom um|ch@edu
Mon Jun 15 02:49:07 CEST 2020


That seems to have done the trick for my case!  Thanks!  Details
included below include the svn revision number and the results of
configure.

If it helps any, the line I suggested adding (with an additional
library variable) is in the original configure.ac in the sf library.
I include that below the configure output at the end of the message,
in case it is of use or interest

I tried just now with

$ svn checkout svn://scm.r-forge.r-project.org/svnroot/rgdal/
A    rgdal/pkg
....
A    rgdal/old/old_0.6-28/man/closeDataset-methods.Rd
A    rgdal/old/old_0.6-28/NAMESPACE
Checked out revision 1010.

and it builds without error.

$ ./configure --prefix=/tmp/local
configure: R_HOME: /sw/arcts/centos7/R/3.6.3/lib64/R
configure: CC: gcc
configure: CXX: g++ -std=gnu++11
configure: CXX11 is: g++, CXX11STD is: -std=gnu++11
configure: CXX is: g++ -std=gnu++11
configure: C++11 support available
configure: rgdal: 1.5-11
checking for /usr/bin/svnversion... yes
cat: inst/SVN_VERSION: No such file or directory
configure: svn revision:
checking for gdal-config...
/sw/arcts/centos7/gcc_8_2_0/gdal/3.1.0/bin/gdal-config
checking gdal-config usability... yes
configure: GDAL: 3.1.0
checking GDAL version >= 1.11.4... yes
checking GDAL version <= 2.5 or >= 3.0... yes
checking GDAL: linking with --libs only... yes
checking GDAL: gdal-config data directory readable... yes
checking GDAL: /sw/arcts/centos7/gcc_8_2_0/gdal/3.1.0/share/gdal/stateplane.csv
readable... yes
configure: pkg-config proj exists, will use it
configure: PROJ version: 6.2.1
configure: PROJ CPP flags: -DPROJ_H_API
-I/sw/arcts/centos7/gcc_8_2_0/proj/6.2.1/include
configure: PROJ LIBS: -L/sw/arcts/centos7/gcc_8_2_0/proj/6.2.1/lib -lproj
checking PROJ header API:... yes
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether g++ -std=gnu++11 accepts -g... yes
checking how to run the C++ preprocessor... g++ -std=gnu++11 -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking proj.h usability... yes
checking proj.h presence... yes
checking for proj.h... yes
checking for proj_context_create in -lproj... yes
checking Using GDAL < 3 with PROJ >= 6... no
checking PROJ version >= 4.8.0... yes
checking PROJ: proj.db found and readable... yes
configure: Package CPP flags:
-I/sw/arcts/centos7/gcc_8_2_0/gdal/3.1.0/include
-I/sw/arcts/centos7/gcc_8_2_0/proj/6.2.1/include   -DPROJ_H_API
configure: Package LIBS:  -L/sw/arcts/centos7/gcc_8_2_0/gdal/3.1.0/lib
-lgdal -L/sw/arcts/centos7/gcc_8_2_0/proj/6.2.1/lib -lproj
configure: creating ./config.status
config.status: creating src/Makevars


sf_0.9-3tar.gz:  sf/configure.ac

378 # dnl ditto for a library path
379 AC_ARG_WITH([proj-lib],
380     AC_HELP_STRING([--with-proj-lib=LIB_PATH],
381                [the location of proj libraries]),
382                [proj_lib_path=$withval])
383 if test [ -n "$proj_lib_path" ] ; then
384     AC_SUBST([PROJ_LIBS], ["-L${proj_lib_path} ${INPKG_LIBS} -lproj"])
385 else
386   if test "${proj_config_ok}" = yes; then
387     PROJ_LIB_PATH=`${PROJ_CONFIG} --libs`
388     AC_SUBST([PROJ_LIBS], ["${PROJ_LIB_PATH} ${INPKG_LIBS}"])
389     proj_version=`${PROJ_CONFIG} --modversion`
390     AC_MSG_NOTICE([PROJ: ${proj_version}])
391   else
392     PROJ_LIBS="${PKG_LIBS} -lproj"
393   fi
394 fi
395
396 LIBS="${PROJ_LIBS} ${INLIBS} ${PKG_LIBS}"


On Sun, Jun 14, 2020 at 3:25 PM Roger Bivand <Roger.Bivand using nhh.no> wrote:
>
> Thanks, I've only checked your patch locally. Please try rev. 1010 when/if
> it completes building on R-Forge. I'd be grateful if others can also check
> the current rgdal status, as quite a number of changes have entered
> configure.ac since 1.5-8, and only some are in 1.5-10.
>
> Roger
>
> On Sun, 14 Jun 2020, Bennet Fauber wrote:
>
> > Summary
> >
> > I was getting errors from the configure script that it could not find
> > the proj library file when it is installed outside of /usr/local.  A
> > one line change to configure.ac and rerunning autoreconf solves the
> > problem.  This problem exists both in the tar ball supplied by CRAN
> > mirrors and in the version provided by
> >
> > $ svn checkout svn://scm.r-forge.r-project.org/svnroot/rgdal/
> > . . . .
> > Checked out revision 1009.
> >
> > I hope that sufficient detail is provided in what follows to understand
> > the environment, the error, and why the proposed fix works.  There is
> > almost certainly a better way to resolve the issue, but the proposed one
> > does work.  I hope it will isolate the problem sufficiently that a more
> > correct fix can be created.
> >
> >
> > Environment description
> >
> > #------------------------------------------------------------------------
> > CentOS Linux release 7.7.1908 (Core)
> > 3.10.0-1062.9.1.el7.x86_64
> >
> > GCC 8.2.0  Compiled from source
> > R version 3.6.3 (2020-02-29)  Compiled from source with gcc/8.2.0
> >
> > #------------------------------------------------------------------------
> > 06-11-2020 09:22 $ wget http://download.osgeo.org/geos/geos-3.8.1.tar.bz2
> >
> > ./configure --prefix=/sw/arcts/centos7/gcc_8_2_0/geos/3.8.1
> >
> > #------------------------------------------------------------------------
> > 06-11-2020 09:26 $ wget http://download.osgeo.org/gdal/CURRENT/gdal-3.1.0.tar.gz
> >
> > ./configure --prefix=/sw/arcts/centos7/gcc_8_2_0/gdal/3.1.0 \
> >    --with-libtiff=$IMG_LIBS_HOME \
> >    --with-libjpeg=$IMG_LIBS_HOME --with-gif=$IMG_LIBS_HOME \
> >    --with-hdf4=$HDF4_ROOT --with-hdf5=$HDF5_ROOT \
> >    --with-geos=$GEOS_HOME --with-proj=$PROJ_HOME
> >
> > #------------------------------------------------------------------------
> > 06-11-2020 19:44 $ wget https://download.osgeo.org/proj/proj-6.2.1.tar.gz
> >
> > ./configure --prefix=/sw/arcts/centos7/gcc_8_2_0/proj/6.2.1
> >
> > # Into the build directory, and before running make ; make install, we
> >
> > unzip -o /sw/src/arcts/proj/proj-datumgrid-1.8.zip -d data
> >
> > #------------------------------------------------------------------------
> >
> > All of the base libraries pass tests and are known to work properly.
> >
> >
> >
> > All R libraries obtained from a mirror of CRAN.
> >
> > The prerequisite libraries for rgdal were install with these commands
> > and were successful.
> >
> > install.packages('tidyverse', "/sw/arcts/centos7/Rgeospatial/062020")
> > install.packages('sf', "/sw/arcts/centos7/Rgeospatial/062020")
> > install.packages('rgeos', "/sw/arcts/centos7/Rgeospatial/062020")
> >
> >
> > Rgdal installation
> >
> > # First attempted this install.packages(rgdal) command, which has worked
> > # in past years with slightly different versions
> > # (comand line broken for legibility)
> >
> > install.packages('rgdal',
> >    configure.args=c("--with-proj-include=${PROJ_INCLUDE}",
> >                     "--with-proj-lib=${PROJ_LIB}",
> >                     "--with-proj-share=${PROJ_SHARE}")
> >                    )
> >
> > That failed on the configure test of `proj_create_context` because it is
> > unable to find the library with this message from `configure`.  See note
> > at the end of this message for the complete transcript of the first attempt
> > at installation.
> >
> >>> /usr/bin/ld: cannot find -lproj
> >
> > The rgdal installation reports that it can find proj, and it is usable.  The
> > following excerpt from the transcript shows configure properly finding
> > the proj libraries from pkg-config, and that it knows the proper PROJ_LIBS.
> >
> > configure: pkg-config proj exists, will use it
> > configure: PROJ version: 6.2.1
> > configure: proj CPP flags: -DPROJ_H_API
> > -I/sw/arcts/centos7/gcc_8_2_0/proj/6.2.1/include
> > configure: PROJ LIBS: -L/sw/arcts/centos7/gcc_8_2_0/proj/6.2.1/lib -lproj
> > checking PROJ header API:... yes
> >
> > Somewhere between that test and compilation of the test code for
> > proj_context_create shown above, it clearly loses the needed
> > '-L/sw/arcts/centos7/gcc_8_2_0/proj/6.2.1/lib' portion of PROJ LIBS.
> >
> >
> > Debugging information
> >
> > To debug this, I unpacked the .tar.gz of the R package and ran `configure`
> > by hand.  I obtained the same result.
> >
> > Looking in the config.log generated by `configure`, I find that the compile
> > command used was.  This confirms that the library location if reported
> > finding is not being used on the compile command for this test.
> >
> >    configure:3894: gcc -o conftest -O3 -mtune=native -I/usr/local/include
> >    -DPROJ_H_API -I/sw/arcts/centos7/gcc_8_2_0/proj/6.2.1/include
> >    -L/usr/local/lib64 conftest.c -lproj
> >    -L/sw/arcts/centos7/gcc_8_2_0/gdal/3.1.0/lib -lgdal >&5
> >
> >
> > Nonetheless, I confirmed that by extracting the test code and compiling it
> > by hand with the correct library flag provided, it compiles.  I modified
> > the `configure` script to include the missing library specification, and
> > `configure` also then runs to completion.  That confirms that the problem
> > really is the missing '-L/sw/arcts/centos7/gcc_8_2_0/proj/6.2.1/lib' portion
> > of PROJ LIBS.
> >
> > I then tried to locate where in the configure.ac file the library was
> > being lost or not set for the test, but I was only able to determine that
> > by adding $PKG_LIBS to LIBS manually after the block where the proj-libs
> > are determined, configure would now run to completion; it did.
> >
> > I then applied the patch and recreated the installation tar ball to be used
> > with install.packages().
> >
> > The procedure for doing that is to unpack rgdal_1.5-10.tar.gz as distributed
> > by CRAN mirrors, change to the rgdal directory, apply this patch,
> >
> >
> > *** configure.ac.original    2020-06-14 10:44:31.999142923 -0400
> > --- configure.ac    2020-06-14 10:47:59.830661680 -0400
> > ***************
> > *** 397,402 ****
> > --- 397,403 ----
> >    fi # proj_config_ok
> >  fi # proj_lib_path
> >
> > + LIBS="${PKG_LIBS} ${LIBS}"
> >  AC_MSG_NOTICE([PROJ LIBS: ${PKG_LIBS}])
> >
> >
> > run autoreconf to regenerate the configure script, obtain new md5sums for
> > configure and configure.ac, patch the MD5 file, change to the directory
> > above, tar the rgdal directory that contains the patched files, and use
> > that to install rgdal with install.packages().
> >
> >
> > After installation of the patched version, I get this upon loading the rgdal
> > library.
> >
> >> library(rgdal)
> > Loading required package: sp
> > rgdal: version: 1.5-10, (SVN revision 1006)
> > Geospatial Data Abstraction Library extensions to R successfully loaded
> > Loaded GDAL runtime: GDAL 3.1.0, released 2020/05/03
> > Path to GDAL shared files: /sw/arcts/centos7/gcc_8_2_0/gdal/3.1.0/share/gdal
> > GDAL binary built with GEOS: FALSE
> > Loaded PROJ runtime: Rel. 6.2.1, November 1st, 2019, [PJ_VERSION: 621]
> > Path to PROJ shared files: /sw/arcts/centos7/gcc_8_2_0/proj/6.2.1/share/proj
> > Linking to sp version:1.4-2
> > To mute warnings of possible GDAL/OSR exportToProj4() degradation,
> > use options("rgdal_show_exportToProj4_warnings"="none") before loading rgdal.
> >
> >
> >
> >
> > #============================================================================
> > #
> > # Transcript of the first, failed installation attempt
> > #
> > #============================================================================
> >
> >> install.packages('rgdal', "/sw/arcts/centos7/Rgeospatial/062020", repos="https://repo.miserver.it.umich.edu/cran/")
> > trying URL 'https://repo.miserver.it.umich.edu/cran/src/contrib/rgdal_1.5-10.tar.gz'
> > Content type 'application/octet-stream' length 2300923 bytes (2.2 MB)
> > ==================================================
> > downloaded 2.2 MB
> >
> > * installing *source* package ‘rgdal’ ...
> > ** package ‘rgdal’ successfully unpacked and MD5 sums checked
> > ** using staged installation
> > configure: R_HOME: /sw/arcts/centos7/R/3.6.3/lib64/R
> > configure: CC: gcc
> > configure: CXX: g++ -std=gnu++11
> > configure: CXX11 is: g++, CXX11STD is: -std=gnu++11
> > configure: CXX is: g++ -std=gnu++11
> > configure: C++11 support available
> > configure: rgdal: 1.5-10
> > checking for /usr/bin/svnversion... yes
> > configure: svn revision: 1006
> > checking for gdal-config...
> > /sw/arcts/centos7/gcc_8_2_0/gdal/3.1.0/bin/gdal-config
> > checking gdal-config usability... yes
> > configure: GDAL: 3.1.0
> > checking GDAL version >= 1.11.4... yes
> > checking GDAL version <= 2.5 or >= 3.0... yes
> > checking gdal: linking with --libs only... yes
> > checking GDAL: gdal-config data directory readable... yes
> > checking GDAL: /sw/arcts/centos7/gcc_8_2_0/gdal/3.1.0/share/gdal/stateplane.csv
> > readable... yes
> > configure: pkg-config proj exists, will use it
> > configure: PROJ version: 6.2.1
> > configure: proj CPP flags: -DPROJ_H_API
> > -I/sw/arcts/centos7/gcc_8_2_0/proj/6.2.1/include
> > configure: PROJ LIBS: -L/sw/arcts/centos7/gcc_8_2_0/proj/6.2.1/lib -lproj
> > checking PROJ header API:... yes
> > checking for gcc... gcc
> > checking whether the C compiler works... yes
> > checking for C compiler default output file name... a.out
> > checking for suffix of executables...
> > checking whether we are cross compiling... no
> > checking for suffix of object files... o
> > checking whether we are using the GNU C compiler... yes
> > checking whether gcc accepts -g... yes
> > checking for gcc option to accept ISO C89... none needed
> > checking how to run the C preprocessor... gcc -E
> > checking for grep that handles long lines and -e... /usr/bin/grep
> > checking for egrep... /usr/bin/grep -E
> > checking for ANSI C header files... yes
> > checking for sys/types.h... yes
> > checking for sys/stat.h... yes
> > checking for stdlib.h... yes
> > checking for string.h... yes
> > checking for memory.h... yes
> > checking for strings.h... yes
> > checking for inttypes.h... yes
> > checking for stdint.h... yes
> > checking for unistd.h... yes
> > checking proj.h usability... yes
> > checking proj.h presence... yes
> > checking for proj.h... yes
> > checking for proj_context_create in -lproj... no
> > configure: error: proj_context_create not found in libproj.
> > ERROR: configuration failed for package ‘rgdal’
> >
> > _______________________________________________
> > R-sig-Geo mailing list
> > R-sig-Geo using r-project.org
> > https://stat.ethz.ch/mailman/listinfo/r-sig-geo
> >
>
> --
> Roger Bivand
> Department of Economics, Norwegian School of Economics,
> Helleveien 30, N-5045 Bergen, Norway.
> voice: +47 55 95 93 55; e-mail: Roger.Bivand using nhh.no
> https://orcid.org/0000-0003-2392-6140
> https://scholar.google.no/citations?user=AWeghB0AAAAJ&hl=en



More information about the R-sig-Geo mailing list