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

No OS X El Capitan binaries for v 5.0 #393

Closed
ben519 opened this issue Jun 20, 2017 · 15 comments
Closed

No OS X El Capitan binaries for v 5.0 #393

ben519 opened this issue Jun 20, 2017 · 15 comments

Comments

@ben519
Copy link

ben519 commented Jun 20, 2017

Any plans to make binaries for X El Capitan binaries for v 5.0? I noticed there are none.

screen shot 2017-06-20 at 8 40 21 am

Thanks!

@edzer
Copy link
Member

edzer commented Jun 20, 2017

CRAN does that, but will hopefully succeed for 0.5-1; that'll be submitted soon, since the new RSQLite breaks sf.

@edzer
Copy link
Member

edzer commented Jun 20, 2017

The error message we see on El Capitan are pretty weird; I suspect they have sth to do with the new compiler there, not sure 0.5-1 will fix that. Have you given it a thought to install from source?

@ben519
Copy link
Author

ben519 commented Jun 20, 2017

Interesting. Yes, if I try it as is, I get

* installing *source* package ‘sf’ ...
** package ‘sf’ successfully unpacked and MD5 sums checked
configure: CC: /usr/local/opt/llvm/bin/clang -fopenmp
configure: CXX: /usr/local/opt/llvm/bin/clang++
checking for gdal-config... no
no
configure: error: gdal-config not found or not executable.
ERROR: configuration failed for package ‘sf’
* removing ‘/Library/Frameworks/R.framework/Versions/3.4/Resources/library/sf’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/3.4/Resources/library/sf’

Of course, this is without following the install notes here. Your "use at your own risk" note scared me from trying. If anything broke I wouldn't have the first clue how to fix it. And I'm not that motivated to take the risk.

Really appreciate the help though. It's a great package.

@edzer
Copy link
Member

edzer commented Jun 20, 2017

Thanks!

I'm not a mac user, but had the impression that "brew" doesn't come with an "unbrew", and that scared me. But usually I find out I was wrong after all.

@rsbivand
Copy link
Member

