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

sf build error on CRAN platform macos-x86_64-clang #40

Closed
edzer opened this issue Oct 29, 2016 · 7 comments
Closed

sf build error on CRAN platform macos-x86_64-clang #40

edzer opened this issue Oct 29, 2016 · 7 comments

Comments

@edzer
Copy link
Member

edzer commented Oct 29, 2016

For CRAN platform r-devel-macos-x86_64-clang I see the following error:

** testing if installed package can be loaded
Error in dyn.load(file, DLLpath = DLLpath, ...) : 
  unable to load shared object '/Users/ripley/R/packages/tests-devel/sf.Rcheck/sf/libs/sf.so':
  dlopen(/Users/ripley/R/packages/tests-devel/sf.Rcheck/sf/libs/sf.so, 6): Symbol not found: _H5T_NATIVE_DOUBLE_g
  Referenced from: /Users/ripley/R/packages/tests-devel/sf.Rcheck/sf/libs/sf.so
  Expected in: flat namespace
 in /Users/ripley/R/packages/tests-devel/sf.Rcheck/sf/libs/sf.so
Error: loading failed
Execution halted
ERROR: loading failed

BDR mentioned that you have not allowed for static builds (on macOS, where it needs to link to hdf5, at least) , but I don't see how to solve this.

@dieza
Copy link

dieza commented Nov 6, 2016

Same error?
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/Users/agus/Library/R/3.3/library/sf/libs/sf.so':
dlopen(/Users/agus/Library/R/3.3/library/sf/libs/sf.so, 6): Symbol not found: __ZN4geos2io9WKBReader4readERNSt3__113basic_istreamIcNS2_11char_traitsIcEEEE
Referenced from: /Users/agus/Library/R/3.3/library/sf/libs/sf.so
Expected in: flat namespace
in /Users/agus/Library/R/3.3/library/sf/libs/sf.so
Error: loading failed
Ejecución interrumpida
ERROR: loading failed

@edzer
Copy link
Member Author

edzer commented Nov 6, 2016

Similar, but pointing to a symbol (WKBReader) in the GEOS library. Did you try installing directly from CRAN? If yes, what was the full output? Have you tried this?

@dieza
Copy link

dieza commented Nov 6, 2016

