Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

installing sf from source with libraries in non-standard locations #335

Closed
wwesting opened this issue May 10, 2017 · 33 comments
Closed

installing sf from source with libraries in non-standard locations #335

wwesting opened this issue May 10, 2017 · 33 comments

Comments

@wwesting
Copy link

attempting to install sf package and getting this error.

Please help!

mdrstudio01:2771> install.packages("sf")
Installing package into ‘/home/westinwg/R/x86_64-redhat-linux-gnu-library/3.3’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/src/contrib/sf_0.4-2.tar.gz'
Content type 'unknown' length 3572824 bytes (3.4 MB)

downloaded 3.4 MB

  • installing source package ‘sf’ ...
    ** package ‘sf’ successfully unpacked and MD5 sums checked
    configure: CC: gcc -m64 -std=gnu99
    configure: CXX: g++ -m64
    checking for gdal-config... /usr/local/bin/gdal-config
    checking gdal-config usability... yes
    configure: GDAL: 2.1.3
    checking GDAL version >= 2.0.0... yes
    checking for gcc... gcc -m64 -std=gnu99
    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 -m64 -std=gnu99 accepts -g... yes
    checking for gcc -m64 -std=gnu99 option to accept ISO C89... none needed
    checking how to run the C preprocessor... gcc -m64 -std=gnu99 -E
    checking for grep that handles long lines and -e... /bin/grep
    checking for egrep... /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 gdal.h usability... yes
    checking gdal.h presence... yes
    checking for gdal.h... yes
    checking GDAL: linking with --libs only... yes
    checking GDAL: /usr/local/bin/gdal-2.1.3/share/gdal/pcs.csv readable... yes
    checking GDAL: checking whether PROJ.4 is available for linking:... yes
    checking GDAL: checking whether PROJ.4 is available fur running:... yes
    configure: pkg-config proj exists, will use it
    checking proj_api.h usability... yes
    checking proj_api.h presence... yes
    checking for proj_api.h... yes
    configure: PROJ: 4.8.0
    checking for pj_init_plus in -lproj... yes
    /home/westinwg/tmp/ccDjLsFh.o: In function main': /home/westinwg/tmp/RtmpMhUink/R.INSTALL9ff852f1f18b/sf/proj_conf_test.c:20: undefined reference to pj_ctx_fclose'
    collect2: error: ld returned 1 exit status
    ./configure: line 3789: ./proj_conf_test: No such file or directory
    checking PROJ.4: epsg found and readable... yes
    /home/westinwg/tmp/cclTfjmS.o: In function main': /home/westinwg/tmp/RtmpMhUink/R.INSTALL9ff852f1f18b/sf/proj_conf_test.c:20: undefined reference to pj_ctx_fclose'
    collect2: error: ld returned 1 exit status
    ./configure: line 3848: ./proj_conf_test: No such file or directory
    checking PROJ.4: conus found and readable... yes
    checking for geos-config... /usr/local/bin/geos-config
    checking geos-config usability... yes
    configure: GEOS: 3.6.1
    checking GEOS version >= 3.3.0... yes
    checking geos_c.h usability... no
    checking geos_c.h presence... no
    checking for geos_c.h... no
    configure: error: geos_c.h not found in given locations.
    ERROR: configuration failed for package ‘sf’
  • removing ‘/home/westinwg/R/x86_64-redhat-linux-gnu-library/3.3/sf’
    Warning in install.packages :
    installation of package ‘sf’ had non-zero exit status

The downloaded source packages are in
‘/home/westinwg/tmp/RtmpRHS50s/downloaded_packages’
mdrstudio01:2771>

@wwesting
Copy link
Author

maybe for starters, how do i figure out what the "given locations" are?

@rsbivand
Copy link
Member

How did you install GEOS, rpm or source build? If rpm, you are probably missing the geos-devel parts providing the headers, etc.

@wwesting
Copy link
Author

I installed geos-3.6..1 from source.

@rsbivand
Copy link
Member

With which --prefix in ./configure? Does geos-config --includes say anything?

@wwesting
Copy link
Author

I tried using both

./configure --prefix=/usr/bin/ and ./configure --prefix=/usr/local/ at different points.

I'm having a hard time getting anything that helps me out of th geos-config file

[root@mdrstudio01 geos-3.6.1]# cat /usr/bin/geos-config
#!/bin/sh
prefix=/usr
exec_prefix=${prefix}
libdir=${exec_prefix}/lib

usage()
{
cat <<EOF
Usage: geos-config [OPTIONS]
Options:
[--prefix]
[--version]
[--libs]
[--clibs]
[--cclibs]
[--static-clibs]
[--static-cclibs]
[--cflags]
[--ldflags]
[--includes]
[--jtsport]
EOF
exit $1
}
if test $# -eq 0; then
usage 1 1>&2
fi
while test $# -gt 0; do
case "$1" in
-=) optarg=echo "$1" | sed 's/[-_a-zA-Z0-9]*=//' ;;
*) optarg= ;;
esac
case $1 in
--prefix)
echo ${prefix}
;;
--version)
echo 3.6.1
;;
--cflags)
echo -I${prefix}/include
;;
--libs)
# TODO: make an alias for --clibs
# see http://trac.osgeo.org/geos/ticket/497
echo -L${libdir} -lgeos
;;
--clibs)
echo -L${libdir} -lgeos_c
;;
--cclibs)
echo -L${libdir} -lgeos
;;
--static-clibs)
echo -L${libdir} -lgeos_c -lgeos -lm
;;
--static-cclibs)
echo -L${libdir} -lgeos -lm
;;
--ldflags)
echo -L${libdir}
;;
--includes)
echo ${prefix}/include
;;
--jtsport)
echo 1.13.0
;;
*)
usage 1 1>&2
;;
esac
shift
done

@rsbivand
Copy link
Member

As:

checking geos_c.h usability... no
checking geos_c.h presence... no
checking for geos_c.h... no
configure: error: geos_c.h not found in given locations.

is very plain, find your lost header and library files with:

geos-config --includes
geos-config --cclibs
geos-config --clibs
checking for geos-config... /usr/local/bin/geos-config
checking geos-config usability... yes
configure: GEOS: 3.6.1
checking GEOS version >= 3.3.0... yes

is saying that configure found geos-config, but that the headers are not where geos-config --includes says they should be.

@edzer edzer closed this as completed May 15, 2017
@rdauria
Copy link

rdauria commented Jun 5, 2017

Hi,

I seem to have the same problem here (R version 3.3.0):

I pass the following config options:

--with-gdal-config=/u/local/apps/gdal/2.2.0/gcc-4.9.3/bin/gdal-config --with-proj-include=/u/local/apps/proj.4/4.9.3/gcc-4.9.3/include --with-proj-lib=/u/local/apps/proj.4/4.9.3/gcc-4.9.3/lib --with-geos-config=/u/local/apps/geos/3.6.1/gcc-4.9.3/bin/geos-config

but I get:

configure: geos-config set to /u/local/apps/geos/3.6.1/gcc-4.9.3/bin/geos-config
checking geos-config exists... yes
checking geos-config executable... yes
checking geos-config usability... yes
configure: GEOS: 3.6.1
checking GEOS version >= 3.3.0... yes
checking geos_c.h usability... no
checking geos_c.h presence... no
checking for geos_c.h... no
configure: error: geos_c.h not found in given locations.

However:

geos-config --includes

gives me:

/u/local/apps/geos/3.6.1/gcc-4.9.3/include

and:

ls /u/local/apps/geos/3.6.1/gcc-4.9.3/include
geos/  geos_c.h  geos.h

