Ubuntu 20.10 and R 4.1 cannot install sf package

Hi!

I am having a hard time when I tried to install sf package on R4.1/Ubuntu20.10.

When I call the command

install.packages("sf")

  • installing source package ‘sf’ ...
    ** package ‘sf’ successfully unpacked and MD5 sums checked
    ** using staged installation
    configure: CC: gcc -std=gnu99
    configure: CXX: g++ -std=gnu++11
    checking for gdal-config... /usr/bin/gdal-config
    checking gdal-config usability... yes
    configure: GDAL: 3.1.3
    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... /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 gdal.h usability... yes
    checking gdal.h presence... yes
    checking for gdal.h... yes
    checking GDAL: linking with --libs only... yes
    checking GDAL: /usr/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:... ERROR 1: PROJ: proj_create_from_database: SQLite error on SELECT name, type, coordinate_system_auth_name, coordinate_system_code, datum_auth_name, datum_code, area_of_use_auth_name, area_of_use_code, text_definition, deprecated FROM geodetic_crs WHERE auth_name = ? AND code = ?: no such column: area_of_use_auth_name
    ERROR 1: PROJ: proj_create_from_database: SQLite error on SELECT name, coordinate_system_auth_name, coordinate_system_code, geodetic_crs_auth_name, geodetic_crs_code, conversion_auth_name, conversion_code, area_of_use_auth_name, area_of_use_code, text_definition, deprecated FROM projected_crs WHERE auth_name = ? AND code = ?: no such column: area_of_use_auth_name
    ERROR 1: PROJ: proj_create: unrecognized format / unknown name
    ERROR 6: Cannot find coordinate operations from ' to '
    no
    configure: error: OGRCoordinateTransformation() does not return a coord.trans: PROJ not available?
    ERROR: configuration failed for package ‘sf’
  • removing ‘/home/d1-user/R/x86_64-pc-linux-gnu-library/4.1/sf’
  • restoring previous ‘/home/d1-user/R/x86_64-pc-linux-gnu-library/4.1/sf’
    Warning in install.packages :
    installation of package ‘sf’ had non-zero exit status

Apparently the libproj libraries are correctly installed:

$ sudo ldconfig -p | grep libproj
libproj.so.19 (libc6,x86-64) => /lib/x86_64-linux-gnu/libproj.so.19
libproj.so (libc6,x86-64) => /lib/x86_64-linux-gnu/libproj.so

I tried also to install the sf package under sudo R but whit no success.

sudo R

R version 4.1.0 (2021-05-18) -- "Camp Pontanezen"
Copyright (C) 2021 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

During startup - Warning message:
replacing previous import ‘vctrs::data_frame’ by ‘tibble::data_frame’ when loading ‘dplyr’

install.packages("sf")
Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
trying URL 'https://cloud.r-project.org/src/contrib/sf_1.0-0.tar.gz'
Content type 'application/x-gzip' length 3645803 bytes (3.5 MB)
==================================================
downloaded 3.5 MB

  • installing source package ‘sf’ ...
    ** package ‘sf’ successfully unpacked and MD5 sums checked
    ** using staged installation
    configure: CC: gcc -std=gnu99
    configure: CXX: g++ -std=gnu++11
    checking for gdal-config... /usr/bin/gdal-config
    checking gdal-config usability... yes
    configure: GDAL: 3.1.3
    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... /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 gdal.h usability... yes
    checking gdal.h presence... yes
    checking for gdal.h... yes
    checking GDAL: linking with --libs only... yes
    checking GDAL: /usr/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:... ERROR 1: PROJ: proj_create_from_database: SQLite error on SELECT name, type, coordinate_system_auth_name, coordinate_system_code, datum_auth_name, datum_code, area_of_use_auth_name, area_of_use_code, text_definition, deprecated FROM geodetic_crs WHERE auth_name = ? AND code = ?: no such column: area_of_use_auth_name
    ERROR 1: PROJ: proj_create_from_database: SQLite error on SELECT name, coordinate_system_auth_name, coordinate_system_code, geodetic_crs_auth_name, geodetic_crs_code, conversion_auth_name, conversion_code, area_of_use_auth_name, area_of_use_code, text_definition, deprecated FROM projected_crs WHERE auth_name = ? AND code = ?: no such column: area_of_use_auth_name
    ERROR 1: PROJ: proj_create: unrecognized format / unknown name
    ERROR 6: Cannot find coordinate operations from ' to '
    no
    configure: error: OGRCoordinateTransformation() does not return a coord.trans: PROJ not available?
    ERROR: configuration failed for package ‘sf’
  • removing ‘/usr/local/lib/R/site-library/sf’

