Re: [R-sig-Geo] install rgdal from source macOS
You are making everything unnecessarily complicated. What is happening is that rgdal is being build against the headers and libraries you specify, but the GDAL shared object loaded by rgdal.so is not the one used to build it (so you have multiple copies of at least GDAL installed). These speculations do seem to match what you report: ** testing if installed package can be loaded from temporary location Error: package or namespace load failed for ‘rgdal’ in dyn.load(file, DLLpath = DLLpath, ...): unable to load shared object '/Library/Frameworks/R.framework/Versions/3.6/Resources/library/00LOCK-rgdal /00new/rgdal/libs/rgdal.so': dlopen(/Library/Frameworks/R.framework/Versions/3.6/Resources/library/00LOCK -rgdal/00new/rgdal/libs/rgdal.so, 6): Library not loaded: @rpath/libgdal.26.dylib ^^^ Referenced from: /Library/Frameworks/R.framework/Versions/3.6/Resources/library/00LOCK-rgdal/ 00new/rgdal/libs/rgdal.so Reason: image not found Error: loading failed Execution halted ERROR: loading failed Further, you probably also have multiple copies of PROJ and GDAL support files installed for different versions of PROJ and GDAL. If you read the output carefully, you'll also see that you do not seem to have the pkg-config program installed, so setting the environment variable to point to where proj.pc lives will not work; try pkg-config --help at the command line to check its availability. ./configure: line 2101: pkg-config: command not found ^ configure: pkg-config proj not available set PKG_CONFIG_PATH to the directory containing proj.pc configure: PROJ version not determined using pkg-config proj Roger On Fri, 21 Jun 2019, Dominik Schneider wrote: I finally got back to this. Unfortunately this did not work. It still doesn't like PKG_CONFIG_PATH and now pcs.csv was not readable. It did not exist in 'share/gdal' but I found it in miniconda3/pkgs/libgdal* so I copied it to share/gdal. Sys.getenv('PKG_CONFIG_PATH') [1] "/Users/dosc3612/Applications/miniconda3/envs/rgdal/lib/pkgconfig" grep('proj.pc',dir(Sys.getenv('PKG_CONFIG_PATH'))) I'm not sure why it can't find the pkg config install.packages('rgdal', repo = 'https://r-forge.r-project.org', type = "source", configure.args=c('--with-proj-include=/Users/dosc3612/Applications/miniconda3/envs/rgdal/include', '--with-proj-lib=/Users/dosc3612/Applications/miniconda3/envs/rgdal/lib', '--with-gdal-config=/Users/dosc3612/Applications/miniconda3/envs/rgdal/bin/gdal-config','--with-proj-share=/Users/dosc3612/Applications/miniconda3/envs/rgdal/share/proj', '--with-data-copy=yes')) trying URL 'https://r-forge.r-project.org/src/contrib/rgdal_1.4-5.tar.gz' Content type 'application/x-gzip' length 1687877 bytes (1.6 MB) == downloaded 1.6 MB * installing *source* package ‘rgdal’ ... ** using staged installation configure: R_HOME: /Library/Frameworks/R.framework/Resources configure: CC: clang configure: CXX: clang++ -std=gnu++11 configure: C++11 support available configure: rgdal: 1.4-4 checking for /usr/bin/svnversion... yes cat: inst/SVN_VERSION: No such file or directory configure: svn revision: configure: gdal-config set to /Users/dosc3612/Applications/miniconda3/envs/rgdal/bin/gdal-config checking gdal-config exists... yes checking gdal-config executable... yes checking gdal-config usability... yes configure: GDAL: 3.0.0 checking GDAL version >= 1.11.4... yes checking GDAL version <= 2.5 or >= 3.0... yes checking gdal: linking with --libs only... yes checking GDAL: gdal-config data directory readable... yes checking GDAL: /Users/dosc3612/Applications/miniconda3/envs/rgdal/share/gdal/pcs.csv readable... yes ./configure: line 2101: pkg-config: command not found configure: pkg-config proj not available set PKG_CONFIG_PATH to the directory containing proj.pc configure: PROJ version not determined using pkg-config proj configure: proj CPP flags: -I/Users/dosc3612/Applications/miniconda3/envs/rgdal/include -I/Users/dosc3612/Applications/miniconda3/envs/rgdal/include checking PROJ header API:... proj_api.h checking proj_api.h presence and usability... yes checking PROJ version >= 4.8.0... yes configure: PROJ_LIB: /Users/dosc3612/Applications/miniconda3/envs/rgdal/share/proj dyld: Library not loaded: @rpath/libproj.15.dylib Referenced from: /private/var/folders/bb/13z2kq0j01jg5q_0ypjc76grgn/T/RtmpVtyBCi/R.INSTALL76ca8b2ce2d/rgdal/./proj_conf_test2 Reason: image not found ./configure: line 2451: 30994 Abort trap: 6 PROJ_LIB="${proj_share_path}" ./proj_conf_test2 checking PROJ: proj.db found and readable... yes configure: Copy data for: configure: PROJ.4: /Users/dosc3612/Applications/miniconda3/envs/rgdal/share/proj configure: GDAL: /Users/dosc3612/Applications/miniconda3/envs/rgdal/share/gdal configure: Package CPP flags: -I/Users/dosc3612/Applications/miniconda3/envs/rgdal/include -I/Users/dosc361
Re: [R-sig-Geo] install rgdal from source macOS
I finally got back to this. Unfortunately this did not work. It still doesn't like PKG_CONFIG_PATH and now pcs.csv was not readable. It did not exist in 'share/gdal' but I found it in miniconda3/pkgs/libgdal* so I copied it to share/gdal. > Sys.getenv('PKG_CONFIG_PATH') [1] "/Users/dosc3612/Applications/miniconda3/envs/rgdal/lib/pkgconfig" > grep('proj.pc',dir(Sys.getenv('PKG_CONFIG_PATH'))) I'm not sure why it can't find the pkg config > install.packages('rgdal', repo = 'https://r-forge.r-project.org', type = "source", configure.args=c('--with-proj-include=/Users/dosc3612/Applications/miniconda3/envs/rgdal/include', '--with-proj-lib=/Users/dosc3612/Applications/miniconda3/envs/rgdal/lib', '--with-gdal-config=/Users/dosc3612/Applications/miniconda3/envs/rgdal/bin/gdal-config','--with-proj-share=/Users/dosc3612/Applications/miniconda3/envs/rgdal/share/proj', '--with-data-copy=yes')) trying URL 'https://r-forge.r-project.org/src/contrib/rgdal_1.4-5.tar.gz' Content type 'application/x-gzip' length 1687877 bytes (1.6 MB) == downloaded 1.6 MB * installing *source* package ‘rgdal’ ... ** using staged installation configure: R_HOME: /Library/Frameworks/R.framework/Resources configure: CC: clang configure: CXX: clang++ -std=gnu++11 configure: C++11 support available configure: rgdal: 1.4-4 checking for /usr/bin/svnversion... yes cat: inst/SVN_VERSION: No such file or directory configure: svn revision: configure: gdal-config set to /Users/dosc3612/Applications/miniconda3/envs/rgdal/bin/gdal-config checking gdal-config exists... yes checking gdal-config executable... yes checking gdal-config usability... yes configure: GDAL: 3.0.0 checking GDAL version >= 1.11.4... yes checking GDAL version <= 2.5 or >= 3.0... yes checking gdal: linking with --libs only... yes checking GDAL: gdal-config data directory readable... yes checking GDAL: /Users/dosc3612/Applications/miniconda3/envs/rgdal/share/gdal/pcs.csv readable... yes ./configure: line 2101: pkg-config: command not found configure: pkg-config proj not available set PKG_CONFIG_PATH to the directory containing proj.pc configure: PROJ version not determined using pkg-config proj configure: proj CPP flags: -I/Users/dosc3612/Applications/miniconda3/envs/rgdal/include -I/Users/dosc3612/Applications/miniconda3/envs/rgdal/include checking PROJ header API:... proj_api.h checking proj_api.h presence and usability... yes checking PROJ version >= 4.8.0... yes configure: PROJ_LIB: /Users/dosc3612/Applications/miniconda3/envs/rgdal/share/proj dyld: Library not loaded: @rpath/libproj.15.dylib Referenced from: /private/var/folders/bb/13z2kq0j01jg5q_0ypjc76grgn/T/RtmpVtyBCi/R.INSTALL76ca8b2ce2d/rgdal/./proj_conf_test2 Reason: image not found ./configure: line 2451: 30994 Abort trap: 6 PROJ_LIB="${proj_share_path}" ./proj_conf_test2 checking PROJ: proj.db found and readable... yes configure: Copy data for: configure: PROJ.4: /Users/dosc3612/Applications/miniconda3/envs/rgdal/share/proj configure: GDAL: /Users/dosc3612/Applications/miniconda3/envs/rgdal/share/gdal configure: Package CPP flags: -I/Users/dosc3612/Applications/miniconda3/envs/rgdal/include -I/Users/dosc3612/Applications/miniconda3/envs/rgdal/include -DACCEPT_USE_OF_DEPRECATED_PROJ_API_H configure: Package LIBS: -L/Users/dosc3612/Applications/miniconda3/envs/rgdal/lib -lgdal -L/Users/dosc3612/Applications/miniconda3/envs/rgdal/lib -lproj configure: creating ./config.status config.status: creating src/Makevars ** libs clang++ -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/Users/dosc3612/Applications/miniconda3/envs/rgdal/include -I/Users/dosc3612/Applications/miniconda3/envs/rgdal/include -DACCEPT_USE_OF_DEPRECATED_PROJ_API_H -I"/Library/Frameworks/R.framework/Versions/3.6/Resources/library/sp/include" -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include -fPIC -Wall -g -O2 -c OGR_write.cpp -o OGR_write.o clang++ -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/Users/dosc3612/Applications/miniconda3/envs/rgdal/include -I/Users/dosc3612/Applications/miniconda3/envs/rgdal/include -DACCEPT_USE_OF_DEPRECATED_PROJ_API_H -I"/Library/Frameworks/R.framework/Versions/3.6/Resources/library/sp/include" -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include -fPIC -Wall -g -O2 -c gdal-bindings.cpp -o gdal-bindings.o clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/Users/dosc3612/Applications/miniconda3/envs/rgdal/include -I/Users/dosc3612/Applications/miniconda3/envs/rgdal/include -DACCEPT_USE_OF_DEPRECATED_PROJ_API_H -I"/Library/Frameworks/R.framework/Versions/3.6/Resources/library/sp/include" -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include -fPIC -Wall -g -O2 -c init.c -o init.o clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/Users/dosc3612/Applications/minicond
Re: [R-sig-Geo] install rgdal from source macOS
for compiling rgdal from source on OSX against gdal 3 and proj 6.1.0, please use the dev version on r-forge. See also https://github.com/r-spatial/sf/issues/1070 On 6/9/19 9:52 PM, Dominik Schneider wrote: > I'm trying to install rgdal from source on a fresh r 3.6 installation. > i setup a conda environment to install gdal, proj, geos > > install.packages('rgdal', type = "source", > configure.args=c('--with-proj-include=/Users/dosc3612/Applications/miniconda3/envs/rgdal/include', > '--with-proj-lib=/Users/dosc3612/Applications/miniconda3/envs/rgdal/lib', > '--with-gdal-config=/Users/dosc3612/Applications/miniconda3/envs/rgdal/bin/gdal-config')) > > The full output is below but the first error I see is: > ./configure: line 2101: pkg-config: command not found > configure: pkg-config proj not available > set PKG_CONFIG_PATH to the directory containing proj.pc > configure: PROJ version not determined using pkg-config proj > > which I don't understand because: > Sys.getenv('PKG_CONFIG_PATH') > [1] "/Users/dosc3612/Applications/miniconda3/envs/rgdal/lib/pkgconfig" > > and just to confirm: > (rgdal) Phoenix:~ $ ls `echo $PKG_CONFIG_PATH` | grep proj > proj.pc > > *Is there another way to set PKG_CONFIG_PATH within install.packages?* > > There are also some undefined symbols: > Undefined symbols for architecture x86_64: > "_pj_ctx_fclose", referenced from: > _main in proj_conf_test2-9a39dc.o > "_pj_get_default_ctx", referenced from: > _main in proj_conf_test2-9a39dc.o > "_pj_open_lib", referenced from: > _main in proj_conf_test2-9a39dc.o > ld: symbol(s) not found for architecture x86_64 > clang: error: linker command failed with exit code 1 (use -v to see > invocation) > ./configure: line 2422: ./proj_conf_test2: No such file or directory > > I tried with gdal 2.4.1 and gdal 3.0.0 (after seeing > http://r-sig-geo.2731867.n2.nabble.com/GDAL-3-0-0-and-rgdal-tt7592822.html#a7592834 > ) > proj is 6.1 > geos is 3.7.1 > > What did I miss? Please advise. Thanks. > > FULL OUTPUT: >> install.packages('rgdal', type = "source", > configure.args=c('--with-proj-include=/Users/dosc3612/Applications/miniconda3/envs/rgdal/include', > '--with-proj-lib=/Users/dosc3612/Applications/miniconda3/envs/rgdal/lib', > '--with-gdal-config=/Users/dosc3612/Applications/miniconda3/envs/rgdal/bin/gdal-config')) > --- Please select a CRAN mirror for use in this session --- > trying URL 'https://cloud.r-project.org/src/contrib/rgdal_1.4-4.tar.gz' > Content type 'application/x-gzip' length 1687518 bytes (1.6 MB) > == > downloaded 1.6 MB > > * installing *source* package ‘rgdal’ ... > ** package ‘rgdal’ successfully unpacked and MD5 sums checked > ** using staged installation > configure: R_HOME: /Library/Frameworks/R.framework/Resources > configure: CC: clang > configure: CXX: clang++ -std=gnu++11 > configure: C++11 support available > configure: rgdal: 1.4-4 > checking for /usr/bin/svnversion... yes > configure: svn revision: 833 > configure: gdal-config set to > /Users/dosc3612/Applications/miniconda3/envs/rgdal/bin/gdal-config > checking gdal-config exists... yes > checking gdal-config executable... yes > checking gdal-config usability... yes > configure: GDAL: 2.4.1 > checking C++11 support for GDAL >= 2.3.0... yes > checking GDAL version >= 1.11.4... yes > checking GDAL version <= 2.5 or >= 3.0... yes > checking gdal: linking with --libs only... yes > checking GDAL: gdal-config data directory readable... yes > checking GDAL: > /Users/dosc3612/Applications/miniconda3/envs/rgdal/share/gdal/pcs.csv > readable... yes > ./configure: line 2101: pkg-config: command not found > configure: pkg-config proj not available > set PKG_CONFIG_PATH to the directory containing proj.pc > configure: PROJ version not determined using pkg-config proj > configure: proj CPP flags: > -I/Users/dosc3612/Applications/miniconda3/envs/rgdal/include > -I/Users/dosc3612/Applications/miniconda3/envs/rgdal/include > checking PROJ header API:... proj_api.h > checking proj_api.h presence and usability... yes > checking PROJ version >= 4.8.0... yes > Undefined symbols for architecture x86_64: > "_pj_ctx_fclose", referenced from: > _main in proj_conf_test2-9a39dc.o > "_pj_get_default_ctx", referenced from: > _main in proj_conf_test2-9a39dc.o > "_pj_open_lib", referenced from: > _main in proj_conf_test2-9a39dc.o > ld: symbol(s) not found for architecture x86_64 > clang: error: linker command failed with exit code 1 (use -v to see > invocation) > ./configure: line 2422: ./proj_conf_test2: No such file or directory > checking PROJ.4: proj.db found and readable... yes > Undefined symbols for architecture x86_64: > "_pj_ctx_fclose", referenced from: > _main in proj_conf_test3-9f8df7.o > "_pj_get_default_ctx", referenced from: > _main in proj_conf_test3-9f8df7.o > "_pj_open_lib", referenced from: > _main in proj_conf_test3-9f8df7.o > ld: symbol(s) not
[R-sig-Geo] install rgdal from source macOS
I'm trying to install rgdal from source on a fresh r 3.6 installation. i setup a conda environment to install gdal, proj, geos install.packages('rgdal', type = "source", configure.args=c('--with-proj-include=/Users/dosc3612/Applications/miniconda3/envs/rgdal/include', '--with-proj-lib=/Users/dosc3612/Applications/miniconda3/envs/rgdal/lib', '--with-gdal-config=/Users/dosc3612/Applications/miniconda3/envs/rgdal/bin/gdal-config')) The full output is below but the first error I see is: ./configure: line 2101: pkg-config: command not found configure: pkg-config proj not available set PKG_CONFIG_PATH to the directory containing proj.pc configure: PROJ version not determined using pkg-config proj which I don't understand because: Sys.getenv('PKG_CONFIG_PATH') [1] "/Users/dosc3612/Applications/miniconda3/envs/rgdal/lib/pkgconfig" and just to confirm: (rgdal) Phoenix:~ $ ls `echo $PKG_CONFIG_PATH` | grep proj proj.pc *Is there another way to set PKG_CONFIG_PATH within install.packages?* There are also some undefined symbols: Undefined symbols for architecture x86_64: "_pj_ctx_fclose", referenced from: _main in proj_conf_test2-9a39dc.o "_pj_get_default_ctx", referenced from: _main in proj_conf_test2-9a39dc.o "_pj_open_lib", referenced from: _main in proj_conf_test2-9a39dc.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) ./configure: line 2422: ./proj_conf_test2: No such file or directory I tried with gdal 2.4.1 and gdal 3.0.0 (after seeing http://r-sig-geo.2731867.n2.nabble.com/GDAL-3-0-0-and-rgdal-tt7592822.html#a7592834 ) proj is 6.1 geos is 3.7.1 What did I miss? Please advise. Thanks. FULL OUTPUT: > install.packages('rgdal', type = "source", configure.args=c('--with-proj-include=/Users/dosc3612/Applications/miniconda3/envs/rgdal/include', '--with-proj-lib=/Users/dosc3612/Applications/miniconda3/envs/rgdal/lib', '--with-gdal-config=/Users/dosc3612/Applications/miniconda3/envs/rgdal/bin/gdal-config')) --- Please select a CRAN mirror for use in this session --- trying URL 'https://cloud.r-project.org/src/contrib/rgdal_1.4-4.tar.gz' Content type 'application/x-gzip' length 1687518 bytes (1.6 MB) == downloaded 1.6 MB * installing *source* package ‘rgdal’ ... ** package ‘rgdal’ successfully unpacked and MD5 sums checked ** using staged installation configure: R_HOME: /Library/Frameworks/R.framework/Resources configure: CC: clang configure: CXX: clang++ -std=gnu++11 configure: C++11 support available configure: rgdal: 1.4-4 checking for /usr/bin/svnversion... yes configure: svn revision: 833 configure: gdal-config set to /Users/dosc3612/Applications/miniconda3/envs/rgdal/bin/gdal-config checking gdal-config exists... yes checking gdal-config executable... yes checking gdal-config usability... yes configure: GDAL: 2.4.1 checking C++11 support for GDAL >= 2.3.0... yes checking GDAL version >= 1.11.4... yes checking GDAL version <= 2.5 or >= 3.0... yes checking gdal: linking with --libs only... yes checking GDAL: gdal-config data directory readable... yes checking GDAL: /Users/dosc3612/Applications/miniconda3/envs/rgdal/share/gdal/pcs.csv readable... yes ./configure: line 2101: pkg-config: command not found configure: pkg-config proj not available set PKG_CONFIG_PATH to the directory containing proj.pc configure: PROJ version not determined using pkg-config proj configure: proj CPP flags: -I/Users/dosc3612/Applications/miniconda3/envs/rgdal/include -I/Users/dosc3612/Applications/miniconda3/envs/rgdal/include checking PROJ header API:... proj_api.h checking proj_api.h presence and usability... yes checking PROJ version >= 4.8.0... yes Undefined symbols for architecture x86_64: "_pj_ctx_fclose", referenced from: _main in proj_conf_test2-9a39dc.o "_pj_get_default_ctx", referenced from: _main in proj_conf_test2-9a39dc.o "_pj_open_lib", referenced from: _main in proj_conf_test2-9a39dc.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) ./configure: line 2422: ./proj_conf_test2: No such file or directory checking PROJ.4: proj.db found and readable... yes Undefined symbols for architecture x86_64: "_pj_ctx_fclose", referenced from: _main in proj_conf_test3-9f8df7.o "_pj_get_default_ctx", referenced from: _main in proj_conf_test3-9f8df7.o "_pj_open_lib", referenced from: _main in proj_conf_test3-9f8df7.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) ./configure: line 2482: ./proj_conf_test3: No such file or directory checking PROJ.4: conus found and readable... yes configure: Package CPP flags: -I/Users/dosc3612/Applications/miniconda3/envs/rgdal/include -I/Users/dosc3612/Applications/miniconda3/envs/rgdal/include -DACCEPT_USE_OF_DEPRECATED_PROJ_API_H configu