So the include files are where they should be found however sf does not find them. What am I missing?

Thanks,

RD

edzer added a commit that referenced this issue Jun 5, 2017
@edzer
Copy link
Member

edzer commented Jun 5, 2017

Please try again with this commit.

@edzer edzer reopened this Jun 5, 2017
@rdauria
Copy link

rdauria commented Jun 6, 2017

Hello, thanks for the update. In fact the new version goes further than it did before but now is having problems with finding proj4 headers installed in non default locations.

This is the error I get:

configure: Package CPP flags:  -I/u/local/apps/gdal/2.2.0/gcc-4.9.3/include -I/u/local/apps/geos/3.6.1/gcc-4.9.3/include
configure: Package LIBS:  -L/u/local/apps/gdal/2.2.0/gcc-4.9.3/lib -lgdal -L/u/local/apps/geos/3.6.1/gcc-4.9.3/lib -lgeos_c -lproj
[...]
g++ -std=c++0x -I/u/local/apps/R/3.3.0/gcc-4.4.7/enable-R-shlib/lib64/R/include -DNDEBUG -I/u/local/apps/gdal/2.2.0/gcc-4.9.3/include -I/u/local/apps/geos/3.6.1/gcc-4.9.3/include -I/usr/local/include -I"/u/home/systems/dauria/R/x86_64-pc-linux-gnu-library/3.3/Rcpp/include"   -fpic  -g -O2 -c proj.cpp -o proj.o
proj.cpp:2:22: fatal error: proj_api.h: No such file or directory
 #include <proj_api.h>
                      ^
compilation terminated.

This is the command I have used to compile:

R CMD INSTALL ./ --configure-args='--with-gdal-config=/u/local/apps/gdal/2.2.0/gcc-4.9.3/bin/gdal-config --with-proj-include=/u/local/apps/proj.4/4.9.3/gcc-4.9.3/include --with-proj-lib=/u/local/apps/proj.4/4.9.3/gcc-4.9.3/lib --with-geos-config=/u/local/apps/geos/3.6.1/gcc-4.9.3/bin/geos-config'

and the headers are where they should be:

ls /u/local/apps/proj.4/4.9.3/gcc-4.9.3/include
geodesic.h  org_proj4_PJ.h  org_proj4_Projections.h  proj_api.h  projects.h

Any suggestions? Thanks.

@rdauria
Copy link

rdauria commented Jun 6, 2017

A few more details I see from the config.log that:

PKG_CPPFLAGS=' -I/u/local/apps/gdal/2.2.0/gcc-4.9.3/include -I/u/local/apps/geos/3.6.1/gcc-4.9.3/include'
PKG_LIBS=' -L/u/local/apps/gdal/2.2.0/gcc-4.9.3/lib -lgdal -L/u/local/apps/geos/3.6.1/gcc-4.9.3/lib -lgeos_c -lproj'

however always from the config.log:

CPPFLAGS='-I/usr/local/include -I/u/local/apps/proj.4/4.9.3/gcc-4.9.3/include -I/u/local/apps/gdal/2.2.0/gcc-4.9.3/include -I/u/local/apps/geos/3.6.1/gcc-4.9.3/include'

and:

LIBS='-lproj -L/u/local/apps/proj.4/4.9.3/gcc-4.9.3/lib -L/u/local/apps/gdal/2.2.0/gcc-4.9.3/lib -lgdal'

the order in the latter seems to be wrong, however the problem is with the include files.

@edzer
Copy link
Member

edzer commented Jun 7, 2017

Thanks -- please try again with this commit.

@rdauria
Copy link

rdauria commented Jun 9, 2017

Hello again,

Unfortunately with the new commit the compilation terminates very soon.

Here is the command I used:

R CMD INSTALL ./ --configure-args='--with-gdal-config=/u/local/apps/gdal/2.2.0/gcc-4.9.3/bin/gdal-config --with-proj-include=/u/local/apps/proj.4/4.9.3/gcc-4.9.3/include --with-proj-lib=/u/local/apps/proj.4/4.9.3/gcc-4.9.3/lib --with-geos-config=/u/local/apps/geos/3.6.1/gcc-4.9.3/bin/geos-config'

and I get:

[...]
checking for gdal.h... yes
checking GDAL: linking with --libs only... yes
checking GDAL: /u/local/apps/gdal/2.2.0/gcc-4.9.3/share/gdal/pcs.csv readable... yes
checking GDAL: checking whether PROJ.4 is available for linking:... yes
checking GDAL: checking whether PROJ.4 is available fur running:... yes
checking proj_api.h usability... no
checking proj_api.h presence... no
checking for proj_api.h... no
configure: error: proj_api.h not found in standard or given locations.
ERROR: configuration failed for package ‘sf’
* removing ‘/u/home/systems/dauria/R/x86_64-pc-linux-gnu-library/3.3/sf’

the config.log is as follows (look for error close to 3640 pattern):

This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by configure, which was
generated by GNU Autoconf 2.69.  Invocation command line was

  $ ./configure --with-gdal-config=/u/local/apps/gdal/2.2.0/gcc-4.9.3/bin/gdal-config --with-proj-include=/u/local/apps/proj.4/4.9.3/gcc-4.9.3/include --with-proj-lib=/u/local/apps/proj.4/4.9.3/gcc-4.9.3/lib --with-geos-config=/u/local/apps/geos/3.6.1/gcc-4.9.3/bin/geos-config

## --------- ##
## Platform. ##
## --------- ##

hostname = n2009
uname -m = x86_64
uname -r = 2.6.32-642.13.2.el6.x86_64
uname -s = Linux
uname -v = #1 SMP Thu Feb 23 02:55:00 UTC 2017

/usr/bin/uname -p = unknown
/bin/uname -X     = unknown

/bin/arch              = x86_64
/usr/bin/arch -k       = unknown
/usr/convex/getsysinfo = unknown
/usr/bin/hostinfo      = unknown
/bin/machine           = unknown
/usr/bin/oslevel       = unknown
/bin/universe          = unknown

PATH: /u/local/apps/gdal/2.2.0/gcc-4.9.3/bin
PATH: /u/local/apps/geos/3.6.1/gcc-4.9.3/bin
PATH: /u/local/apps/R/3.3.3/gcc-4.9.3_MKL-2017.0/bin
PATH: /u/local/compilers/gcc/4.9.3/bin
PATH: /u/local/compilers/intel/17.0.1/debugger_2017/gdb/intel64_mic/bin
PATH: /u/local/compilers/intel/17.0.1//compilers_and_libraries_2017.1.132/linux/mpi/intel64/bin
PATH: /u/local/compilers/intel/17.0.1/compilers_and_libraries_2017.1.132/linux/bin/intel64
PATH: /u/local/apps/curl/7.49.1/bin
PATH: /u/local/apps/pcre/8.39/bin
PATH: /u/local/apps/xz/5.2.2/bin
PATH: /u/local/apps/bzip2/1.0.6/bin
PATH: /u/local/apps/proj.4/4.9.3/gcc-4.9.3/bin
PATH: /u/systems/UGE8.0.1vm/bin/lx-amd64
PATH: /u/local/bin
PATH: /u/local/sbin
PATH: /usr/lib64/qt-3.3/bin
PATH: /usr/local/bin
PATH: /bin
PATH: /usr/bin
PATH: /usr/local/sbin
PATH: /usr/sbin
PATH: /sbin
PATH: /u/home/systems/dauria/bin


## ----------- ##
## Core tests. ##
## ----------- ##