The downloaded source packages are in
‘/tmp/RtmpU7zCdf/downloaded_packages’
Warning message:
In install.packages("sf") :
installation of package ‘sf’ had non-zero exit status

I suggest installing PROJ from source - Download — PROJ 8.0.1 documentation and the old configure / make / sudo make install.

There seems to be something fishy with your PROJ install (missing sqlite3 maybe?) and the configure should take care of that.

Dear jlacko,

many thanks for the suggestion. I've installed PROJ from source with apparently no error messages.
when typing proj, it correctly states:

Rel. 8.0.1, March 5th, 2021
usage: proj [-bdeEfiIlmorsStTvVwW [args]] [+opt[=arg] ...] [file ...]

but when I tried to install the sf library under R the same error message appears

1 . sudo R

R version 4.1.0 (2021-05-18) -- "Camp Pontanezen"
Copyright (C) 2021 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

[Previously saved workspace restored]

install.packages("sf")
Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
trying URL 'https://cloud.r-project.org/src/contrib/sf_1.0-0.tar.gz'
Content type 'application/x-gzip' length 3645803 bytes (3.5 MB)
==================================================
downloaded 3.5 MB

  • installing source package ‘sf’ ...
    ** package ‘sf’ successfully unpacked and MD5 sums checked
    ** using staged installation
    configure: CC: gcc -std=gnu99
    configure: CXX: g++ -std=gnu++11
    checking for gdal-config... /usr/bin/gdal-config
    checking gdal-config usability... yes
    configure: GDAL: 3.1.3
    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... /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 gdal.h usability... yes
    checking gdal.h presence... yes
    checking for gdal.h... yes
    checking GDAL: linking with --libs only... yes
    checking GDAL: /usr/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:... ERROR 1: PROJ: proj_create_from_database: SQLite error on SELECT name, type, coordinate_system_auth_name, coordinate_system_code, datum_auth_name, datum_code, area_of_use_auth_name, area_of_use_code, text_definition, deprecated FROM geodetic_crs WHERE auth_name = ? AND code = ?: no such column: area_of_use_auth_name
    ERROR 1: PROJ: proj_create_from_database: SQLite error on SELECT name, coordinate_system_auth_name, coordinate_system_code, geodetic_crs_auth_name, geodetic_crs_code, conversion_auth_name, conversion_code, area_of_use_auth_name, area_of_use_code, text_definition, deprecated FROM projected_crs WHERE auth_name = ? AND code = ?: no such column: area_of_use_auth_name
    ERROR 1: PROJ: proj_create: unrecognized format / unknown name
    ERROR 6: Cannot find coordinate operations from ' to '
    no
    configure: error: OGRCoordinateTransformation() does not return a coord.trans: PROJ not available?
    ERROR: configuration failed for package ‘sf’
  • removing ‘/usr/local/lib/R/site-library/sf’

The downloaded source packages are in
‘/tmp/Rtmp7Tl0qP/downloaded_packages’
Warning message:
In install.packages("sf") :
installation of package ‘sf’ had non-zero exit status

  1. Also from rstudio