See this thread (not only Roy's brain that kicks in more slowly ... ):

https://stat.ethz.ch/pipermail/r-sig-mac/2017-June/012429.html

@kent37
Copy link

kent37 commented Jun 23, 2017

I am trying to install sf 0.5-0 on macOS 10.12.5. I have installed GDAL 2.1 complete from http://www.kyngchaos.com/software/frameworks. Trying to install with the r-sig-mac recipe referenced above I get

Downloads $ R CMD INSTALL sf_0.5-0.tar.gz --configure-args='-with-gdal-config=/Library/Frameworks/GDAL.framework/Versions/2.1/unix/bin/gdal-config -with-geos-config=/Library/Frameworks/GEOS.framework/Versions/3/unix/bin/geos-config'
Loading /Library/Frameworks/R.framework/Resources/etc/Rprofile.site* installing to library ‘/Users/kent/Library/R/library’
* installing *source* package ‘sf’ ...
** package ‘sf’ successfully unpacked and MD5 sums checked
configure: CC: clang
configure: CXX: clang++ -arch x86_64 -ftemplate-depth-256
configure: gdal-config set to /Library/Frameworks/GDAL.framework/Versions/2.1/unix/bin/gdal-config
checking gdal-config exists... yes
checking gdal-config executable... yes
checking gdal-config usability... yes
configure: GDAL: 2.1.3
checking GDAL version >= 2.0.0... yes
checking for gcc... clang
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 clang accepts -g... yes
checking for clang option to accept ISO C89... none needed
checking how to run the C preprocessor... clang -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... rm: conftest.dSYM: is a directory
rm: conftest.dSYM: is a directory
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: /Library/Frameworks/GDAL.framework/Versions/2.1/Resources/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 ‘/Users/kent/Library/R/library/sf’
* restoring previous ‘/Users/kent/Library/R/library/sf’

I have tried adding various flavors of --with-proj-include=/Library/Frameworks/PROJ.framework/Versions/Current/Headers --with-proj-lib=/Library/Frameworks/PROJ.framework/unix/lib to the command but get the same result.

I can't make much sense of the configure script but I see it is using pkg-config. I did not have this on my system; after installing it i get

Downloads $ pkg-config proj --exists --print-errors
Package proj was not found in the pkg-config search path.
Perhaps you should add the directory containing `proj.pc'
to the PKG_CONFIG_PATH environment variable
No package 'proj' found

so maybe that is part of the problem? I don't seem to have a proj.pc file anywhere.

@alistaire47
Copy link

I've been trying to get this to install on Sierra, and have got the brew dependencies sorted out and appropriately linked (at least to the point that it doesn't explicitly complain, anyway), but now it's complaining that it can't find the Spatial class:

***lots of normal checks and compiling, then:***

installing to /Library/Frameworks/R.framework/Versions/3.4/Resources/library/sf/libs
** R
** data
** demo
** inst
** tests
** preparing package for lazy loading
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”
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
Error: package or namespace load failed for ‘sf’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/Library/Frameworks/R.framework/Versions/3.4/Resources/library/sf/libs/sf.so':
  dlopen(/Library/Frameworks/R.framework/Versions/3.4/Resources/library/sf/libs/sf.so, 6): Library not loaded: @rpath/libjasper.4.dylib
  Referenced from: /usr/local/opt/gdal2/lib/libgdal.20.dylib
  Reason: image not found
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/Library/Frameworks/R.framework/Versions/3.4/Resources/library/sf’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/3.4/Resources/library/sf’
Installation failed: Command failed (1)

I do have jasper installed, and that .dylib is located at /usr/local/opt/jasper/lib/libjasper.4.dylib, but I'm not sure how to help gdal find it. I apologize for my ignorance about building/flags/etc., but any thoughts or advice?

@edzer
Copy link
Member

edzer commented Jun 25, 2017

The complaint about Spatial is just a note, not an indication of a problem. The problem is jasper. Was it installed with brew? Did you install it or did brew do? Maybe remove it and reinstall gdal?

@alistaire47
Copy link

I think jasper was installed automatically by homebrew as a dependency of gdal. I uninstalled both, reinstalled jasper first independently with brew install jasper (probably unnecessary), and then reinstalled gdal and now it builds fine! Thank you!

Caveat: I first installed gdal with just brew install gdal2 (without all the flags) which installs a precompiled ("bottled") version. It was sufficient to build sf, but when I realized I forgot the flags, I went back and added them, which caused it to compile from source. This earned me the warning that

Warning: osgeo/osgeo4mac/gdal2 dependency gcc was built with a different C++ standard
library (libstdc++ from clang). This may cause problems at runtime.

which I suspect is what has been causing people to install gcc from source (2). It seems to work fine without doing so, so I'll take my chances for the moment and try that if it gets weird.

@kent37
Copy link

kent37 commented Jul 6, 2017

I finally got a source build to work on macOS. The problems stemmed from use of pkg-config in configure. pkg-config is not standard with macOS and neither pkg-config nor supporting .pc files are installed by the KyngChaos GDAL complete installer.

Here are the steps I took to get it to build:

  • Install GDAL complete from http://www.kyngchaos.com/software/frameworks
  • Install pkg-config from http://macpkg.sourceforge.net/
  • Add pkg-config to PATH and define PKG_CONFIG_PATH in .bash_profile with
    export PATH=$PATH:/opt/pkgconfig/bin
    export PKG_CONFIG_PATH=/usr/lib/pkgconfig:/usr/local/lib/pkgconfig
  • Create a file /usr/local/lib/pkgconfig/proj.pc with these contents:
prefix=/Library/Frameworks/PROJ.framework/unix/
exec_prefix=@exec_prefix@
libdir=${prefix}lib
includedir=${prefix}include

Name: proj
Description: Cartographic Projections Library.
Requires:
Version: 4
Libs: -L${libdir} -lproj
Cflags: -I${includedir}

With all that, sf 0.5-1 builds using the command
R CMD INSTALL sf_0.5-1.tar.gz --configure-args='-with-gdal-config=/Library/Frameworks/GDAL.framework/Versions/2.1/unix/bin/gdal-config -with-geos-config=/Library/Frameworks/GEOS.framework/Versions/3/unix/bin/geos-config'

@kent37
Copy link

kent37 commented Jul 8, 2017

I was able to build on a Mac that does not have pkg-config installed by installing KyngChaos GDAL complete and using the command

R CMD INSTALL sf_0.5-1.tar.gz --configure-args='-with-gdal-config=/Library/Frameworks/GDAL.framework/Versions/2.1/unix/bin/gdal-config -with-geos-config=/Library/Frameworks/GEOS.framework/Versions/3/unix/bin/geos-config --with-proj-include=/Library/Frameworks/PROJ.framework/unix/include --with-proj-lib=/Library/Frameworks/PROJ.framework/unix/lib' 

Yay!

@edzer
Copy link
Member

edzer commented Jul 20, 2017

Thanks for all the useful infos! El capitan binaries for sf 0.5-2 are now back on CRAN.

@edzer edzer closed this as completed Jul 20, 2017
@lelysbravo
Copy link

I just found this and it worked! Thank you kent37!!!

@lelysbravo
Copy link

I used kent37 suggestion:
R CMD INSTALL sf_0.5-1.tar.gz --configure-args='-with-gdal-config=/Library/Frameworks/GDAL.framework/Versions/2.1/unix/bin/gdal-config -with-geos-config=/Library/Frameworks/GEOS.framework/Versions/3/unix/bin/geos-config --with-proj-include=/Library/Frameworks/PROJ.framework/unix/include --with-proj-lib=/Library/Frameworks/PROJ.framework/unix/lib'

and it worked!

Thank you!

@admercs
Copy link

admercs commented Jul 19, 2018

Ditto. This is the only thing that worked for me:

R CMD INSTALL sf_0.6-3.tar.gz --configure-args="--with-gdal-config=/usr/local/Cellar/gdal/HEAD-41888/bin/gdal-config --with-geos-config=/usr/local/Cellar/geos/3.6.2/bin/geos-config --with-proj-include=/usr/local/Cellar/proj/5.1.0/include --with-proj-lib=/usr/local/Cellar/proj/5.1.0/lib"

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

7 participants