configure:2070: CC: /u/local/compilers/gcc/4.9.3/bin/gcc -std=gnu99
configure:2072: CXX: /u/local/compilers/gcc/4.9.3/bin/g++
configure:2092: gdal-config set to /u/local/apps/gdal/2.2.0/gcc-4.9.3/bin/gdal-config
configure:2144: checking gdal-config exists
configure:2147: result: yes
configure:2154: checking gdal-config executable
configure:2157: result: yes
configure:2167: checking gdal-config usability
configure:2176: result: yes
configure:2195: GDAL: 2.2.0
configure:2197: checking GDAL version >= 2.0.0
configure:2206: result: yes
configure:2274: checking for gcc
configure:2301: result: /u/local/compilers/gcc/4.9.3/bin/gcc -std=gnu99
configure:2530: checking for C compiler version
configure:2539: /u/local/compilers/gcc/4.9.3/bin/gcc -std=gnu99 --version >&5
gcc (GCC) 4.9.3
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

configure:2550: $? = 0
configure:2539: /u/local/compilers/gcc/4.9.3/bin/gcc -std=gnu99 -v >&5
Using built-in specs.
COLLECT_GCC=/u/local/compilers/gcc/4.9.3/bin/gcc
COLLECT_LTO_WRAPPER=/u/local/compilers/gcc/4.9.3/libexec/gcc/x86_64-unknown-linux-gnu/4.9.3/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../configure --prefix=/u/local/compilers/gcc/4.9.3 --enable-languages=c,c++,fortran,java
Thread model: posix
gcc version 4.9.3 (GCC) 
configure:2550: $? = 0
configure:2539: /u/local/compilers/gcc/4.9.3/bin/gcc -std=gnu99 -V >&5
gcc: error: unrecognized command line option '-V'
gcc: fatal error: no input files
compilation terminated.
configure:2550: $? = 1
configure:2539: /u/local/compilers/gcc/4.9.3/bin/gcc -std=gnu99 -qversion >&5
gcc: error: unrecognized command line option '-qversion'
gcc: fatal error: no input files
compilation terminated.
configure:2550: $? = 1
configure:2570: checking whether the C compiler works
configure:2592: /u/local/compilers/gcc/4.9.3/bin/gcc -std=gnu99 -O3 -m64 -fopenmp -fPIC -I/u/local/compilers/gcc/4.9.3/include -I/u/local/apps/zlib/1.2.8/gcc-4.4.7/include -I/u/local/apps/bzip2/1.0.6/include -I/u/local/apps/xz/5.2.2/include -I/u/local/apps/pcre/8.39/include -I/u/local/apps/curl/7.49.1/include -I/include  -I/u/local/apps/gdal/2.2.0/gcc-4.9.3/include -L/u/local/compilers/gcc/4.9.3/lib -L/u/local/apps/zlib/1.2.8/gcc-4.4.7/lib -L/u/local/apps/bzip2/1.0.6/lib -L/u/local/apps/xz/5.2.2/lib -L/u/local/apps/pcre/8.39/lib -L/u/local/apps/curl/7.49.1/lib conftest.c  >&5
/usr/bin/ld: skipping incompatible /u/local/compilers/gcc/4.9.3/lib/libgomp.so when searching for -lgomp
/usr/bin/ld: skipping incompatible /u/local/compilers/gcc/4.9.3/lib/libgomp.a when searching for -lgomp
/usr/bin/ld: skipping incompatible /u/local/compilers/gcc/4.9.3/lib/libgcc_s.so when searching for -lgcc_s
/usr/bin/ld: skipping incompatible /u/local/compilers/gcc/4.9.3/lib/libgcc_s.so when searching for -lgcc_s
configure:2596: $? = 0
configure:2644: result: yes
configure:2647: checking for C compiler default output file name
configure:2649: result: a.out
configure:2655: checking for suffix of executables
configure:2662: /u/local/compilers/gcc/4.9.3/bin/gcc -std=gnu99 -o conftest -O3 -m64 -fopenmp -fPIC -I/u/local/compilers/gcc/4.9.3/include -I/u/local/apps/zlib/1.2.8/gcc-4.4.7/include -I/u/local/apps/bzip2/1.0.6/include -I/u/local/apps/xz/5.2.2/include -I/u/local/apps/pcre/8.39/include -I/u/local/apps/curl/7.49.1/include -I/include  -I/u/local/apps/gdal/2.2.0/gcc-4.9.3/include -L/u/local/compilers/gcc/4.9.3/lib -L/u/local/apps/zlib/1.2.8/gcc-4.4.7/lib -L/u/local/apps/bzip2/1.0.6/lib -L/u/local/apps/xz/5.2.2/lib -L/u/local/apps/pcre/8.39/lib -L/u/local/apps/curl/7.49.1/lib conftest.c  >&5
/usr/bin/ld: skipping incompatible /u/local/compilers/gcc/4.9.3/lib/libgomp.so when searching for -lgomp
/usr/bin/ld: skipping incompatible /u/local/compilers/gcc/4.9.3/lib/libgomp.a when searching for -lgomp
/usr/bin/ld: skipping incompatible /u/local/compilers/gcc/4.9.3/lib/libgcc_s.so when searching for -lgcc_s
/usr/bin/ld: skipping incompatible /u/local/compilers/gcc/4.9.3/lib/libgcc_s.so when searching for -lgcc_s
configure:2666: $? = 0
configure:2688: result: 
configure:2710: checking whether we are cross compiling
configure:2718: /u/local/compilers/gcc/4.9.3/bin/gcc -std=gnu99 -o conftest -O3 -m64 -fopenmp -fPIC -I/u/local/compilers/gcc/4.9.3/include -I/u/local/apps/zlib/1.2.8/gcc-4.4.7/include -I/u/local/apps/bzip2/1.0.6/include -I/u/local/apps/xz/5.2.2/include -I/u/local/apps/pcre/8.39/include -I/u/local/apps/curl/7.49.1/include -I/include  -I/u/local/apps/gdal/2.2.0/gcc-4.9.3/include -L/u/local/compilers/gcc/4.9.3/lib -L/u/local/apps/zlib/1.2.8/gcc-4.4.7/lib -L/u/local/apps/bzip2/1.0.6/lib -L/u/local/apps/xz/5.2.2/lib -L/u/local/apps/pcre/8.39/lib -L/u/local/apps/curl/7.49.1/lib conftest.c  >&5
/usr/bin/ld: skipping incompatible /u/local/compilers/gcc/4.9.3/lib/libgomp.so when searching for -lgomp
/usr/bin/ld: skipping incompatible /u/local/compilers/gcc/4.9.3/lib/libgomp.a when searching for -lgomp
/usr/bin/ld: skipping incompatible /u/local/compilers/gcc/4.9.3/lib/libgcc_s.so when searching for -lgcc_s
/usr/bin/ld: skipping incompatible /u/local/compilers/gcc/4.9.3/lib/libgcc_s.so when searching for -lgcc_s
configure:2722: $? = 0
configure:2729: ./conftest
configure:2733: $? = 0
configure:2748: result: no
configure:2753: checking for suffix of object files
configure:2775: /u/local/compilers/gcc/4.9.3/bin/gcc -std=gnu99 -c -O3 -m64 -fopenmp -fPIC -I/u/local/compilers/gcc/4.9.3/include -I/u/local/apps/zlib/1.2.8/gcc-4.4.7/include -I/u/local/apps/bzip2/1.0.6/include -I/u/local/apps/xz/5.2.2/include -I/u/local/apps/pcre/8.39/include -I/u/local/apps/curl/7.49.1/include -I/include  -I/u/local/apps/gdal/2.2.0/gcc-4.9.3/include conftest.c >&5
configure:2779: $? = 0
configure:2800: result: o
configure:2804: checking whether we are using the GNU C compiler
configure:2823: /u/local/compilers/gcc/4.9.3/bin/gcc -std=gnu99 -c -O3 -m64 -fopenmp -fPIC -I/u/local/compilers/gcc/4.9.3/include -I/u/local/apps/zlib/1.2.8/gcc-4.4.7/include -I/u/local/apps/bzip2/1.0.6/include -I/u/local/apps/xz/5.2.2/include -I/u/local/apps/pcre/8.39/include -I/u/local/apps/curl/7.49.1/include -I/include  -I/u/local/apps/gdal/2.2.0/gcc-4.9.3/include conftest.c >&5
configure:2823: $? = 0
configure:2832: result: yes
configure:2841: checking whether /u/local/compilers/gcc/4.9.3/bin/gcc -std=gnu99 accepts -g
configure:2861: /u/local/compilers/gcc/4.9.3/bin/gcc -std=gnu99 -c -g -I/u/local/compilers/gcc/4.9.3/include -I/u/local/apps/zlib/1.2.8/gcc-4.4.7/include -I/u/local/apps/bzip2/1.0.6/include -I/u/local/apps/xz/5.2.2/include -I/u/local/apps/pcre/8.39/include -I/u/local/apps/curl/7.49.1/include -I/include  -I/u/local/apps/gdal/2.2.0/gcc-4.9.3/include conftest.c >&5
configure:2861: $? = 0
configure:2902: result: yes
configure:2919: checking for /u/local/compilers/gcc/4.9.3/bin/gcc -std=gnu99 option to accept ISO C89
configure:2982: /u/local/compilers/gcc/4.9.3/bin/gcc -std=gnu99  -c -O3 -m64 -fopenmp -fPIC -I/u/local/compilers/gcc/4.9.3/include -I/u/local/apps/zlib/1.2.8/gcc-4.4.7/include -I/u/local/apps/bzip2/1.0.6/include -I/u/local/apps/xz/5.2.2/include -I/u/local/apps/pcre/8.39/include -I/u/local/apps/curl/7.49.1/include -I/include  -I/u/local/apps/gdal/2.2.0/gcc-4.9.3/include conftest.c >&5
configure:2982: $? = 0
configure:2995: result: none needed
configure:3021: checking how to run the C preprocessor
configure:3091: result: /u/local/compilers/gcc/4.9.3/bin/gcc -std=gnu99 -E
configure:3111: /u/local/compilers/gcc/4.9.3/bin/gcc -std=gnu99 -E -I/u/local/compilers/gcc/4.9.3/include -I/u/local/apps/zlib/1.2.8/gcc-4.4.7/include -I/u/local/apps/bzip2/1.0.6/include -I/u/local/apps/xz/5.2.2/include -I/u/local/apps/pcre/8.39/include -I/u/local/apps/curl/7.49.1/include -I/include  -I/u/local/apps/gdal/2.2.0/gcc-4.9.3/include conftest.c
configure:3111: $? = 0
configure:3125: /u/local/compilers/gcc/4.9.3/bin/gcc -std=gnu99 -E -I/u/local/compilers/gcc/4.9.3/include -I/u/local/apps/zlib/1.2.8/gcc-4.4.7/include -I/u/local/apps/bzip2/1.0.6/include -I/u/local/apps/xz/5.2.2/include -I/u/local/apps/pcre/8.39/include -I/u/local/apps/curl/7.49.1/include -I/include  -I/u/local/apps/gdal/2.2.0/gcc-4.9.3/include conftest.c
conftest.c:9:28: fatal error: ac_nonexistent.h: No such file or directory
 #include <ac_nonexistent.h>
                            ^
