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

PROJ and sqlite3 are available for linking:... no #1268

Closed
gdk43 opened this issue Feb 14, 2020 · 23 comments
Closed

PROJ and sqlite3 are available for linking:... no #1268

gdk43 opened this issue Feb 14, 2020 · 23 comments

Comments

@gdk43
Copy link

gdk43 commented Feb 14, 2020

Hello,
First of all, my system is Centos 7.6 OS.

My goal was installing the monocle3,
but always failed to here that installing the "sf".

here is my code

remotes::install_github('r-spatial/sf', configure.args=
('--with-gdal-config=/usr/local/bin/gdal-config
--with-proj-lib=/usr/local/lib
--with-proj-include=/usr/local/include
--with-proj-share=/usr/local/share/proj
--with-proj-data=/usr/local/share/proj
--with-geos-config=/usr/local/bin/geos-config'))

image
image
image

I already installed the sqlite3-dev , and also PKG_CONFIG_PATH was good, too.

please, can you tell me what should I do & what was the problem?

Thank you

@edzer
Copy link
Member

edzer commented Feb 18, 2020

I can try if you provide a dockerfile that builds the system to reproduce your problem.

@gdk43
Copy link
Author

gdk43 commented Mar 4, 2020

I'm really sorry for the late reply!!

I tried to install sf with a docker.
I don't know why, but I can't install docker because of a problem with the internet connection of the server, so I'm just installing it as rstudio.

Is there any solution we can do with rstudio?

@edzer
Copy link
Member

edzer commented Mar 4, 2020

Have you followed the instructions for fedora given here: https://github.com/r-spatial/sf ?

@vwtlin
Copy link

vwtlin commented Mar 26, 2020

Hi all,

I have the same problem as well. My OS is macOS Catalina 10.15.4. I tried the R CMD install method but still, have the same problem.
libproj not found in standard or given locations

Screen Shot 2020-03-26 at 10 20 06 am

Appreciate if anyone could help to provide any advice.

@EllaKaye
Copy link

Hello. Same issue here. Only differences with @vwtlin is that I've got GDAL 3.0.4 and I'm on macOS Catalina 10.15.3. Thanks!

@NoodlesWang
Copy link

Hello. Same issue as @EllaKaye . Got GDAL 3.0.4 and libproj not found.

@edzer
Copy link
Member

edzer commented Mar 27, 2020

For all those who get here, use OSX, and don't know what is going on: please stick to using binary distributions; they typically show up on CRAN 1-2 weeks after new versions are distributed as source.

@caiohamamura
Copy link

My travis build for OSX was working fine, but is also broken after sf update:

Travis build

https://travis-ci.com/github/carlos-alberto-silva/rGEDI/jobs/306172914

Travis file

https://github.com/carlos-alberto-silva/rGEDI/blob/fde6de4657e19354c2d7ee6fa7f116b90bbfd32b/.travis.yml

@caiohamamura
Copy link

caiohamamura commented Mar 28, 2020

It seems like the build system is actually fine with gdal, proj and sqlite3 installed from the default package manager. Maybe the problem is within the configure.ac script itself.

If I may give you a suggestion, can't you change sqlite3 cheking to the default ax_lib_sqlite3 from the autoconf-archive.

GDAL also have a macro from the autoconf archive, and it also checks for minimum version. I always try to use those macros to avoid these kind of issues, since they were already tested in multiple platforms.

@edzer
Copy link
Member

edzer commented Mar 28, 2020

@caiohamamura feel free to submit a PR. Your travis testing is a bit quite a bit more extensive than sf's, and sf is moving to github actions. Note that many platforms suffer PROJ installations problems because of a bug in proj.pc / pkg-config installation present in released PROJ.

@rsbivand
Copy link
Member

rsbivand commented Mar 28, 2020

@edzer Were you thinking of https://lists.osgeo.org/pipermail/proj/2020-March/009505.html? @caiohamamura you may want to use the PROJ master to see whether the fixes for proj.pc address your problem. I'd do this outside CI to simplify the possible distractors.

@edzer edzer closed this as completed Apr 5, 2020
@ranghetti
Copy link
Contributor

Sorry for writing in a quite old thread, but I think I am encountering the same issue. I am trying to build a Docker image based on GDAL Ubuntu full Docker with the manual addition of rocker/geospatial features, in order to debug {sen2r} on the more recent GDAL/PROJ environment (https://github.com/ranghetti/sen2r/issues/350). Here you find attached the dockerfile together with three patch files: Docker_gdal_geospatial.zip.

While installing {sf} from GitHub source, the following error occurs:

Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)                                                                                                     
* installing *source* package ‘sf’ ...                                                                                        
** using staged installation                                                                                                  
configure: CC: gcc
configure: CXX: g++ -std=gnu++11
checking for gdal-config... /usr/bin/gdal-config
checking gdal-config usability... yes
configure: GDAL: 3.2.0
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... /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:... yes
configure: GDAL: 3.2.0
configure: pkg-config proj exists, will use it
configure: using proj.h.
configure: PROJ: 7.2.0
checking PROJ: checking whether PROJ and sqlite3 are available for linking:... no
configure: error: libproj or sqlite3 not found in standard or given locations.
ERROR: configuration failed for package ‘sf’
* removing ‘/usr/local/lib/R/site-library/sf’
* restoring previous ‘/usr/local/lib/R/site-library/sf’
Error: Failed to install 'sf' from GitHub:
  (converted from warning) installation of package ‘/tmp/Rtmpdc99GY/file5e526a98cbd9/sf_0.9-7.tar.gz’ had non-zero exit status
Execution halted

If I understood well in #1268 (comment), the issue should have ben fixed since PROJ 7.0.1, while I am using version 7.2.0.

Thank you for any possible advice,

@edzer
Copy link
Member

edzer commented Oct 20, 2020

@ranghetti could you check whether libsqlite3-dev was installed in the container, and if not whether installing it resolves the problem?

@ranghetti
Copy link
Contributor

@ranghetti could you check whether libsqlite3-dev was installed in the container, and if not whether installing it resolves the problem?

Yes, it was.

@edzer
Copy link
Member

edzer commented Oct 20, 2020

OK. Does the Dockerfile reproduce the problem, or do I need to apply the patches to it first? If so, could you please provide the docker file after applying the patches?

@edzer
Copy link
Member

edzer commented Oct 20, 2020

Ah, sorry, I see the patch files are used and applied inside the docker file...

@edzer
Copy link
Member

edzer commented Oct 20, 2020

libproj.so is not found in a standard directory; it is in /usr/local/lib, but this is not specified with configure flags when installing sf.

@ranghetti
Copy link
Contributor

You are right, sorry. Nevertheless, this does not solve (using remotes::install_github('r-spatial/sf', configure.args='--with-proj-lib=/usr/local/lib/'), the same error is returned.
Maybe there are some incompatibilities between GDAL/PROJ local installation and packages installed subsequently:

root@2f59abfce005:/# sudo ldconfig -p | grep libproj
        libproj.so.19 (libc6,x86-64) => /usr/local/lib/libproj.so.19
        libproj.so.15 (libc6,x86-64) => /lib/x86_64-linux-gnu/libproj.so.15

where /lib/x86_64-linux-gnu/libproj.so.15 was installed by libproj15, a libspatialite7 dependency.
I will search for additional information regarding the use of a GDAL/PROJ source installation and eventually open a specific issue.
Thank you

@Robinlovelace
Copy link
Contributor

Heads-up @ranghetti I've had a similar issue but with a different solution. Please take a look here if still of use/interest and try to reproduce with the steps outlined there: #1518

Interested to hear if that works for you, I'm trying to tackle the issue as far upstream as possible with input to the rocker-org/versioned2 repo as you'll see if you follow the links. Great to see others installing sf on on Docker images with recent versions of GDAL.

@ranghetti
Copy link
Contributor

Thank you @Robinlovelace for linking here the abovementioned issue. I tried your reproducible example in #1518 (comment), but unfortunately the error persists (I am commenting in #1518 about that). The same in my example using the suggestion in #1518 (comment).

@Evanaxe
Copy link

Evanaxe commented Dec 2, 2020

For anyone else having this problem, I just solved it by setting the PKG_CONFIG_PATH environment variable:

export PKG_CONFIG_PATH=/path/to/proj/lib/pkgconfig/

@dchiu911
Copy link

After much tedious trial and error, I think I may have a solution for those still running into this error. Two steps are necessary:

  1. Compiling the dependency libraries with linking configured
  2. Adding environment paths

I am using proj v8.1.1, sqlite3 v3.33.0 and gdal-config v3.3.2.

When compiling proj, add /lib/pkgconfig/sqlite3.pc to PKG_CONFIG_PATH otherwise ./configure will fail
When compiling gdal, add --with-python and --with-proj flags to ./configure.
Finally, add to LD_LIBRARY_PATH (also LIBRARY_PATH, CPATH, PKG_CONFIG_PATH but not as essential) the lib directory for proj, sqlite3 and gdal.

Then I got the following output:

* installing *source* package ‘sf’ ...
** package ‘sf’ successfully unpacked and MD5 sums checked
** using staged installation
configure: CC: /gsc/software/linux-x86_64-centos7/gcc-7.2.0/bin/gcc
configure: CXX: /gsc/software/linux-x86_64-centos7/gcc-7.2.0/bin/g++ -std=gnu++11
checking for gdal-config... /home/dchiu/lib/gdal-3.3.2/bin/gdal-config
checking gdal-config usability... yes
configure: GDAL: 3.3.2
checking GDAL version >= 2.0.1... yes
checking for gcc... /gsc/software/linux-x86_64-centos7/gcc-7.2.0/bin/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 /gsc/software/linux-x86_64-centos7/gcc-7.2.0/bin/gcc accepts -g... yes
checking for /gsc/software/linux-x86_64-centos7/gcc-7.2.0/bin/gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... /gsc/software/linux-x86_64-centos7/gcc-7.2.0/bin/gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking gdal.h usability... yes
checking gdal.h presence... yes
checking for gdal.h... yes
checking GDAL: linking with --libs only... yes
checking GDAL: /home/dchiu/lib/gdal-3.3.2/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.3.2
configure: pkg-config proj exists, will use it
configure: using proj.h.
configure: PROJ: 8.1.1
checking PROJ: checking whether PROJ and sqlite3 are available for linking:... yes
checking for geos-config... /usr/bin/geos-config
checking geos-config usability... yes
configure: GEOS: 3.4.2
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/lib64 -lgeos_c... yes
configure: Package CPP flags:  -I/home/dchiu/lib/proj/include   -DHAVE_PROJ_H -I/home/dchiu/lib/gdal-3.3.2/include -I/usr/include
configure: Package LIBS: -L/home/dchiu/lib/proj/lib -lproj     -L/home/dchiu/lib/gdal-3.3.2/lib -lgdal -L/usr/lib64 -lgeos_c
configure: creating ./config.status
config.status: creating src/Makevars

P.S. Using gdal v2.3.2 has the /share/gdal/pcs.csv data file although not needed to install sf

@akirahann
Copy link

akirahann commented Apr 8, 2022

For those who install proj and gdal with homebrew on M1/apple silicon, please try this one:
install.packages('sf', configure.args = '--with-proj-include=/opt/homebrew/include/ --with-proj-lib=/opt/homebrew/lib/', configure.vars = 'GDAL_DATA=/opt/homebrew/opt/gdal/share/gdal/')

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