In other machine, I have no brew install, but I�ve tried to repliclate the gdal-config stuff
devtools::install_github('edzer/sfr')
Downloading GitHub repo edzer/sfr@master
from URL https://api.github.com/repos/edzer/sfr/zipball/master
Installing sf
'/Library/Frameworks/R.framework/Resources/bin/R' --no-site-file --no-environ
--no-save --no-restore --quiet CMD INSTALL
'/private/var/folders/sm/1djysrdj1clbzvn35gv8vqq40000gn/T/Rtmpbx08DG/devtools15add85fb625/edzer-sfr-bae7c24'
--library='/Users/adiez/Library/R/3.3/library' --install-tests

  • installing source package �sf� ...
    checking for gdal-config... /Library/Frameworks/GDAL.framework/Programs/gdal-config
    checking gdal-config usability... yes
    configure: GDAL: 2.1.1
    checking GDAL version >= 2.0.0... yes
    checking geos-config usability... yes
    configure: GEOS: 3.5.0
    checking GEOS version >= 3.3.0... yes
    configure: creating ./config.status
    config.status: creating src/Makevars
    ** libs
    clang++ -std=c++11 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/GDAL.framework/Versions/2.1/Headers -I/Library/Frameworks/GEOS.framework/Versions/3/unix/include -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Users/adiez/Library/R/3.3/library/Rcpp/include" -fPIC -Wall -mtune=core2 -g -O2 -c RcppExports.cpp -o RcppExports.o
    clang++ -std=c++11 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/GDAL.framework/Versions/2.1/Headers -I/Library/Frameworks/GEOS.framework/Versions/3/unix/include -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Users/adiez/Library/R/3.3/library/Rcpp/include" -fPIC -Wall -mtune=core2 -g -O2 -c bbox.cpp -o bbox.o
    clang++ -std=c++11 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/GDAL.framework/Versions/2.1/Headers -I/Library/Frameworks/GEOS.framework/Versions/3/unix/include -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Users/adiez/Library/R/3.3/library/Rcpp/include" -fPIC -Wall -mtune=core2 -g -O2 -c gdal.cpp -o gdal.o
    clang++ -std=c++11 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/GDAL.framework/Versions/2.1/Headers -I/Library/Frameworks/GEOS.framework/Versions/3/unix/include -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Users/adiez/Library/R/3.3/library/Rcpp/include" -fPIC -Wall -mtune=core2 -g -O2 -c gdal_geom.cpp -o gdal_geom.o
    clang++ -std=c++11 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/GDAL.framework/Versions/2.1/Headers -I/Library/Frameworks/GEOS.framework/Versions/3/unix/include -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Users/adiez/Library/R/3.3/library/Rcpp/include" -fPIC -Wall -mtune=core2 -g -O2 -c gdal_read.cpp -o gdal_read.o
    clang++ -std=c++11 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/GDAL.framework/Versions/2.1/Headers -I/Library/Frameworks/GEOS.framework/Versions/3/unix/include -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Users/adiez/Library/R/3.3/library/Rcpp/include" -fPIC -Wall -mtune=core2 -g -O2 -c gdal_write.cpp -o gdal_write.o
    clang++ -std=c++11 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/GDAL.framework/Versions/2.1/Headers -I/Library/Frameworks/GEOS.framework/Versions/3/unix/include -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Users/adiez/Library/R/3.3/library/Rcpp/include" -fPIC -Wall -mtune=core2 -g -O2 -c geos.cpp -o geos.o
    In file included from geos.cpp:8:
    In file included from /Library/Frameworks/GEOS.framework/Versions/3/unix/include/geos/geom/Geometry.h:25:
    /Library/Frameworks/GEOS.framework/Versions/3/unix/include/GEOS/platform.h:129:10: warning: 'ISNAN' macro redefined

    define ISNAN(x) __inline_isnand(static_cast(x))

     ^
    

    /Library/Frameworks/R.framework/Resources/include/R_ext/Arith.h:70:11: note: previous definition is here

    define ISNAN(x) R_isnancpp(x)

      ^
    

    1 warning generated.
    clang++ -std=c++11 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/GDAL.framework/Versions/2.1/Headers -I/Library/Frameworks/GEOS.framework/Versions/3/unix/include -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Users/adiez/Library/R/3.3/library/Rcpp/include" -fPIC -Wall -mtune=core2 -g -O2 -c wkb.cpp -o wkb.o
    clang++ -std=c++11 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o sf.so RcppExports.o bbox.o gdal.o gdal_geom.o gdal_read.o gdal_write.o geos.o wkb.o -framework GDAL -L/Library/Frameworks/GEOS.framework/Versions/3/unix/lib -lgeos -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
    installing to /Users/adiez/Library/R/3.3/library/sf/libs
    ** R
    ** demo
    ** inst
    ** tests
    ** preparing package for lazy loading
    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 in dyn.load(file, DLLpath = DLLpath, ...) :
    unable to load shared object '/Users/adiez/Library/R/3.3/library/sf/libs/sf.so':
    dlopen(/Users/adiez/Library/R/3.3/library/sf/libs/sf.so, 6): Library not loaded: /data/builds/Bob/darwin13.universal.clang51__default/xt_lib_geos/darwin13.universal.clang51/Release/src/geos-2.2.3/../../../../dist/darwin13.universal.clang51/Release/lib/libgeos.2.dylib
    Referenced from: /Users/adiez/Library/R/3.3/library/sf/libs/sf.so
    Reason: image not found
    Error: loading failed
    Execution halted
    ERROR: loading failed

  • removing �/Users/adiez/Library/R/3.3/library/sf�
    Error: Command failed (1)

    devtools::install_github('edzer/sfr')
    Downloading GitHub repo edzer/sfr@master
    from URL https://api.github.com/repos/edzer/sfr/zipball/master
    Installing sf
    '/Library/Frameworks/R.framework/Resources/bin/R' --no-site-file --no-environ
    --no-save --no-restore --quiet CMD INSTALL
    '/private/var/folders/sm/1djysrdj1clbzvn35gv8vqq40000gn/T/Rtmpbx08DG/devtools15adda3dd4be/edzer-sfr-bae7c24'
    --library='/Users/adiez/Library/R/3.3/library' --install-tests

  • installing source package �sf� ...
    checking for gdal-config... /Library/Frameworks/GDAL.framework/Programs/gdal-config
    checking gdal-config usability... yes
    configure: GDAL: 2.1.1
    checking GDAL version >= 2.0.0... yes
    checking geos-config usability... yes
    configure: GEOS: 3.5.0
    checking GEOS version >= 3.3.0... yes
    configure: creating ./config.status
    config.status: creating src/Makevars
    ** libs
    clang++ -std=c++11 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/GDAL.framework/Versions/2.1/Headers -I/Library/Frameworks/GEOS.framework/Versions/3/unix/include -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Users/adiez/Library/R/3.3/library/Rcpp/include" -fPIC -Wall -mtune=core2 -g -O2 -c RcppExports.cpp -o RcppExports.o
    clang++ -std=c++11 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/GDAL.framework/Versions/2.1/Headers -I/Library/Frameworks/GEOS.framework/Versions/3/unix/include -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Users/adiez/Library/R/3.3/library/Rcpp/include" -fPIC -Wall -mtune=core2 -g -O2 -c bbox.cpp -o bbox.o
    clang++ -std=c++11 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/GDAL.framework/Versions/2.1/Headers -I/Library/Frameworks/GEOS.framework/Versions/3/unix/include -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Users/adiez/Library/R/3.3/library/Rcpp/include" -fPIC -Wall -mtune=core2 -g -O2 -c gdal.cpp -o gdal.o
    clang++ -std=c++11 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/GDAL.framework/Versions/2.1/Headers -I/Library/Frameworks/GEOS.framework/Versions/3/unix/include -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Users/adiez/Library/R/3.3/library/Rcpp/include" -fPIC -Wall -mtune=core2 -g -O2 -c gdal_geom.cpp -o gdal_geom.o
    clang++ -std=c++11 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/GDAL.framework/Versions/2.1/Headers -I/Library/Frameworks/GEOS.framework/Versions/3/unix/include -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Users/adiez/Library/R/3.3/library/Rcpp/include" -fPIC -Wall -mtune=core2 -g -O2 -c gdal_read.cpp -o gdal_read.o
    clang++ -std=c++11 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/GDAL.framework/Versions/2.1/Headers -I/Library/Frameworks/GEOS.framework/Versions/3/unix/include -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Users/adiez/Library/R/3.3/library/Rcpp/include" -fPIC -Wall -mtune=core2 -g -O2 -c gdal_write.cpp -o gdal_write.o
    clang++ -std=c++11 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/GDAL.framework/Versions/2.1/Headers -I/Library/Frameworks/GEOS.framework/Versions/3/unix/include -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Users/adiez/Library/R/3.3/library/Rcpp/include" -fPIC -Wall -mtune=core2 -g -O2 -c geos.cpp -o geos.o
    In file included from geos.cpp:8:
    In file included from /Library/Frameworks/GEOS.framework/Versions/3/unix/include/geos/geom/Geometry.h:25:
    /Library/Frameworks/GEOS.framework/Versions/3/unix/include/GEOS/platform.h:129:10: warning: 'ISNAN' macro redefined

    define ISNAN(x) __inline_isnand(static_cast(x))

     ^
    

    /Library/Frameworks/R.framework/Resources/include/R_ext/Arith.h:70:11: note: previous definition is here

    define ISNAN(x) R_isnancpp(x)

      ^
    

    1 warning generated.
    clang++ -std=c++11 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/GDAL.framework/Versions/2.1/Headers -I/Library/Frameworks/GEOS.framework/Versions/3/unix/include -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Users/adiez/Library/R/3.3/library/Rcpp/include" -fPIC -Wall -mtune=core2 -g -O2 -c wkb.cpp -o wkb.o
    clang++ -std=c++11 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o sf.so RcppExports.o bbox.o gdal.o gdal_geom.o gdal_read.o gdal_write.o geos.o wkb.o -framework GDAL -L/Library/Frameworks/GEOS.framework/Versions/3/unix/lib -lgeos -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
    installing to /Users/adiez/Library/R/3.3/library/sf/libs
    ** R
    ** demo
    ** inst
    ** tests
    ** preparing package for lazy loading
    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 in dyn.load(file, DLLpath = DLLpath, ...) :
    unable to load shared object '/Users/adiez/Library/R/3.3/library/sf/libs/sf.so':
    dlopen(/Users/adiez/Library/R/3.3/library/sf/libs/sf.so, 6): Library not loaded: /data/builds/Bob/darwin13.universal.clang51__default/xt_lib_geos/darwin13.universal.clang51/Release/src/geos-2.2.3/../../../../dist/darwin13.universal.clang51/Release/lib/libgeos.2.dylib
    Referenced from: /Users/adiez/Library/R/3.3/library/sf/libs/sf.so
    Reason: image not found
    Error: loading failed
    Execution halted
    ERROR: loading failed

  • removing �/Users/adiez/Library/R/3.3/library/sf�
    Error: Command failed (1)
    El 6Nov, 2016, a las 2:57 PM, Edzer Pebesma notifications@github.com escribi�:

Similar, but pointing to a symbol (WKBReader) in the GEOS library. Did you try installing directly from CRAN? If yes, what was the full output? Have you tried this?


You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.

@edzer
Copy link
Member Author

edzer commented Nov 7, 2016

Again, this points to a problem with the GEOS library.

edzer added a commit that referenced this issue Nov 16, 2016
Signed-off-by: Edzer Pebesma <edzer.pebesma@uni-muenster.de>
@edzer
Copy link
Member Author

edzer commented Nov 25, 2016

We get a compile on the CRAN macosx machine, but it breaks in runtime on st_union. It might be that checking for geos 3.3.0 in configure is broken, but that would have given a link-time error? @rsbivand . I added #if version > 3.3.0 around GEOSUnion_r() in b1f4841, but suspect the problem is somewhere else.

@rsbivand
Copy link
Member

This suggests that the problem is not that GEOS isn't there, but that GDAL was not built with GEOS. Do we have the config.log of the OSX GDAL build?

@edzer
Copy link
Member Author

edzer commented Dec 21, 2016

The issues have now been resolved:

  • the CRAN binaries for MacOSX all work with statically linked libraries, meaning that the dynamic libraries of (binary) R packages only have links to system libraries, and not to anything installed by users
  • GDAL does not allow a static build with GEOS included, meaning that any GEOS operation sf used through the GDAL interface had to be rewritten to directly use GEOS: cc75436
  • GDAL does come with a configure option to statically link to Proj.4, so that can be used through the GDAL interface
  • in addition to that, 0.2-8 will directly link to Proj.4 as this provides stronger error checking on proj4 strings (GDAL will accept nearly anything and then treat it as WGS84)
  • this also resolves Building OSX GDAL/PROJ.4/GEOS and ext-deps for GDAL drivers #79

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

3 participants