compilation terminated.
configure:3125: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| /* end confdefs.h.  */
| #include <ac_nonexistent.h>
configure:3154: checking for grep that handles long lines and -e
configure:3212: result: /bin/grep
configure:3217: checking for egrep
configure:3279: result: /bin/grep -E
configure:3284: checking for ANSI C header files
configure:3304: /u/local/compilers/gcc/4.9.3/bin/gcc -std=gnu99 -c -O3 -m64 -fopenmp -fPIC -I/u/local/compilers/gcc/4.9.3/include -I/u/local/apps/zlib/1.2.8/gcc-4.4.7/include -I/u/local/apps/bzip2/1.0.6/include -I/u/local/apps/xz/5.2.2/include -I/u/local/apps/pcre/8.39/include -I/u/local/apps/curl/7.49.1/include -I/include  -I/u/local/apps/gdal/2.2.0/gcc-4.9.3/include conftest.c >&5
configure:3304: $? = 0
configure:3377: /u/local/compilers/gcc/4.9.3/bin/gcc -std=gnu99 -o conftest -O3 -m64 -fopenmp -fPIC -I/u/local/compilers/gcc/4.9.3/include -I/u/local/apps/zlib/1.2.8/gcc-4.4.7/include -I/u/local/apps/bzip2/1.0.6/include -I/u/local/apps/xz/5.2.2/include -I/u/local/apps/pcre/8.39/include -I/u/local/apps/curl/7.49.1/include -I/include  -I/u/local/apps/gdal/2.2.0/gcc-4.9.3/include -L/u/local/compilers/gcc/4.9.3/lib -L/u/local/apps/zlib/1.2.8/gcc-4.4.7/lib -L/u/local/apps/bzip2/1.0.6/lib -L/u/local/apps/xz/5.2.2/lib -L/u/local/apps/pcre/8.39/lib -L/u/local/apps/curl/7.49.1/lib conftest.c  >&5
/usr/bin/ld: skipping incompatible /u/local/compilers/gcc/4.9.3/lib/libgomp.so when searching for -lgomp
/usr/bin/ld: skipping incompatible /u/local/compilers/gcc/4.9.3/lib/libgomp.a when searching for -lgomp
/usr/bin/ld: skipping incompatible /u/local/compilers/gcc/4.9.3/lib/libgcc_s.so when searching for -lgcc_s
/usr/bin/ld: skipping incompatible /u/local/compilers/gcc/4.9.3/lib/libgcc_s.so when searching for -lgcc_s
configure:3377: $? = 0
configure:3377: ./conftest
configure:3377: $? = 0
configure:3388: result: yes
configure:3401: checking for sys/types.h
configure:3401: /u/local/compilers/gcc/4.9.3/bin/gcc -std=gnu99 -c -O3 -m64 -fopenmp -fPIC -I/u/local/compilers/gcc/4.9.3/include -I/u/local/apps/zlib/1.2.8/gcc-4.4.7/include -I/u/local/apps/bzip2/1.0.6/include -I/u/local/apps/xz/5.2.2/include -I/u/local/apps/pcre/8.39/include -I/u/local/apps/curl/7.49.1/include -I/include  -I/u/local/apps/gdal/2.2.0/gcc-4.9.3/include conftest.c >&5
configure:3401: $? = 0
configure:3401: result: yes
configure:3401: checking for sys/stat.h
configure:3401: /u/local/compilers/gcc/4.9.3/bin/gcc -std=gnu99 -c -O3 -m64 -fopenmp -fPIC -I/u/local/compilers/gcc/4.9.3/include -I/u/local/apps/zlib/1.2.8/gcc-4.4.7/include -I/u/local/apps/bzip2/1.0.6/include -I/u/local/apps/xz/5.2.2/include -I/u/local/apps/pcre/8.39/include -I/u/local/apps/curl/7.49.1/include -I/include  -I/u/local/apps/gdal/2.2.0/gcc-4.9.3/include conftest.c >&5
configure:3401: $? = 0
configure:3401: result: yes
configure:3401: checking for stdlib.h
configure:3401: /u/local/compilers/gcc/4.9.3/bin/gcc -std=gnu99 -c -O3 -m64 -fopenmp -fPIC -I/u/local/compilers/gcc/4.9.3/include -I/u/local/apps/zlib/1.2.8/gcc-4.4.7/include -I/u/local/apps/bzip2/1.0.6/include -I/u/local/apps/xz/5.2.2/include -I/u/local/apps/pcre/8.39/include -I/u/local/apps/curl/7.49.1/include -I/include  -I/u/local/apps/gdal/2.2.0/gcc-4.9.3/include conftest.c >&5
configure:3401: $? = 0
configure:3401: result: yes
configure:3401: checking for string.h
configure:3401: /u/local/compilers/gcc/4.9.3/bin/gcc -std=gnu99 -c -O3 -m64 -fopenmp -fPIC -I/u/local/compilers/gcc/4.9.3/include -I/u/local/apps/zlib/1.2.8/gcc-4.4.7/include -I/u/local/apps/bzip2/1.0.6/include -I/u/local/apps/xz/5.2.2/include -I/u/local/apps/pcre/8.39/include -I/u/local/apps/curl/7.49.1/include -I/include  -I/u/local/apps/gdal/2.2.0/gcc-4.9.3/include conftest.c >&5
configure:3401: $? = 0
configure:3401: result: yes
configure:3401: checking for memory.h
configure:3401: /u/local/compilers/gcc/4.9.3/bin/gcc -std=gnu99 -c -O3 -m64 -fopenmp -fPIC -I/u/local/compilers/gcc/4.9.3/include -I/u/local/apps/zlib/1.2.8/gcc-4.4.7/include -I/u/local/apps/bzip2/1.0.6/include -I/u/local/apps/xz/5.2.2/include -I/u/local/apps/pcre/8.39/include -I/u/local/apps/curl/7.49.1/include -I/include  -I/u/local/apps/gdal/2.2.0/gcc-4.9.3/include conftest.c >&5
configure:3401: $? = 0
configure:3401: result: yes
configure:3401: checking for strings.h
configure:3401: /u/local/compilers/gcc/4.9.3/bin/gcc -std=gnu99 -c -O3 -m64 -fopenmp -fPIC -I/u/local/compilers/gcc/4.9.3/include -I/u/local/apps/zlib/1.2.8/gcc-4.4.7/include -I/u/local/apps/bzip2/1.0.6/include -I/u/local/apps/xz/5.2.2/include -I/u/local/apps/pcre/8.39/include -I/u/local/apps/curl/7.49.1/include -I/include  -I/u/local/apps/gdal/2.2.0/gcc-4.9.3/include conftest.c >&5
configure:3401: $? = 0
configure:3401: result: yes
configure:3401: checking for inttypes.h
configure:3401: /u/local/compilers/gcc/4.9.3/bin/gcc -std=gnu99 -c -O3 -m64 -fopenmp -fPIC -I/u/local/compilers/gcc/4.9.3/include -I/u/local/apps/zlib/1.2.8/gcc-4.4.7/include -I/u/local/apps/bzip2/1.0.6/include -I/u/local/apps/xz/5.2.2/include -I/u/local/apps/pcre/8.39/include -I/u/local/apps/curl/7.49.1/include -I/include  -I/u/local/apps/gdal/2.2.0/gcc-4.9.3/include conftest.c >&5
configure:3401: $? = 0
configure:3401: result: yes
configure:3401: checking for stdint.h
configure:3401: /u/local/compilers/gcc/4.9.3/bin/gcc -std=gnu99 -c -O3 -m64 -fopenmp -fPIC -I/u/local/compilers/gcc/4.9.3/include -I/u/local/apps/zlib/1.2.8/gcc-4.4.7/include -I/u/local/apps/bzip2/1.0.6/include -I/u/local/apps/xz/5.2.2/include -I/u/local/apps/pcre/8.39/include -I/u/local/apps/curl/7.49.1/include -I/include  -I/u/local/apps/gdal/2.2.0/gcc-4.9.3/include conftest.c >&5
configure:3401: $? = 0
configure:3401: result: yes
configure:3401: checking for unistd.h
configure:3401: /u/local/compilers/gcc/4.9.3/bin/gcc -std=gnu99 -c -O3 -m64 -fopenmp -fPIC -I/u/local/compilers/gcc/4.9.3/include -I/u/local/apps/zlib/1.2.8/gcc-4.4.7/include -I/u/local/apps/bzip2/1.0.6/include -I/u/local/apps/xz/5.2.2/include -I/u/local/apps/pcre/8.39/include -I/u/local/apps/curl/7.49.1/include -I/include  -I/u/local/apps/gdal/2.2.0/gcc-4.9.3/include conftest.c >&5
configure:3401: $? = 0
configure:3401: result: yes
configure:3415: checking gdal.h usability
configure:3415: /u/local/compilers/gcc/4.9.3/bin/gcc -std=gnu99 -c -O3 -m64 -fopenmp -fPIC -I/u/local/compilers/gcc/4.9.3/include -I/u/local/apps/zlib/1.2.8/gcc-4.4.7/include -I/u/local/apps/bzip2/1.0.6/include -I/u/local/apps/xz/5.2.2/include -I/u/local/apps/pcre/8.39/include -I/u/local/apps/curl/7.49.1/include -I/include  -I/u/local/apps/gdal/2.2.0/gcc-4.9.3/include conftest.c >&5
configure:3415: $? = 0
configure:3415: result: yes
configure:3415: checking gdal.h presence
configure:3415: /u/local/compilers/gcc/4.9.3/bin/gcc -std=gnu99 -E -I/u/local/compilers/gcc/4.9.3/include -I/u/local/apps/zlib/1.2.8/gcc-4.4.7/include -I/u/local/apps/bzip2/1.0.6/include -I/u/local/apps/xz/5.2.2/include -I/u/local/apps/pcre/8.39/include -I/u/local/apps/curl/7.49.1/include -I/include  -I/u/local/apps/gdal/2.2.0/gcc-4.9.3/include conftest.c
configure:3415: $? = 0
configure:3415: result: yes
configure:3415: checking for gdal.h
configure:3415: result: yes
configure:3446: checking GDAL: linking with --libs only
configure:3454: result: yes
configure:3488: checking GDAL: /u/local/apps/gdal/2.2.0/gcc-4.9.3/share/gdal/pcs.csv readable
configure:3491: result: yes
configure:3563: checking GDAL: checking whether PROJ.4 is available for linking:
configure:3572: result: yes
configure:3583: checking GDAL: checking whether PROJ.4 is available fur running:
configure:3592: result: yes
configure:3640: checking proj_api.h usability
configure:3640: /u/local/compilers/gcc/4.9.3/bin/gcc -std=gnu99 -c -O3 -m64 -fopenmp -fPIC -I/u/local/compilers/gcc/4.9.3/include -I/u/local/apps/zlib/1.2.8/gcc-4.4.7/include -I/u/local/apps/bzip2/1.0.6/include -I/u/local/apps/xz/5.2.2/include -I/u/local/apps/pcre/8.39/include -I/u/local/apps/curl/7.49.1/include -I/include  -I/u/local/apps/gdal/2.2.0/gcc-4.9.3/include conftest.c >&5
conftest.c:53:22: fatal error: proj_api.h: No such file or directory
 #include <proj_api.h>
                      ^