install.packages("sf")
Installing package into ‘/home/d1-user/R/x86_64-pc-linux-gnu-library/4.1’
(as ‘lib’ is unspecified)
trying URL 'https://cloud.r-project.org/src/contrib/sf_1.0-0.tar.gz'
Content type 'application/x-gzip' length 3645803 bytes (3.5 MB)
==================================================
downloaded 3.5 MB

  • installing source package ‘sf’ ...
    ** package ‘sf’ successfully unpacked and MD5 sums checked
    ** using staged installation
    configure: CC: gcc -std=gnu99
    configure: CXX: g++ -std=gnu++11
    checking for gdal-config... /usr/bin/gdal-config
    checking gdal-config usability... yes
    configure: GDAL: 3.1.3
    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... /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 gdal.h usability... yes
    checking gdal.h presence... yes
    checking for gdal.h... yes
    checking GDAL: linking with --libs only... yes
    checking GDAL: /usr/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:... ERROR 1: PROJ: proj_create_from_database: SQLite error on SELECT name, type, coordinate_system_auth_name, coordinate_system_code, datum_auth_name, datum_code, area_of_use_auth_name, area_of_use_code, text_definition, deprecated FROM geodetic_crs WHERE auth_name = ? AND code = ?: no such column: area_of_use_auth_name
    ERROR 1: PROJ: proj_create_from_database: SQLite error on SELECT name, coordinate_system_auth_name, coordinate_system_code, geodetic_crs_auth_name, geodetic_crs_code, conversion_auth_name, conversion_code, area_of_use_auth_name, area_of_use_code, text_definition, deprecated FROM projected_crs WHERE auth_name = ? AND code = ?: no such column: area_of_use_auth_name
    ERROR 1: PROJ: proj_create: unrecognized format / unknown name
    ERROR 6: Cannot find coordinate operations from ' to '
    no
    configure: error: OGRCoordinateTransformation() does not return a coord.trans: PROJ not available?
    ERROR: configuration failed for package ‘sf’
  • removing ‘/home/d1-user/R/x86_64-pc-linux-gnu-library/4.1/sf’
  • restoring previous ‘/home/d1-user/R/x86_64-pc-linux-gnu-library/4.1/sf’
    Warning in install.packages :
    installation of package ‘sf’ had non-zero exit status
  1. locate libproj.so
    /home/d1-user/Desktop/proj-8.0.1/src/.libs/libproj.so
    /home/d1-user/Desktop/proj-8.0.1/src/.libs/libproj.so.22
    /home/d1-user/Desktop/proj-8.0.1/src/.libs/libproj.so.22.0.1
    /usr/lib/x86_64-linux-gnu/libproj.so
    /usr/lib/x86_64-linux-gnu/libproj.so.19
    /usr/lib/x86_64-linux-gnu/libproj.so.19.1.0
    /usr/local/lib/libproj.so
    /usr/local/lib/libproj.so.22
    /usr/local/lib/libproj.so.22.0.1

  2. locate libsqlite3-dev
    /usr/share/doc/libsqlite3-dev
    /usr/share/doc/libsqlite3-dev/changelog.Debian.gz
    /usr/share/doc/libsqlite3-dev/copyright
    /var/lib/dpkg/info/libsqlite3-dev:amd64.list
    /var/lib/dpkg/info/libsqlite3-dev:amd64.md5sums

Many thanks for any advice you could provide!!!

The sf installation is still finding the old (and wrong) libproj...

This can get messy; several things that come to my mind:

  • updating links via ldconfig
  • specify the "new" proj when installing sf via configure args
