Description
I maintain ~1200 install and maintain R packages on a RHEL7 for which I don't have root access. I've found the best approach is to install all compiled libraries to support R packages in one place. I need to install sf as a dependency for other packages. I've successfully installed gdal, proj7, tiff-4, and geos. I've also installed a newer version of sqlite3 than what was on our system because one of these packages required it (proj7 I believe).
When I got the configure error "libproj or sqlite3 not found in standard or given locations," I initially thought it was because sqlite3 was not in a standard location because the sf config files don't use pkg-config for sqlite3 (although pkg-config is used for proj). However, when I execute the test on the command on the command line, I get the same error whether my PATH is pointing to the default sqlite3 install or mine. So, now I'm not sure if it's a sqlite3 issue at all.
[wa02042@mforgehn5 sf]$ ${CXX} ${CPPFLAGS} -o proj_conf_test proj_conf_test.cpp ${LIBS} -lsqlite3
/tmp/ccuBYW9n.o: In function main': proj_conf_test.cpp:(.text+0x5): undefined reference to
proj_context_create'
collect2: error: ld returned 1 exit status
[wa02042@mforgehn5 sf]$ which sqlite3
/bin/sqlite3
[wa02042@mforgehn5 sf]$ sqlite3 --version
3.7.17 2013-05-20 00:56:22 118a3b35693b134d56ebd780123b7fd6f1497668
[wa02042@mforgehn4 sf]$ g++ -std=gnu++11 -I/usr/local/biotools/r/R-3.6.2/R-dependencies/include -o proj_conf_test proj_conf_test.cpp -lsqlite3
/tmp/ccnTaFWO.o: In function main': proj_conf_test.cpp:(.text+0x5): undefined reference to
proj_context_create'
collect2: error: ld returned 1 exit status
[wa02042@mforgehn4 sf]$ rpm -E %{rhel}
7
[wa02042@mforgehn4 sf]$ which sqlite3
/usr/local/biotools/ver2/2.0.0/bin/sqlite3
[wa02042@mforgehn4 sf]$ sqlite3 --version
3.33.0 2020-08-14 13:23:32 fca8dc8b578f215a969cd899336378966156154710873e68b3d9ac5881b0ff3f
[wa02042@mforgehn4 sf]$ which g++
/usr/local/scl/devtoolset-8/root/usr/bin/g++
[wa02042@mforgehn4 sf]$ g++ --version
g++ (GCC) 8.3.1 20190311 (Red Hat 8.3.1-3)
Copyright (C) 2018 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.
I read through the other sqlite3 post where someone questioned if the -sqlite3 flag is necessary at all. I tried hacking the configure.ac file to skip over the test. I was able to get the shared library to compile, but there's a segfault when I try to load it into R.
[wa02042@mforgehn4 R]$ R --vanilla CMD INSTALL -l /usr/local/biotools/rpackages/R-3.6.2-latest sf
- installing source package �sf� ...
files �configure�, �configure.ac� have the wrong MD5 checksums
** using staged installation
configure: CC: gcc
configure: CXX: g++ -std=gnu++11
checking for gdal-config... /usr/local/biotools/ver2/2.0.0/bin/gdal-config
checking gdal-config usability... yes
configure: GDAL: 3.1.2
checking GDAL version >= 2.0.1... 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... /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... no
checking GDAL: linking with --libs and --dep-libs... yes
checking GDAL: /usr/local/biotools/ver2/2.0.0/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: GDAL: 3.1.2
configure: pkg-config proj exists, will use it
configure: using proj.h.
configure: PROJ: 7.1.0
checking PROJ: checking whether PROJ and sqlite3 are available for linking:... no
checking for geos-config... /usr/local/biotools/ver2/2.0.0/bin/geos-config
checking geos-config usability... yes
configure: GEOS: 3.8.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/local/biotools/ver2/2.0.0/lib -lgeos_c... yes
configure: Package CPP flags: -I/usr/local/biotools/ver2/2.0.0/include -DHAVE_PROJ_H -I/usr/local/biotools/ver2/2.0.0/include -I/usr/local/biotools/ver2/2.0.0/include
configure: Package LIBS: -L/usr/local/biotools/ver2/2.0.0/lib -lproj -L/usr/local/biotools/ver2/2.0.0/lib -lgdal -lcrypto -lsqlite3 -lexpat -ljpeg -ltiff -lpng -L/usr/local/biotools/ver2/2.0.0/lib -lproj -lsqlite3 -lz -lpthread -lm -lrt -ldl -lpcre -lcurl -lxml2 -L/usr/local/biotools/ver2/2.0.0/lib -lgeos_c
configure: creating ./config.status
config.status: creating src/Makevars
** libs
make: Nothing to be done for 'all'.
installing to /usr/local/biotools/rpackages/R-3.6.2-latest/00LOCK-sf/00new/sf/libs
** R
** demo
** inst
** byte-compile and prepare package for lazy loading
in method for �dbWriteTable� with signature �"PostgreSQLConnection","character","sf"�: no definition for class �PostgreSQLConnection�
in method for �dbDataType� with signature �"PostgreSQLConnection","sf"�: no definition for class �PostgreSQLConnection�
in method for �coerce� with signature �"Spatial","sf"�: no definition for class �Spatial�
in method for �coerce� with signature �"Spatial","sfc"�: no definition for class �Spatial�
in method for �coerce� with signature �"sf","Spatial"�: no definition for class �Spatial�
in method for �coerce� with signature �"sfc","Spatial"�: no definition for class �Spatial�
in method for �coerce� with signature �"XY","Spatial"�: no definition for class �Spatial�
in method for �coerce� with signature �"crs","CRS"�: no definition for class �CRS�
** help
*** installing help indices
*** copying figures
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
sh: line 1: 11870 Segmentation fault '/usr/local/biotools/r/R-3.6.2/lib64/R/bin/R' --no-save --slave 2>&1 < '/tmp/RtmpBAXIVh/filed0442428581'
*** caught segfault ***
address 0x89156, cause 'memory not mapped'
Traceback:
1: dyn.load(file, DLLpath = DLLpath, ...)
2: library.dynam(lib, package, package.lib)
3: loadNamespace(package, lib.loc)
4: doTryCatch(return(expr), name, parentenv, handler)
5: tryCatchOne(expr, names, parentenv, handlers[[1L]])
6: tryCatchList(expr, classes, parentenv, handlers)
7: tryCatch({ attr(package, "LibPath") <- which.lib.loc ns <- loadNamespace(package, lib.loc) env <- attachNamespace(ns, pos = pos, deps, exclude, include.only)}, error = function(e) { P <- if (!is.null(cc <- conditionCall(e))) paste(" in", deparse(cc)[1L]) else "" msg <- gettextf("package or namespace load failed for %s%s:\n %s", sQuote(package), P, conditionMessage(e)) if (logical.return) message(paste("Error:", msg), domain = NA) else stop(msg, call. = FALSE, domain = NA)})
8: library(pkg_name, lib.loc = lib, character.only = TRUE, logical.return = TRUE)
9: withCallingHandlers(expr, packageStartupMessage = function(c) invokeRestart("muffleMessage"))
10: suppressPackageStartupMessages(library(pkg_name, lib.loc = lib, character.only = TRUE, logical.return = TRUE))
11: doTryCatch(return(expr), name, parentenv, handler)
12: tryCatchOne(expr, names, parentenv, handlers[[1L]])
13: tryCatchList(expr, classes, parentenv, handlers)
14: tryCatch(expr, error = function(e) { call <- conditionCall(e) if (!is.null(call)) { if (identical(call[[1L]], quote(doTryCatch))) call <- sys.call(-4L) dcall <- deparse(call)[1L] prefix <- paste("Error in", dcall, ": ") LONG <- 75L sm <- strsplit(conditionMessage(e), "\n")[[1L]] w <- 14L + nchar(dcall, type = "w") + nchar(sm[1L], type = "w") if (is.na(w)) w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L], type = "b") if (w > LONG) prefix <- paste0(prefix, "\n ") } else prefix <- "Error : " msg <- paste0(prefix, conditionMessage(e), "\n") .Internal(seterrmessage(msg[1L])) if (!silent && isTRUE(getOption("show.error.messages"))) { cat(msg, file = outFile) .Internal(printDeferredWarnings()) } invisible(structure(msg, class = "try-error", condition = e))})
15: try(suppressPackageStartupMessages(library(pkg_name, lib.loc = lib, character.only = TRUE, logical.return = TRUE)))
16: tools:::.test_load_package("sf", "/usr/local/biotools/rpackages/R-3.6.2-latest/00LOCK-sf/00new")
An irrecoverable exception occurred. R is aborting now ...
ERROR: loading failed
- removing '��/usr/local/biotools/rpackages/R-3.6.2-lates/sf'
Any feedback you could give me here would be greatly appreciated. Thank you.