compilation terminated.
configure:3640: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| #define STDC_HEADERS 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_GDAL_H 1
| /* end confdefs.h.  */
| #include <stdio.h>
| #ifdef HAVE_SYS_TYPES_H
| # include <sys/types.h>
| #endif
| #ifdef HAVE_SYS_STAT_H
| # include <sys/stat.h>
| #endif
| #ifdef STDC_HEADERS
| # include <stdlib.h>
| # include <stddef.h>
| #else
| # ifdef HAVE_STDLIB_H
| #  include <stdlib.h>
| # endif
| #endif
| #ifdef HAVE_STRING_H
| # if !defined STDC_HEADERS && defined HAVE_MEMORY_H
| #  include <memory.h>
| # endif
| # include <string.h>
| #endif
| #ifdef HAVE_STRINGS_H
| # include <strings.h>
| #endif
| #ifdef HAVE_INTTYPES_H
| # include <inttypes.h>
| #endif
| #ifdef HAVE_STDINT_H
| # include <stdint.h>
| #endif
| #ifdef HAVE_UNISTD_H
| # include <unistd.h>
| #endif
| #include <proj_api.h>
configure:3640: checking proj_api.h presence
configure:3640: /u/local/compilers/gcc/4.9.3/bin/gcc -std=gnu99 -E -I/u/local/compilers/gcc/4.9.3/include -I/u/local/apps/zlib/1.2.8/gcc-4.4.7/include -I/u/local/apps/bzip2/1.0.6/include -I/u/local/apps/xz/5.2.2/include -I/u/local/apps/pcre/8.39/include -I/u/local/apps/curl/7.49.1/include -I/include  -I/u/local/apps/gdal/2.2.0/gcc-4.9.3/include conftest.c
conftest.c:20:22: fatal error: proj_api.h: No such file or directory
 #include <proj_api.h>
                      ^
