[R-sig-Geo] Installing rgdal with gdal 2.0 on Mac using homebrew

Rainer M Krug Rainer at krugs.de
Mon Jul 18 14:58:47 CEST 2016


Roger Bivand <Roger.Bivand at nhh.no> writes:

> I don't know the OSX incantation, but if gdal 1 is found first, you'd need to put gdal 2 on the path before it.

But than gdal 2 libraries would be always used which I also don't want to do.

Rainer

>
> Roger Bivand
> Norwegian School of Economics
> Bergen, Norway
>
> Fra: Rainer M Krug
> Sendt: mandag 18. juli, 14.40
> Emne: Re: Installing rgdal with gdal 2.0 on Mac using homebrew
> Til: Roger Bivand
> Kopi: r-sig-geo at r-project.org
>
> Roger Bivand writes: > Sounds like an LDPATH issue, where the gdal 1
> dylib is found before gdal 2. Hm. Shouldn't, if I supply LDFLAGS,
> these libraries be used when running (loading) rgdal, or am I missing
> something here? LDPATH as well as LD_LIBRARY_PATH are not set in bash
> ,---- | > Sys.getenv("LDPATH") | [1] "" | >
> Sys.getenv("LD_LIBRARY_PATH") | [1] "" | > `---- Rainer > > Roger
> Bivand > Norwegian School of Economics > Bergen, Norway > > > > On
> Mon, Jul 18, 2016 at 10:18 AM +0200, "Rainer M Krug" > wrote: > > Hi >
>> I want to install rgdal for using gdal 2.0. The standard gdal
> package in > homebrew provides gdal 1.11.3, and gdal-20 is installed
> by using the > osgeo/osgeo4mac/gdal-20 formula, so gdal 2.1.0 is
> installed in > > /usr/local/opt/gdal-20/ > > If I simply say > > ,----
>> | install.packages("rgdal, type="source") > `---- > > rgdal is
> installed without problems, but using gdal 1.11.3. > > But I want to
> use gdal 2.1.0 > > > The info from the gdal-20 formula says: > > ,----
>> | If you build your > | own software and it requires this formula,
> you'll need to add to your > | build variables: > | > | LDFLAGS:
> -L/usr/local/opt/gdal-20/lib > | CPPFLAGS:
> -I/usr/local/opt/gdal-20/include > `---- > > So I did the following to
> install rgdal: > > ,---- > | > install.packages("rgdal", type =
> "source", configure.args = > | >
> "--with-gdal-config=/usr/local/opt/gdal-20/bin/gdal-config;LDFLAGS=-L/usr/local/opt/gdal-20/lib;CPPFLAGS=-I/usr/local/opt/gdal-20/include")
>> | Installing package into ‘/usr/local/lib/R/3.3/site-library’
>> | (as ‘lib’ is unspecified) > | trying URL
> 'https://cran.rstudio.com/src/contrib/rgdal_1.1-10.tar.gz' > | Content
> type 'application/x-gzip' length 1653393 bytes (1.6 MB) > |
> ================================================== > | downloaded 1.6
> MB > | > | * installing *source* package ‘rgdal’ ... > | **
> package ‘rgdal’ successfully unpacked and MD5 sums checked > |
> configure: CC: clang > | configure: CXX: clang++ > | configure: rgdal:
> 1.1-10 > | checking for /usr/bin/svnversion... yes > | configure: svn
> revision: 622 > | configure: gdal-config set to
> /usr/local/opt/gdal-20/bin/gdal-config > | checking gdal-config
> exists... yes > | checking gdal-config executable... yes > | checking
> gdal-config usability... yes > | configure: GDAL: 2.1.0 > | checking
> GDAL version >= 1.6.3... yes > | configure: experimental conditional
> use of GDAL2 > | 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:
> /usr/local/Cellar/gdal-20/2.1.0/share/gdal/pcs.csv readable... yes > |
> checking proj_api.h usability... yes > | checking proj_api.h
> presence... yes > | checking for proj_api.h... yes > | checking for
> pj_init_plus in -lproj... yes > | configure: PROJ.4 version: > 4.8.0 >
> | checking PROJ.4: epsg found and readable... yes > | checking PROJ.4:
> conus found and readable... yes > | configure: Package CPP flags:
> -I/usr/local/Cellar/gdal-20/2.1.0/include > | configure: Package LIBS:
> -L/usr/local/Cellar/gdal-20/2.1.0/lib -lgdal -lproj > | configure:
> creating ./config.status > | config.status: creating src/Makevars > |
> ** libs > | clang++
> -I/usr/local/Cellar/r/3.3.1/R.framework/Resources/include -DNDEBUG
> -I/usr/local/Cellar/gdal-20/2.1.0/include
> -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include
> -I/usr/local/opt/openssl/include -I/usr/local/include
> -I"/usr/local/lib/R/3.3/site-library/sp/include" -fPIC -g -O2 -c
> OGR_write.cpp -o OGR_write.o > | clang++
> -I/usr/local/Cellar/r/3.3.1/R.framework/Resources/include -DNDEBUG
> -I/usr/local/Cellar/gdal-20/2.1.0/include
> -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include
> -I/usr/local/opt/openssl/include -I/usr/local/include
> -I"/usr/local/lib/R/3.3/site-library/sp/include" -fPIC -g -O2 -c
> gdal-bindings.cpp -o gdal-bindings.o > | clang
> -I/usr/local/Cellar/r/3.3.1/R.framework/Resources/include -DNDEBUG
> -I/usr/local/Cellar/gdal-20/2.1.0/include
> -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include
> -I/usr/local/opt/openssl/include -I/usr/local/include
> -I"/usr/local/lib/R/3.3/site-library/sp/include" -fPIC -g -O2 -c
> init.c -o init.o > | clang
> -I/usr/local/Cellar/r/3.3.1/R.framework/Resources/include -DNDEBUG
> -I/usr/local/Cellar/gdal-20/2.1.0/include
> -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include
> -I/usr/local/opt/openssl/include -I/usr/local/include
> -I"/usr/local/lib/R/3.3/site-library/sp/include" -fPIC -g -O2 -c
> inverser.c -o inverser.o > | clang
> -I/usr/local/Cellar/r/3.3.1/R.framework/Resources/include -DNDEBUG
> -I/usr/local/Cellar/gdal-20/2.1.0/include
> -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include
> -I/usr/local/opt/openssl/include -I/usr/local/include
> -I"/usr/local/lib/R/3.3/site-library/sp/include" -fPIC -g -O2 -c
> local_stubs.c -o local_stubs.o > | clang++
> -I/usr/local/Cellar/r/3.3.1/R.framework/Resources/include -DNDEBUG
> -I/usr/local/Cellar/gdal-20/2.1.0/include
> -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include
> -I/usr/local/opt/openssl/include -I/usr/local/include
> -I"/usr/local/lib/R/3.3/site-library/sp/include" -fPIC -g -O2 -c
> ogr_geom.cpp -o ogr_geom.o > | clang
> -I/usr/local/Cellar/r/3.3.1/R.framework/Resources/include -DNDEBUG
> -I/usr/local/Cellar/gdal-20/2.1.0/include
> -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include
> -I/usr/local/opt/openssl/include -I/usr/local/include
> -I"/usr/local/lib/R/3.3/site-library/sp/include" -fPIC -g -O2 -c
> ogr_polygons.c -o ogr_polygons.o > | clang++
> -I/usr/local/Cellar/r/3.3.1/R.framework/Resources/include -DNDEBUG
> -I/usr/local/Cellar/gdal-20/2.1.0/include
> -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include
> -I/usr/local/opt/openssl/include -I/usr/local/include
> -I"/usr/local/lib/R/3.3/site-library/sp/include" -fPIC -g -O2 -c
> ogr_proj.cpp -o ogr_proj.o > | clang++
> -I/usr/local/Cellar/r/3.3.1/R.framework/Resources/include -DNDEBUG
> -I/usr/local/Cellar/gdal-20/2.1.0/include
> -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include
> -I/usr/local/opt/openssl/include -I/usr/local/include
> -I"/usr/local/lib/R/3.3/site-library/sp/include" -fPIC -g -O2 -c
> ogrdrivers.cpp -o ogrdrivers.o > | clang++
> -I/usr/local/Cellar/r/3.3.1/R.framework/Resources/include -DNDEBUG
> -I/usr/local/Cellar/gdal-20/2.1.0/include
> -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include
> -I/usr/local/opt/openssl/include -I/usr/local/include
> -I"/usr/local/lib/R/3.3/site-library/sp/include" -fPIC -g -O2 -c
> ogrsource.cpp -o ogrsource.o > | clang++
> -I/usr/local/Cellar/r/3.3.1/R.framework/Resources/include -DNDEBUG
> -I/usr/local/Cellar/gdal-20/2.1.0/include
> -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include
> -I/usr/local/opt/openssl/include -I/usr/local/include
> -I"/usr/local/lib/R/3.3/site-library/sp/include" -fPIC -g -O2 -c
> projectit.cpp -o projectit.o > | clang++ -dynamiclib
> -Wl,-headerpad_max_install_names -undefined dynamic_lookup
> -single_module -multiply_defined suppress -L/usr/local/opt/gettext/lib
> -L/usr/local/opt/readline/lib -L/usr/local/opt/openssl/lib
> -L/usr/local/lib -L/usr/local/Cellar/r/3.3.1/R.framework/Resources/lib
> -L/usr/local/opt/gettext/lib -L/usr/local/opt/readline/lib
> -L/usr/local/opt/openssl/lib -L/usr/local/lib -o rgdal.so OGR_write.o
> gdal-bindings.o init.o inverser.o local_stubs.o ogr_geom.o
> ogr_polygons.o ogr_proj.o ogrdrivers.o ogrsource.o projectit.o
> -L/usr/local/Cellar/gdal-20/2.1.0/lib -lgdal -lproj
> -F/usr/local/Cellar/r/3.3.1/R.framework/.. -framework R -lintl
> -Wl,-framework -Wl,CoreFoundation > | installing to
> /usr/local/lib/R/3.3/site-library/rgdal/libs > | ** R > | ** data > |
> ** inst > | ** preparing package for lazy loading > | ** 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
> '/usr/local/lib/R/3.3/site-library/rgdal/libs/rgdal.so': > |
> dlopen(/usr/local/lib/R/3.3/site-library/rgdal/libs/rgdal.so, 6):
> Symbol not found: _GDALOpenEx > | Referenced from:
> /usr/local/lib/R/3.3/site-library/rgdal/libs/rgdal.so > | Expected in:
> flat namespace > | in
> /usr/local/lib/R/3.3/site-library/rgdal/libs/rgdal.so > | Error:
> loading failed > | Execution halted > | ERROR: loading failed > | *
> removing ‘/usr/local/lib/R/3.3/site-library/rgdal’ > | *
> restoring previous ‘/usr/local/lib/R/3.3/site-library/rgdal’ > |
> Warning in install.packages : > | installation of package
> ‘rgdal’ had non-zero exit status > | > | The downloaded source
> packages are in > |
> ‘/private/var/folders/50/wcr5bjwn75q595n6x82gxj280000gn/T/RtmpP8byD0/downloaded_packages’
>> | > > `---- > > So it is using gdal 2.1.0 during compilation and
> installation. > > My understanding is now (but I might be wrong), that
> everything works in the building step, but > when loading, it still
> tries to use the gdal 1.11.3 installation to run. > > What am I
> missing here? > > Thanks, > > Rainer > > > > -- > Rainer M. Krug, PhD
> (Conservation Ecology, SUN), MSc (Conservation Biology, UCT),
> Dipl. Phys. (Germany) > > Centre of Excellence for Invasion Biology >
> Stellenbosch University > South Africa > > Tel : +33 - (0)9 53 10 27
> 44 > Cell: +33 - (0)6 85 62 59 98 > Fax : +33 - (0)9 58 10 27 44 > >
> Fax (D): +49 - (0)3 21 21 25 22 44 > > email: Rainer at krugs.de > >
> Skype: RMkrug > > PGP: 0x0F52F982 > > [[alternative HTML version
> deleted]] > > _______________________________________________ >
> R-sig-Geo mailing list > R-sig-Geo at r-project.org >
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo > -- Rainer M. Krug
> email: Rainerkrugsde PGP: 0x0F52F982
>
> 	[[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

-- 
Rainer M. Krug
email: Rainer<at>krugs<dot>de
PGP: 0x0F52F982
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 454 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20160718/2701de12/attachment.bin>


More information about the R-sig-Geo mailing list