install.packages("sf", configure.args = "--with-proj-lib=/usr/local/lib/")
  • delete all libproj.so files from /usr and install from fresh (you still have it in your Desktop compiled, so it should be relatively quick, just sudo make install

Dear jlacko,

again many thanks for the suggested steps!

I followed them and a different error came out:

install.packages("sf", configure.args = "--with-proj-lib=/usr/local/lib/")
Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
trying URL 'https://cloud.r-project.org/src/contrib/sf_1.0-0.tar.gz'
Content type 'application/x-gzip' length 3645803 bytes (3.5 MB)
==================================================
downloaded 3.5 MB

  • installing source package ‘sf’ ...
    ** package ‘sf’ successfully unpacked and MD5 sums checked
    ** using staged installation
    configure: CC: gcc -std=gnu99
    configure: CXX: g++ -std=gnu++11
    checking for gdal-config... /usr/bin/gdal-config
    checking gdal-config usability... yes
    configure: GDAL: 3.1.3
    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... /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 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... no
    /usr/bin/ld: warning: libproj.so.19, needed by /usr/lib/libgdal.so, not found (try using -rpath or -rpath-link)
    /usr/bin/ld: /usr/lib/x86_64-linux-gnu/libspatialite.so.7: undefined reference to geod_geninverse' /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_alter_name'
    /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_create_conversion_eckert_i' /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_context_get_database_path'
    /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_create_conversion_miller_cylindrical' /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_trans_generic'
    /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_create_conversion_oblique_stereographic' /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_create_conversion_wagner_i'
    /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_crs_get_geodetic_crs' /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_as_wkt'
    /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_create_projected_crs' /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_get_area_of_use'
    /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_create_compound_crs' /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_create_conversion_hotine_oblique_mercator_two_point_natural_origin'
    /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_grid_info' /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_create_conversion_transverse_mercator'
    /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_create_derived_geographic_crs' /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_cs_get_type'
    /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_errno_string' /usr/bin/ld: /usr/lib/x86_64-linux-gnu/libspatialite.so.7: undefined reference to proj_todeg'
    /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_create_conversion_utm' /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_info'
    /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_create_conversion_eckert_iii' /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_create_conversion_equidistant_conic'
    /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_coordoperation_get_method_info' /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_create_conversion_mercator_variant_a'
    /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_get_non_deprecated' /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_create_conversion_international_map_world_polyconic'
    /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_create_conversion_azimuthal_equidistant' /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_crs_create_bound_crs_to_WGS84'
    /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_create_conversion_geostationary_satellite_sweep_y' /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_create_conversion_eckert_vi'
    /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_create_geographic_crs_from_datum' /usr/bin/ld: /usr/lib/x86_64-linux-gnu/libspatialite.so.7: undefined reference to geod_init'
    /usr/bin/ld: /usr/lib/x86_64-linux-gnu/libspatialite.so.7: undefined reference to proj_context_set_database_path' /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_create_conversion_two_point_equidistant'
    /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_create_conversion_wagner_iii' /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_create_ellipsoidal_2D_cs'
    /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_context_use_proj4_init_rules' /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_create_conversion_sinusoidal'
    /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_create_conversion_goode_homolosine' /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_create_conversion_eckert_v'
    /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_create_conversion' /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_destroy'
    /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_identify' /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_create_conversion_quadrilateralized_spherical_cube'
    /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_trans' /usr/bin/ld: /usr/lib/x86_64-linux-gnu/libspatialite.so.7: undefined reference to proj_torad'
    /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_create_cartesian_2D_cs' /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_create_conversion_transverse_mercator_south_oriented'
    /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_create_engineering_crs' /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_create_conversion_pole_rotation_grib_convention'
    /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_create_conversion_hotine_oblique_mercator_variant_a' /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_is_derived_crs'
    /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_create_operations' /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_operation_factory_context_set_area_of_interest'
    /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_create_conversion_orthographic' /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_create_conversion_eckert_iv'
    /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_list_get_count' /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_context_set_search_paths'
    /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_create_from_name' /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_ellipsoid_get_parameters'
    /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_create_conversion_wagner_ii' /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_create_conversion_albers_equal_area'
    /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_create_conversion_polar_stereographic_variant_a' /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_create_conversion_wagner_vii'
    /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_crs_alter_cs_linear_unit' /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_create_conversion_lambert_conic_conformal_2sp_belgium'
    /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_create_conversion_stereographic' /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_create_conversion_mercator_variant_b'
    /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_context_destroy' /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_get_crs_info_list_from_database'
    /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_get_source_crs' /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_create_conversion_van_der_grinten'
    /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_create_conversion_robinson' /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_context_errno'
    /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_create_conversion_new_zealand_mapping_grid' /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_get_ellipsoid'
    /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_is_deprecated' /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_prime_meridian_get_parameters'
    /usr/bin/ld: /usr/lib/x86_64-linux-gnu/libspatialite.so.7: undefined reference to proj_normalize_for_visualization' /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_create_conversion_gnomonic'
    /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_create_conversion_mollweide' /usr/bin/ld: /usr/lib/x86_64-linux-gnu/libspatialite.so.7: undefined reference to geod_inverse'
    /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_coordoperation_get_towgs84_values' /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_crs_alter_parameters_linear_unit'
    /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_create_conversion_gauss_schreiber_transverse_mercator' /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_create_transformation'
    /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_create_conversion_vertical_perspective' /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_get_codes_from_database'
    /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_create_conversion_laborde_oblique_mercator' /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_crs_get_datum'
    /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_create_conversion_wagner_iv' /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_create_conversion_lambert_cylindrical_equal_area'
    /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_get_type' /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_create_geocentric_crs_from_datum'
    /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_int_list_destroy' /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_create_conversion_eckert_ii'
    /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_list_get' /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_assign_context'
    /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_query_geodetic_crs_from_datum' /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_crs_alter_cs_angular_unit'
    /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_convert_conversion_to_other_method' /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_create_geographic_crs'
    /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_clone' /usr/bin/ld: /usr/lib/x86_64-linux-gnu/libspatialite.so.7: undefined reference to proj_angular_input'
    /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_is_equivalent_to' /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_get_id_code'
    /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_area_set_bbox' /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_area_destroy'
    /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_create' /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_create_conversion_lambert_azimuthal_equal_area'
    /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_log_func' /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_crs_create_bound_crs'
    /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_cs_get_axis_count' /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_crs_promote_to_3D'
    /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_get_authorities_from_database' /usr/bin/ld: /usr/lib/x86_64-linux-gnu/libspatialite.so.7: undefined reference to proj_angular_output'
    /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_get_name' /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_create_conversion_gall'
    /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_create_conversion_krovak_north_oriented' /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_create_conversion_cassini_soldner'
    /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_crs_info_list_destroy' /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_create_conversion_spherical_cross_track_height'
    /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_crs_get_coordoperation' /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_create_conversion_lambert_conic_conformal_1sp'
    /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_as_proj_string' /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_create_geocentric_crs'
    /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_area_create' /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_create_from_wkt'
    /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_coordoperation_get_param' /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_cs_get_axis_info'
    /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_get_target_crs' /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_uom_get_info_from_database'
    /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_operation_factory_context_set_grid_availability_use' /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_create_operation_factory_context'
    /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_list_destroy' /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_create_conversion_interrupted_goode_homolosine'
    /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_create_conversion_hotine_oblique_mercator_variant_b' /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_get_prime_meridian'
    /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_create_conversion_polar_stereographic_variant_b' /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_create_conversion_american_polyconic'
    /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_string_list_destroy' /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_create_cs'
    /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_operation_factory_context_set_spatial_criterion' /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_create_conversion_wagner_v'
    /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_operation_factory_context_destroy' /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_create_vertical_crs'
    /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_create_conversion_bonne' /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_coordoperation_get_accuracy'
    /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_create_crs_to_crs' /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_create_conversion_lambert_conic_conformal_2sp'
    /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_as_projjson' /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_crs_alter_geodetic_crs'
    /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_coordoperation_get_grid_used_count' /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_get_id_auth_name'
    /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_alter_id' /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_create_conversion_tunisia_mapping_grid'
    /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_create_conversion_equidistant_cylindrical' /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_create_from_database'
    /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_context_create' /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_crs_get_sub_crs'
    /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_crs_get_coordinate_system' /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_context_set_autoclose_database'
    /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_create_conversion_wagner_vi' /usr/bin/ld: /usr/lib/libgdal.so: undefined reference to proj_coordoperation_get_param_index'
    /usr/bin/ld: /usr/lib/x86_64-linux-gnu/libgeotiff.so.5: undefined reference to `proj_coordoperation_get_param_count'
    collect2: error: ld returned 1 exit status
    /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/libproj.a(grids.o): undefined reference to symbol 'TIFFReadEncodedStrip@@LIBTIFF_4.0'
    /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/libtiff.so: error adding symbols: DSO missing from command line
    collect2: error: ld returned 1 exit status
    configure: Install failure: compilation and/or linkage problems.
    configure: error: GDALAllRegister not found in libgdal.
    ERROR: configuration failed for package ‘sf’
  • removing ‘/usr/local/lib/R/site-library/sf’

The downloaded source packages are in
‘/tmp/RtmpceKAzq/downloaded_packages’
Warning message:
In install.packages("sf", configure.args = "--with-proj-lib=/usr/local/lib/") :
installation of package ‘sf’ had non-zero exit status

  1. To be noted that when removing the libproj.so files from the /usr (before compiling the "new" libproj libraries)

d1-user@L01RI2100770:/usr/lib/x86_64-linux-gnu$ sudo rm libproj.so
d1-user@L01RI2100770:/usr/lib/x86_64-linux-gnu$ sudo rm libproj.so.19
1-user@L01RI2100770:/usr/lib/x86_64-linux-gnu$ sudo rm libproj.so.19.1.0
d1-user@L01RI2100770:/usr/local/lib$ sudo rm libproj.so
d1-user@L01RI2100770:/usr/local/lib$ sudo rm libproj.so.22
d1-user@L01RI2100770:/usr/local/lib$ sudo rm libproj.so.22.0.1
d1-user@L01RI2100770:~$ sudo ldconfig

Then for double checking I was checking the lib.so*files, apparently the files were still there

d1-user@L01RI2100770:~$ locate libproj.so
/home/d1-user/Desktop/proj-8.0.1/src/.libs/libproj.so
/home/d1-user/Desktop/proj-8.0.1/src/.libs/libproj.so.22
/home/d1-user/Desktop/proj-8.0.1/src/.libs/libproj.so.22.0.1
/usr/lib/x86_64-linux-gnu/libproj.so
/usr/lib/x86_64-linux-gnu/libproj.so.19
/usr/lib/x86_64-linux-gnu/libproj.so.19.1.0
/usr/local/lib/libproj.so
/usr/local/lib/libproj.so.22
/usr/local/lib/libproj.so.22.0.1

but if I try to remove them

d1-user@L01RI2100770:~$ sudo rm /usr/lib/x86_64-linux-gnu/libproj.so
rm: cannot remove '/usr/lib/x86_64-linux-gnu/libproj.so': No such file or directory

Any hints?

The error says that the old PROJ is still referenced from your existing GDAL installation; it seems that you will need to make a fresh install of that one too / Download — GDAL documentation

It may be a good idea to purge your local installations of the three backends = PROJ, GDAL and GEOS and install fresh ones. It takes some effort (and you will need to update them yourself) but you will have a control over the versions - the ones provided by ubuntu maintainers are not always bleeding edge (they have a big agenda, so I do not blame them).

I am not familiar with locate, but when looking for libproj.so I use sudo find / -name libproj.so and it has been reliable.

Dear jlacko,

I will follow your suggestions and I will let you know once finalized.
Thanks for the help provided

To be honest I wish I could be of more help - I acutely remember the feeling my PROJ gave up on me, the helplessness and rage at the same time :slight_smile: be strong!

Dear jlacko,

I was finally able to correctly install the sf library, compiling all the (GDAL/GEOS/PROJ) libraries myself.
For some reason R was pointing to the wrong library versions, so I had to remove the old ones and compile them again.

Thanks for your support!

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.