compilation terminated.
configure:3640: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| #define STDC_HEADERS 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_GDAL_H 1
| /* end confdefs.h.  */
| #include <proj_api.h>
configure:3640: result: no
configure:3640: checking for proj_api.h
configure:3640: result: no
configure:3653: error: proj_api.h not found in standard or given locations.

## ---------------- ##
## Cache variables. ##
## ---------------- ##

ac_cv_c_compiler_gnu=yes
ac_cv_env_CC_set=
ac_cv_env_CC_value=
ac_cv_env_CFLAGS_set=
ac_cv_env_CFLAGS_value=
ac_cv_env_CPPFLAGS_set=
ac_cv_env_CPPFLAGS_value=
ac_cv_env_CPP_set=
ac_cv_env_CPP_value=
ac_cv_env_LDFLAGS_set=
ac_cv_env_LDFLAGS_value=
ac_cv_env_LIBS_set=
ac_cv_env_LIBS_value=
ac_cv_env_build_alias_set=
ac_cv_env_build_alias_value=
ac_cv_env_host_alias_set=
ac_cv_env_host_alias_value=
ac_cv_env_target_alias_set=
ac_cv_env_target_alias_value=
ac_cv_header_gdal_h=yes
ac_cv_header_inttypes_h=yes
ac_cv_header_memory_h=yes
ac_cv_header_proj_api_h=no
ac_cv_header_stdc=yes
ac_cv_header_stdint_h=yes
ac_cv_header_stdlib_h=yes
ac_cv_header_string_h=yes
ac_cv_header_strings_h=yes
ac_cv_header_sys_stat_h=yes
ac_cv_header_sys_types_h=yes
ac_cv_header_unistd_h=yes
ac_cv_objext=o
ac_cv_path_EGREP='/bin/grep -E'
ac_cv_path_GREP=/bin/grep
ac_cv_prog_CPP='/u/local/compilers/gcc/4.9.3/bin/gcc -std=gnu99 -E'
ac_cv_prog_ac_ct_CC='/u/local/compilers/gcc/4.9.3/bin/gcc -std=gnu99'
ac_cv_prog_cc_c89=
ac_cv_prog_cc_g=yes

## ----------------- ##
## Output variables. ##
## ----------------- ##

CC='/u/local/compilers/gcc/4.9.3/bin/gcc -std=gnu99'
CFLAGS='-O3 -m64 -fopenmp -fPIC'
CPP='/u/local/compilers/gcc/4.9.3/bin/gcc -std=gnu99 -E'
CPPFLAGS='-I/u/local/compilers/gcc/4.9.3/include -I/u/local/apps/zlib/1.2.8/gcc-4.4.7/include -I/u/local/apps/bzip2/1.0.6/include -I/u/local/apps/xz/5.2.2/include -I/u/local/apps/pcre/8.39/include -I/u/local/apps/curl/7.49.1/include -I/include  -I/u/local/apps/gdal/2.2.0/gcc-4.9.3/include'
DEFS=''
ECHO_C=''
ECHO_N='-n'
ECHO_T=''
EGREP='/bin/grep -E'
EXEEXT=''
GDAL_CONFIG='/u/local/apps/gdal/2.2.0/gcc-4.9.3/bin/gdal-config'
GEOS_CONFIG=''
GREP='/bin/grep'
LDFLAGS='-L/u/local/compilers/gcc/4.9.3/lib -L/u/local/apps/zlib/1.2.8/gcc-4.4.7/lib -L/u/local/apps/bzip2/1.0.6/lib -L/u/local/apps/xz/5.2.2/lib -L/u/local/apps/pcre/8.39/lib -L/u/local/apps/curl/7.49.1/lib'
LIBOBJS=''
LIBS='  -L/u/local/apps/gdal/2.2.0/gcc-4.9.3/lib -lgdal'
LTLIBOBJS=''
OBJEXT='o'
PACKAGE_BUGREPORT=''
PACKAGE_NAME=''
PACKAGE_STRING=''
PACKAGE_TARNAME=''
PACKAGE_URL=''
PACKAGE_VERSION=''
PATH_SEPARATOR=':'
PKG_CPPFLAGS=' -I/u/local/apps/gdal/2.2.0/gcc-4.9.3/include'
PKG_LIBS=' -L/u/local/apps/gdal/2.2.0/gcc-4.9.3/lib -lgdal'
PROJ_CPPFLAGS='-I/u/local/apps/proj.4/4.9.3/gcc-4.9.3/include'
SHELL='/bin/sh'
ac_ct_CC='/u/local/compilers/gcc/4.9.3/bin/gcc -std=gnu99'
bindir='${exec_prefix}/bin'
build_alias=''
datadir='${datarootdir}'
datarootdir='${prefix}/share'
docdir='${datarootdir}/doc/${PACKAGE}'
dvidir='${docdir}'
exec_prefix='NONE'
host_alias=''
htmldir='${docdir}'
includedir='${prefix}/include'
infodir='${datarootdir}/info'
libdir='${exec_prefix}/lib'
libexecdir='${exec_prefix}/libexec'
localedir='${datarootdir}/locale'
localstatedir='${prefix}/var'
mandir='${datarootdir}/man'
oldincludedir='/usr/include'
pdfdir='${docdir}'
prefix='NONE'
program_transform_name='s,x,x,'
psdir='${docdir}'
runstatedir='${localstatedir}/run'
sbindir='${exec_prefix}/sbin'
sharedstatedir='${prefix}/com'
sysconfdir='${prefix}/etc'
target_alias=''

## ----------- ##
## confdefs.h. ##
## ----------- ##

/* confdefs.h */
#define PACKAGE_NAME ""
#define PACKAGE_TARNAME ""
#define PACKAGE_VERSION ""
#define PACKAGE_STRING ""
#define PACKAGE_BUGREPORT ""
#define PACKAGE_URL ""
#define STDC_HEADERS 1
#define HAVE_SYS_TYPES_H 1
#define HAVE_SYS_STAT_H 1
#define HAVE_STDLIB_H 1
#define HAVE_STRING_H 1
#define HAVE_MEMORY_H 1
#define HAVE_STRINGS_H 1
#define HAVE_INTTYPES_H 1
#define HAVE_STDINT_H 1
#define HAVE_UNISTD_H 1
#define HAVE_GDAL_H 1

