Open alexyshr opened 2 months ago
I complemented the LD_LIBRARY_PATH
inside .bashrc
:
export LD_LIBRARY_PATH="/home/myuser/sqlite/usr/local/lib:$LD_LIBRARY_PATH"
export LD_LIBRARY_PATH="~/googletest/usr/local/lib64:$LD_LIBRARY_PATH"
export LD_LIBRARY_PATH="/home/myuser/proj940/lib64:$LD_LIBRARY_PATH"
export LD_LIBRARY_PATH="/home/myuser/geos3121/lib64:$LD_LIBRARY_PATH"
export LD_LIBRARY_PATH="/home/myuser/gdal385/lib64:$LD_LIBRARY_PATH"
After running
remotes::install_github("r-spatial/sf", configure.args = "--with-gdal-config=/home/myuser/gdal385/bin/gdal-config --with-geos-config=/home/myuser/geos3121/bin/geos-config --with-proj-include=/home/myuser/proj940/include/ --with-proj-lib=/home/myuser/proj940/lib64/")
the errors are shown below
configure: error: libproj or sqlite3 not found in standard or given locations.
Then I found this:
https://github.com/r-spatial/sf#multiple-gdal-geos-andor-proj-versions-on-your-system
Let's see if I can solve it!
This person tried setting the variable inside R with some success: https://github.com/r-spatial/sf/issues/844#issuecomment-654477840
I had to add some additional details, because after implementing his solution, I got the next error:
** testing if installed package can be loaded from temporary location
Error: package or namespace load failed for ‘sf’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/home/myuser/R/x86_64-pc-linux-gnu-library/4.4/00LOCK-sf/00new/sf/libs/sf.so':
/home/myuser/gdal385/lib64/libgdal.so.34: undefined symbol: sqlite3_total_changes64
These are the steps to solve my issue:
proj
(binaries or headers/devel) from the system.SQLite
library (not the devel package) was not removed because it was required for Rstudio
..Rprofile
Important: The order of loading libraries matters!
Note the use of the variable CPATH
and the dynamic load of sqlite
Sys.setenv("LD_LIBRARY_PATH" = "/home/muyser/gdal385/lib64:/home/muyser/geos3121/lib64:/home/myuser/proj940/lib64:~/googletest/usr/local/lib64:/home/myuser/sqlite/usr/local/lib")
dyn.load("/home/myuser/geos3121/lib64/libgeos.so.3.12.1")
dyn.load("/home/myuser/geos3121/lib64/libgeos_c.so")
Sys.setenv("CPATH" = "/home/myuser/proj940/include:/home/myuser/sqlite/usr/local/include")
dyn.load("/home/myuser/sqlite/usr/local/lib/libsqlite3.so")
dyn.load("/home/myuser/sqlite/usr/local/lib/libsqlite3.so.0.8.6")
dyn.load("/home/myuser/proj940/lib64/libproj.so.25.9.4.0")
dyn.load("/home/myuser/proj940/lib64/libproj.so")
Then I was able to install from GitHub
using:
remotes::install_github("r-spatial/sf", configure.args = "--with-gdal-config=/home/myuser/gdal385/bin/gdal-config --with-geos-config=/home/myuser/geos3121/bin/geos-config --with-proj-include=/home/myuser/proj940/include/ --with-proj-lib=/home/myuser/proj940/lib64/")
Extra Note: If you get the next error when compiling gdal
, it was related to extra characters (:) in the environment variables. It was solved by removing the extra ":" at the end of some environment variables defined inside .bashrc
.
[93%] Built target gcore_mdreader
CMakeFiles/GDAL.dir/build.make:2457: *** target pattern contains no '%'. Stop.
make[1]: *** [CMakeFiles/Makefile2:4697: CMakeFiles/GDAL.dir/all] Error 2
make: *** [Makefile:141: all] Error 2
Congrats on getting this done, and I'd agree that this is a very hard and painful procedure.
Thank you!. Please let me know if you have any additional advice or different procedures for making this easier!
I need to install
sf
fromGitHub
to allow proper reading ofHDF5
files. I don't have an admin user. IT support can help me to install from repositories but not to compile from source.IT support updated all the dependencies. Library names:
udunits2-devel
,libcurl-devel
,libxml2-devel
,libgdal-dev
,proj-dev
,sqlite-devel
,geos-config
. The versions of the libraries were at that point as shown bellow:Nonetheless, the
sf
package was unable to read the coordinates from HDF5 files.So, I started the process of complying from sources. I managed to compile everything from 1 to 11. I got error only on 12 (installing
sf
from GitHub)1) Install the dependencies (
udunits2-devel
,libcurl-devel
,libxml2-devel
) (Admin IT user)2) Compile SQLite3 Download: https://www.sqlite.org/2024/sqlite-autoconf-3450300.tar.gz
3) Edit
.bashrc
file to add or edit environment variables4) Compile GTest
Procedure: here
5) Edit
.bashrc
6) Compiling PROJ
Download: here Procedure: here
7) Edit
.bashrc
8) Compiling GEOS
The installer: here The procedure: here
9)Edit .bashrc
10) Compiling GDAL
Download: here Procedure: here
The outcome of the first
cmake
is cmake_gdal_outcome.txt. There is a warning:11) edit
.bashrc
export GDAL_LIBRARY_PATH=/home/myuser/gdal385/lib64/libgdal.so12) Install
sf
from GitHub using non-standard locations (compiled folders)The outcome of
sf
GitHub install is sf_install_github.txt. There are some issues related to:Any advice will be appreciated.
Best