[GRASS-user] [off-topic] Problem in compile rgdal on Lion

Hi,

I can’t install rgdal library on Lion, tried this:


R CMD INSTALL --configure-args='--with-gdal-config=/Library/Frameworks/GDAL.framework/unix/bin/gdal-config --with-proj-include=/Library/Frameworks/PROJ.framework/unix/include --with-proj-lib=/Library/Frameworks/PROJ.framework/unix/lib' /Users/marcello/Downloads/rgdal_0.7-20.tar.gz 

* installing to library ‘/usr/local/Cellar/r/2.15.2/R.framework/Versions/2.15/Resources/library’

* installing *source* package ‘rgdal’ ...

** package ‘rgdal’ successfully unpacked and MD5 sums checked

configure: gdal-config: /Library/Frameworks/GDAL.framework/unix/bin/gdal-config

checking gdal-config usability... yes
configure: GDAL: 1.9.1

checking GDAL version > 1.5.4... yes

checking for gcc... cc
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 cc accepts -g... yes

checking for cc option to accept ISO C89... none needed

checking how to run the C preprocessor... cc -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... no

checking gdal: linking with --libs and --dep-libs... no

clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated

gdal_test.c:5:1: error: C++ requires a type specifier for all declarations

main() {
^~~~

1 error generated.
clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated

gdal_test.c:5:1: error: C++ requires a type specifier for all declarations

main() {

^~~~
1 error generated.

configure: Install failure: compilation and/or linkage problems.

configure: error: GDALAllRegister not found in libgdal.

ERROR: configuration failed for package ‘rgdal’

* removing ‘/usr/local/Cellar/r/2.15.2/R.framework/Versions/2.15/Resources/library/rgdal’

Any Ideas?

Thanks in advance.


Marcello Benigno B. de Barros Filho
Prof. do Curso Superior de Tecnologia em Geoprocessamento - IFPB
Mestre em Ciências Geodésicas e Tecnologias da Geoinformação - UFPE
Doutorando em Tecnologia Ambiental e Recursos Hídricos - UFPE
http://profmarcello.blogspot.com
http://about.me/marcello.benigno

Yes, not quite the right list, but I think you're out of luck anyways. R defines the compile flags and other details to use, and it's hard to override them. I gave up and used an old Mac with Snow Leopard to compile.

The problem is that Lion Xcode does not include GCC any more. clang is the main compiler, and R doesn't like it. There is a llvm-gcc that emulates the behavior of gcc, but R finds cc which is a symlink to clang (but configure scripts still identify it as gcc).

I have rgdal on my framework download page, but it's a little old. I tend to forget about it, but I can update my rgdal if you can wait a bit. (hmm, maybe my rgdal doesn't work with your custom R?)

If you really need to compile your own rgdal, one thing I haven't tried is creating a symlink to llvm-gcc and putting it in your PATH. I would NOT put it in /usr/local/bin, because that could interfere with software that does work with clang from the cc symlink. Maybe something like:

mkdir ~/binllvm
ln -s /usr/bin/llvm-gcc ~/binllvm/cc
ln -s /usr/bin/llvm-g++ ~/binllvm/c++
export PATH="~/binllvm:$PATH"

then compile/install rgdal in the same terminal window you ran the export.

On Oct 31, 2012, at 6:41 PM, Marcello Benigno wrote:

Hi,

I can't install rgdal library on Lion, tried this:

R CMD INSTALL --configure-args='--with-gdal-config=/Library/Frameworks/GDAL.framework/unix/bin/gdal-config --with-proj-include=/Library/Frameworks/PROJ.framework/unix/include --with-proj-lib=/Library/Frameworks/PROJ.framework/unix/lib' /Users/marcello/Downloads/rgdal_0.7-20.tar.gz

* installing to library ‘/usr/local/Cellar/r/2.15.2/R.framework/Versions/2.15/Resources/library’

* installing *source* package ‘rgdal’ ...

** package ‘rgdal’ successfully unpacked and MD5 sums checked

configure: gdal-config: /Library/Frameworks/GDAL.framework/unix/bin/gdal-config

checking gdal-config usability... yes

configure: GDAL: 1.9.1

checking GDAL version > 1.5.4... yes

checking for gcc... cc

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 cc accepts -g... yes

checking for cc option to accept ISO C89... none needed

checking how to run the C preprocessor... cc -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... no

checking gdal: linking with --libs and --dep-libs... no

clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated

gdal_test.c:5:1: error: C++ requires a type specifier for all declarations

main() {

^~~~

1 error generated.

clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated

gdal_test.c:5:1: error: C++ requires a type specifier for all declarations

main() {

^~~~

1 error generated.

configure: Install failure: compilation and/or linkage problems.

configure: error: GDALAllRegister not found in libgdal.

ERROR: configuration failed for package ‘rgdal’

* removing ‘/usr/local/Cellar/r/2.15.2/R.framework/Versions/2.15/Resources/library/rgdal’

Any Ideas?

Thanks in advance.
--
Marcello Benigno B. de Barros Filho
Prof. do Curso Superior de Tecnologia em Geoprocessamento - IFPB
Mestre em Ciências Geodésicas e Tecnologias da Geoinformação - UFPE
Doutorando em Tecnologia Ambiental e Recursos Hídricos - UFPE
http://profmarcello.blogspot.com
http://about.me/marcello.benigno

_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

-----
William Kyngesburye <kyngchaos*at*kyngchaos*dot*com>
http://www.kyngchaos.com/

"History is an illusion caused by the passage of time, and time is an illusion caused by the passage of history."

- Hitchhiker's Guide to the Galaxy

Thanks William, you hit bull’s eye!

Still only worked doing some adjustments. It worked this way:

1 - create a symlink to llvm-gcc and put it in the PATH

mkdir ~ / binllvm
ln-s / usr / bin / llvm-gcc ~ / binllvm / cc
ln-s / usr / bin / llvm-g + + ~ / binllvm / c + +
export PATH = “~ / binllvm: $ PATH”

2 - As superuser (root) In R session, build packages from source code:

install.packages (“rgdal”, type = “source”, dependencies = TRUE)

install.packages (“spgrass6”, type = “source”, dependencies = TRUE)

3 - Start GRASS, then launch R and load the libraries:

library (rgdal)
library (spgrass6)

Many thanks for your help :slight_smile:


Marcello Benigno B. de Barros Filho
Prof. do Curso Superior de Tecnologia em Geoprocessamento - IFPB
Mestre em Ciências Geodésicas e Tecnologias da Geoinformação - UFPE
Doutorando em Tecnologia Ambiental e Recursos Hídricos - UFPE
http://profmarcello.blogspot.com
http://about.me/marcello.benigno