configure: exit 1

What seems to be the problem?

Thanks,

RD

@rdauria
Copy link

rdauria commented Jun 9, 2017

So the problem still is with finding libraries in non default location, this test seems not to look in all the places where it should (in particular for proj4):

configure:3640: checking proj_api.h presence
configure:3640: /u/local/compilers/gcc/4.9.3/bin/gcc -std=gnu99 -E -I/u/local/compilers/gcc/4.9.3/include -I/u/local/apps/zlib/1.2.8/gcc-4.4.7/include -I/u/local/apps/bzip2/1.0.6/include -I/u/local/apps/xz/5.2.2/include -I/u/local/apps/pcre/8.39/include -I/u/local/apps/curl/7.49.1/include -I/include  -I/u/local/apps/gdal/2.2.0/gcc-4.9.3/include conftest.c
conftest.c:20:22: fatal error: proj_api.h: No such file or directory
 #include <proj_api.h>

@edzer
Copy link
Member

edzer commented Jun 14, 2017

I tried in a container with custom gdal in /opt/gdal/ custom geos in /opt/geos and custom proj in /opt and was successful with the following install command:

GDAL_DATA=/opt/gdal/share/gdal/ LD_LIBRARY_PATH=/opt/gdal/lib:/opt/geos/lib:/opt/lib R CMD INSTALL --configure-args="--with-gdal-config=/opt/gdal/bin/gdal-config  --with-proj-include=/opt/include --with-proj-lib=/opt/lib --with-geos-config=/opt/geos/bin/geos-config " sf_0.5-0.tar.gz

pls try it out.

@edzer edzer changed the title configure: error: geos_c.h not found in given locations. installing sf from source with libraries in non-standard locations Jun 14, 2017
@edzer
Copy link
Member

edzer commented Jun 25, 2017

Please reopen this if there are still issues here.

@edzer edzer closed this as completed Jun 25, 2017
@gregmacfarlane
Copy link

gregmacfarlane commented Jun 27, 2017

I came across this same issue, with homebrew macOS.

checking for proj_api.h... no
configure: error: proj_api.h not found in standard or given locations.
ERROR: configuration failed for package ‘sf’

Resolved it by linking proj,

brew link proj

@isezen
Copy link

isezen commented Apr 19, 2019

I think I experience this issue with Centos 7.6.1810 and Anaconda3 installation. GDAL(2.4.1), GEOS (3.7.1) and PROJ.4 runtime: Rel. 6.0.0, March 1st, 2019 are installed with anaconda3.

1- I created a file names /etc/ld.so.conf.d/anaconda-x86_64.conf and added /home/programs/anaconda3/lib and run ldconfig command.
2- Now I can compile rgdal by the command install.packages('rgdal', type = "source", configure.args=c('--with-gdal-config=/home/programs/anaconda3/bin/gdal-config', '--with-proj-include=/home/programs/anaconda3/include', '--with-proj-lib=/home/programs/anaconda3/lib'))
3- But I can not compile sf package by the command install.packages('sf', type = "source", configure.args='--with-gdal-config=/home/programs/anaconda3/bin/gdal-config --with-geos-config=/home/programs/anaconda3/bin/geos-config --with-proj-include=/home/programs/anaconda3/include/ --with-proj-lib=/home/programs/anaconda3/lib/')
4- It keeps saying configure: error: proj_api.h not found in standard or given locations.. If I don't do step 1, I get linking errors for both rgdal and sf.

How can I overcome this issue?

@edzer
Copy link
Member

edzer commented Apr 19, 2019

First of all, for support for anaconda-R is not given here.

Second, the CRAN version of sf does not support PROJ >= 6.0.0, but the github version does (#988).

@isezen
Copy link

isezen commented Apr 19, 2019

Actually this was not directly related to anaconda but with libraries in non-standard locations. Sorry for inconvenience.

@edzer
Copy link
Member

edzer commented Apr 19, 2019

Have you tried to install sf from github instead?

@isezen
Copy link

isezen commented Apr 19, 2019

Yes, I JUST tried but still getting same error. I issue all the required paths, rgdal compiles but sf does not. That was the main reason to post here.

I used following command:

sudo CFLAGS="-I/home/programs/anaconda3/include" LDFLAGS="-L/home/programs/anaconda3/lib" R CMD INSTALL sf.tar.gz --configure-args='--with-gdal-config=/home/programs/anaconda3/bin/gdal-config --with-geos-config=/home/programs/anaconda3/bin/geos-config --with-proj-include=/home/programs/anaconda3/include --with-proj-lib=/home/programs/anaconda3/lib'

@edzer
Copy link
Member

edzer commented Apr 19, 2019

Pls show the command you used + all the output it gave. How was sf.tar.gz created?

@isezen
Copy link

isezen commented Apr 19, 2019

I also set LD_LIBRARY_PATH env. var. for /home/programs/anaconda3/lib if it makes any difference.
I can confirm that proj_api.h is in /home/programs/anaconda3/include folder.

COMMAND:

sudo CFLAGS="-I/home/programs/anaconda3/include" LDFLAGS="-L/home/programs/anaconda3/lib" R CMD INSTALL sf.tar.gz --configure-args='--with-gdal-config=/home/programs/anaconda3/bin/gdal-config --with-geos-config=/home/programs/anaconda3/bin/geos-config --with-proj-include=/home/programs/anaconda3/include --with-proj-lib=/home/programs/anaconda3/lib'

OUTPUT:

* installing to library ‘/usr/lib64/R/library’
* installing *source* package ‘sf’ ...
configure: CC: gcc -m64 -std=gnu99
configure: CXX: g++ -m64 -std=gnu++11
configure: gdal-config set to /home/programs/anaconda3/bin/gdal-config
checking gdal-config exists... yes
checking gdal-config executable... yes
checking gdal-config usability... yes
configure: GDAL: 2.4.1
checking GDAL version >= 2.0.1... yes
checking for gcc... gcc -m64 -std=gnu99
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 -m64 -std=gnu99 accepts -g... yes
checking for gcc -m64 -std=gnu99 option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -m64 -std=gnu99 -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /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 gdal.h usability... yes
checking gdal.h presence... yes
checking for gdal.h... yes
checking GDAL: linking with --libs only... yes
checking GDAL: /home/programs/anaconda3/share/gdal/pcs.csv readable... yes
checking GDAL: checking whether PROJ is available for linking:... yes
checking GDAL: checking whether PROJ is available fur running:... yes
checking proj_api.h usability... no
checking proj_api.h presence... no
checking for proj_api.h... no
configure: error: proj_api.h not found in standard or given locations.
ERROR: configuration failed for package ‘sf’
* removing ‘/usr/lib64/R/library/sf’

@edzer
Copy link
Member

edzer commented Apr 19, 2019

Where did sf.tar.gz come from?

@isezen
Copy link

isezen commented Apr 19, 2019

I downloaded master branch (master.zip file) from GitHub sf page, unzipped, and make tar.gz again to use for R CMD INSTALL.

@edzer
Copy link
Member

edzer commented Apr 19, 2019

First time I hear someone trying that. R users would try remotes::install_github("r-spatial/sf", configure.args = "..."), with ... properly filled.

@isezen
Copy link

isezen commented Apr 19, 2019

Thanks for remotes::install_github hint. I've been trying to cope with this for two days and output here it is:

remotes::install_github("r-spatial/sf", configure.args = "--with-gdal-config=/home/programs/anaconda3/bin/gdal-config --with-geos-confiDownloading GitHub repo r-spatial/sf@master--with-proj-include=/home/programs/anaconda3/include/ --with-proj-lib=/home/programs/anaconda3
✔  checking for file ‘/tmp/Rtmpr2yWue/remotes14b7067396bf4/r-spatial-sf-6c0e2f0/DESCRIPTION’ ...
─  preparing ‘sf’:
✔  checking DESCRIPTION meta-information ...
─  cleaning src
─  running ‘cleanup’
─  checking for LF line-endings in source and make files and shell scripts
─  checking for empty or unneeded directories
─  building ‘sf_0.7-4.tar.gz’

Installing package into ‘/usr/lib64/R/library’
(as ‘lib’ is unspecified)
* installing *source* package ‘sf’ ...
configure: CC: gcc -m64 -std=gnu99
configure: CXX: g++ -m64 -std=gnu++11
configure: gdal-config set to /home/programs/anaconda3/bin/gdal-config
checking gdal-config exists... yes
checking gdal-config executable... yes
checking gdal-config usability... yes
configure: GDAL: 2.4.1
checking GDAL version >= 2.0.1... yes
checking for gcc... gcc -m64 -std=gnu99
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 -m64 -std=gnu99 accepts -g... yes
checking for gcc -m64 -std=gnu99 option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -m64 -std=gnu99 -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /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 gdal.h usability... yes
checking gdal.h presence... yes
checking for gdal.h... yes
checking GDAL: linking with --libs only... yes
checking GDAL: /home/programs/anaconda3/share/gdal/pcs.csv readable... yes
checking GDAL: checking whether PROJ is available for linking:... yes
checking GDAL: checking whether PROJ is available fur running:... yes
checking proj_api.h usability... no
checking proj_api.h presence... no
checking for proj_api.h... no
configure: error: proj_api.h not found in standard or given locations.
ERROR: configuration failed for package ‘sf’
* removing ‘/usr/lib64/R/library/sf’
Error in i.p(...) :
  (converted from warning) installation of package ‘/tmp/Rtmpr2yWue/file14b7065b9b83c/sf_0.7-4.tar.gz’ had non-zero exit status
>

@edzer
Copy link
Member

edzer commented Apr 19, 2019

This is what I get on a PROJ 6.0.0 system:

> remotes::install_github("r-spatial/sf")
Downloading GitHub repo r-spatial/sf@master
v  checking for file '/tmp/RtmptEvSO5/remotesf2fc5f807/r-spatial-sf-6c0e2f0/DESCRIPTION' ...
-  preparing 'sf':
v  checking DESCRIPTION meta-information ...
-  cleaning src
-  running 'cleanup'
-  checking for LF line-endings in source and make files and shell scripts
-  checking for empty or unneeded directories
-  building 'sf_0.7-4.tar.gz'
   
Installing package into '/usr/local/lib/R/site-library'
(as 'lib' is unspecified)
* installing *source* package 'sf' ...
configure: CC: gcc -std=gnu99
configure: CXX: g++ -std=gnu++11
checking for gdal-config... /usr/local/bin/gdal-config
checking gdal-config usability... yes
configure: GDAL: 2.5.0
checking GDAL version >= 2.0.1... yes
checking for gcc... gcc -std=gnu99
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 -std=gnu99 accepts -g... yes
checking for gcc -std=gnu99 option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -std=gnu99 -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /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 gdal.h usability... yes
checking gdal.h presence... yes
checking for gdal.h... yes
checking GDAL: linking with --libs only... yes
checking GDAL: /usr/local/share/gdal/pcs.csv readable... no
checking GDAL: checking whether PROJ is available for linking:... yes
checking GDAL: checking whether PROJ is available fur running:... yes
configure: pkg-config proj exists, will use it
checking proj.h usability... yes
checking proj.h presence... yes
checking for proj.h... yes
configure: PROJ: 6.0.0
checking for proj_context_create in -lproj... yes
checking for geos-config... /usr/bin/geos-config
checking geos-config usability... yes
configure: GEOS: 3.5.1
checking GEOS version >= 3.4.0... yes
checking geos_c.h usability... yes
checking geos_c.h presence... yes
checking for geos_c.h... yes
checking geos: linking with -L/usr/lib/x86_64-linux-gnu -lgeos_c... yes
configure: Package CPP flags:  -I/usr/local/include -DHAVE_PROJ_H -I/usr/local/include -I/usr/include
configure: Package LIBS: -L/usr/local/lib -lproj   -L/usr/local/lib -lgdal -L/usr/lib/x86_64-linux-gnu -lgeos_c
configure: creating ./config.status
config.status: creating src/Makevars
** libs
g++ -std=gnu++11 -I/usr/share/R/include -DNDEBUG -I/usr/local/include -DHAVE_PROJ_H -I/usr/local/include -I/usr/include -I"/usr/local/lib/R/site-library/Rcpp/include"    -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c RcppExports.cpp -o RcppExports.o

Your system seems to be missing pkg-config proj; it looks like PROJ >= 6.0.0 detection & handling depends on having that available. Maybe it is available but not on the search path?

@isezen
Copy link

isezen commented Apr 19, 2019

I've set up environment variable as PKG_CONFIG_PATH=/home/programs/anaconda3/lib/pkgconfig/ and run pkg-config proj. It returns nothing but If I issue, for instance, the command pkg-config --libs proj, result is -L/home/programs/anaconda3/lib -lproj. It successfully finds the information on the defined path. But nonetheless, the output of the installation is still same.

I don't see a line mentioning pkg-config in my output as follows:

configure: pkg-config proj exists, will use it

But in the successful rgdal output, I can see the following lines:

...
checking GDAL: /home/programs/anaconda3/share/gdal/pcs.csv readable... yes
configure: pkg-config proj not available
  set PKG_CONFIG_PATH to the directory containing proj.pc
configure: PROJ version not determined using pkg-config proj
configure: proj CPP flags:  -I/home/programs/anaconda3/include -I/home/programs/anaconda3/include
checking PROJ header API:... proj_api.h
checking proj_api.h presence and usability... yes
checking PROJ version >= 4.8.0... yes
...

Probably, I have a silly tiny detail in somewhere but I can't figure out.

@edzer
Copy link
Member

edzer commented Apr 19, 2019

Look for proj.pc and follow the instruction:

  set PKG_CONFIG_PATH to the directory containing proj.pc

@isezen
Copy link

isezen commented Apr 19, 2019

Yes, This is what I already did. I confirmed that proj.pc (and others) are at /home/programs/anaconda3/lib/pkgconfig/.

@edzer
Copy link
Member

edzer commented Apr 19, 2019

There's not a mix of PROJ versions on your system, right?

@isezen
Copy link

isezen commented Apr 19, 2019

Edzer,
I was pretty sure that only installed versions are belong to anaconda and also I could solve it. The silly detail was that user environment variables were not preserved for sudo.

First, run R with required environment variables,

sudo PKG_CONFIG_PATH="/home/programs/anaconda3/lib/pkgconfig/" LD_LIBRARY_PATH="/home/programs/anaconda3/lib" R

Second, install sf.

remotes::install_github("r-spatial/sf", configure.args = "--with-gdal-config=/home/programs/anaconda3/bin/gdal-config --with-geos-config=/home/programs/anaconda3/bin/geos-config --with-proj-include=/home/programs/anaconda3/include/ --with-proj-lib=/home/programs/anaconda3/lib/")

Again, excuse me for spending your time, I hope this post helps someone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants