[R-SIG-Mac] Compiling packages on Snow Leopard for 64bit

Simon Urbanek simon.urbanek at r-project.org
Sun Sep 13 19:48:28 CEST 2009


Erich,

On Sep 13, 2009, at 12:02 PM, Erich Neuwirth wrote:

> Here is is another one.
> I am trying to compile rscproxy for R64.
> So I downloaded the sources, and I tried
> sudo R --arch=x86_64 CMD INSTALL rscproxy_1.3-1.tar.gz
>
> I get things like
> gcc-4.2 -arch i386 -std=gnu99 -I/Library/Frameworks/R.framework/ 
> Resources/include -I/Library/Frameworks/R.framework/Resources/ 
> include/i386 -I../inst/include -I/usr/local/include    -fPIC  -g -O2  
> -c bdx_SEXP.c -o bdx_SEXP.o
>
> and
>
> ** arch - ppc
> gcc-4.2 -arch ppc -std=gnu99 -I/Library/Frameworks/R.framework/ 
> Resources/include -I/Library/Frameworks/R.framework/Resources/ 
> include/ppc -I../inst/include -I/usr/local/include    -fPIC  -g -O2 - 
> c bdx_SEXP.c -o bdx_SEXP.o
>
> but nothing about x86_64
>
> What am I doing wrong this time?
>

For packages that don't have configure or Makefile regular R CMD  
INSTALL will build all architectures so you don't need --arch.  
However, if you see i386 and ppc but don't see x86_64 then it looks as  
if you have 32-bit R from CRAN ... (yet if --arch x86_64 works it  
should be the 64-bit R - so I'm a bit confused). Are you sure you are  
using the correct R version? You should see:

Fino:~$ ls /Library/Frameworks/R.framework/Resources/bin/exec
i386   ppc    ppc64  x86_64

In fact on Snow Leopard you want to run
rm -rf /Library/Frameworks/R.framework/Resources/bin/exec/ppc*
because Rosetta is not installed by default and ppc64 libraries are  
missing, so on SL you should see

Fino:~$ ls /Library/Frameworks/R.framework/Resources/bin/exec
i386   x86_64

Cheers,
Simon


>
>
> On Sep 13, 2009, at 4:05 PM, Simon Urbanek wrote:
>
>> Erich,
>>
>> On Sep 13, 2009, at 4:52 AM, Erich Neuwirth wrote:
>>
>>> Thanks for the hints.
>>> It turns out that the part I originally missed was
>>>> install.packages("JGR",type="mac.binary")
>>>
>>> which I had never used before.
>>> Now, getting more adventurous, I am trying to build the gmp package
>>> in R64.
>>>
>>> > install.packages("gmp",type="mac.binary")
>>> ....
>>>
>>> > library(gmp)
>>> Error: package 'gmp' is not installed for 'arch=x86_64'
>>>
>>
>> You can use type="mac.binary" only for packages that have no native  
>> library inside (gmp does).
>>
>>
>>
>>> So I am trying to build the package
>>> I downloaded gmp from gmplig.org and it compiled and passed all  
>>> the tests.
>>> The output alsi indicated that it compiled a 64bit version.
>>> Now for the R build:
>>>
>>> Mini:devel neuwirth$ sudo R CMD INSTALL gmp_0.4-10.tar.gz
>>> * Installing to library ‘/Library/Frameworks/R.framework/Resources/ 
>>> library’
>>> * Installing *source* package ‘gmp’ ...
>>> creating cache ./config.cache
>>> checking for __gmpz_ui_sub in -lgmp... yes
>>> updating cache ./config.cache
>>> creating ./config.status
>>> creating src/Makevars
>>> ** libs
>>> ** arch - i386
>>> g++-4.2 -arch i386 -I/Library/Frameworks/R.framework/Resources/ 
>>> include -I/Library/Frameworks/R.framework/Resources/include/i386 - 
>>> I/usr/local/include/   -I/usr/local/include    -fPIC  -g -O2 -c  
>>> apply.cc -o apply.o
>>> g++-4.2 -arch i386 -I/Library/Frameworks/R.framework/Resources/ 
>>> include -I/Library/Frameworks/R.framework/Resources/include/i386 - 
>>> I/usr/local/include/   -I/usr/local/include    -fPIC  -g -O2 -c  
>>> biginteger.cc -o biginteger.o
>>> g++-4.2 -arch i386 -I/Library/Frameworks/R.framework/Resources/ 
>>> include -I/Library/Frameworks/R.framework/Resources/include/i386 - 
>>> I/usr/local/include/   -I/usr/local/include    -fPIC  -g -O2 -c  
>>> bigintegerR.cc -o bigintegerR.o
>>> g++-4.2 -arch i386 -I/Library/Frameworks/R.framework/Resources/ 
>>> include -I/Library/Frameworks/R.framework/Resources/include/i386 - 
>>> I/usr/local/include/   -I/usr/local/include    -fPIC  -g -O2 -c  
>>> bigmod.cc -o bigmod.o
>>> g++-4.2 -arch i386 -I/Library/Frameworks/R.framework/Resources/ 
>>> include -I/Library/Frameworks/R.framework/Resources/include/i386 - 
>>> I/usr/local/include/   -I/usr/local/include    -fPIC  -g -O2 -c  
>>> bigrational.cc -o bigrational.o
>>> g++-4.2 -arch i386 -I/Library/Frameworks/R.framework/Resources/ 
>>> include -I/Library/Frameworks/R.framework/Resources/include/i386 - 
>>> I/usr/local/include/   -I/usr/local/include    -fPIC  -g -O2 -c  
>>> bigrationalR.cc -o bigrationalR.o
>>> g++-4.2 -arch i386 -I/Library/Frameworks/R.framework/Resources/ 
>>> include -I/Library/Frameworks/R.framework/Resources/include/i386 - 
>>> I/usr/local/include/   -I/usr/local/include    -fPIC  -g -O2 -c  
>>> bigvec.cc -o bigvec.o
>>> g++-4.2 -arch i386 -I/Library/Frameworks/R.framework/Resources/ 
>>> include -I/Library/Frameworks/R.framework/Resources/include/i386 - 
>>> I/usr/local/include/   -I/usr/local/include    -fPIC  -g -O2 -c  
>>> bigvec_q.cc -o bigvec_q.o
>>> g++-4.2 -arch i386 -I/Library/Frameworks/R.framework/Resources/ 
>>> include -I/Library/Frameworks/R.framework/Resources/include/i386 - 
>>> I/usr/local/include/   -I/usr/local/include    -fPIC  -g -O2 -c  
>>> extract_matrix.cc -o extract_matrix.o
>>> g++-4.2 -arch i386 -I/Library/Frameworks/R.framework/Resources/ 
>>> include -I/Library/Frameworks/R.framework/Resources/include/i386 - 
>>> I/usr/local/include/   -I/usr/local/include    -fPIC  -g -O2 -c  
>>> factor.cc -o factor.o
>>> g++-4.2 -arch i386 -I/Library/Frameworks/R.framework/Resources/ 
>>> include -I/Library/Frameworks/R.framework/Resources/include/i386 - 
>>> I/usr/local/include/   -I/usr/local/include    -fPIC  -g -O2 -c  
>>> matrix.cc -o matrix.o
>>> g++-4.2 -arch i386 -I/Library/Frameworks/R.framework/Resources/ 
>>> include -I/Library/Frameworks/R.framework/Resources/include/i386 - 
>>> I/usr/local/include/   -I/usr/local/include    -fPIC  -g -O2 -c  
>>> matrixq.cc -o matrixq.o
>>> g++-4.2 -arch i386 -I/Library/Frameworks/R.framework/Resources/ 
>>> include -I/Library/Frameworks/R.framework/Resources/include/i386 - 
>>> I/usr/local/include/   -I/usr/local/include    -fPIC  -g -O2 -c  
>>> solve.cc -o solve.o
>>> g++-4.2 -arch i386 -dynamiclib -Wl,-headerpad_max_install_names - 
>>> undefined dynamic_lookup -single_module -multiply_defined suppress  
>>> -L/usr/local/lib -o gmp.so apply.o biginteger.o bigintegerR.o  
>>> bigmod.o bigrational.o bigrationalR.o bigvec.o bigvec_q.o  
>>> extract_matrix.o factor.o matrix.o matrixq.o solve.o -L/usr/local/ 
>>> lib/ -lgmp -F/Library/Frameworks/R.framework/.. -framework R -Wl,- 
>>> framework -Wl,CoreFoundation
>>> ld: warning: in /usr/local/lib/libgmp.dylib, file is not of  
>>> required architecture
>>> ** R
>>> ** data
>>> ** inst
>>> ** preparing package for lazy loading
>>> ** help
>>> *** installing help indices
>>> >>> Building/Updating help pages for package 'gmp'
>>>   Formats: text html latex example
>>> Oakley                            text    html    latex   example
>>> add.biginteger                    text    html    latex   example
>>> apply                             text    html    latex   example
>>> biginteger                        text    html    latex   example
>>> biginteger.rand                   text    html    latex   example
>>> bigrational                       text    html    latex   example
>>> comp.biginteger                   text    html    latex   example
>>> comp.bigq                         text    html    latex   example
>>> cumsum                            text    html    latex   example
>>> extract                           text    html    latex   example
>>> extract.bigq                      text    html    latex   example
>>> extreme                           text    html    latex   example
>>> factor                            text    html    latex   example
>>> fibonacci                         text    html    latex   example
>>> gcd                               text    html    latex   example
>>> gcdex                             text    html    latex   example
>>> isprime                           text    html    latex   example
>>> Note: removing empty section \examples in file 'matrix.Rd'
>>> matrix                            text    html    latex
>>> modulus                           text    html    latex   example
>>> nextprime                         text    html    latex   example
>>> operators_bigq                    text    html    latex   example
>>> powm                              text    html    latex   example
>>> sizeinbase                        text    html    latex   example
>>> solve                             text    html    latex   example
>>> ** building package indices ...
>>> Error in dyn.load(file, DLLpath = DLLpath, ...) :
>>> unable to load shared library '/Library/Frameworks/R.framework/ 
>>> Resources/library/gmp/libs/i386/gmp.so':
>>> dlopen(/Library/Frameworks/R.framework/Resources/library/gmp/libs/ 
>>> i386/gmp.so, 6): Symbol not found: ___gmpq_add
>>> Referenced from: /Library/Frameworks/R.framework/Resources/library/ 
>>> gmp/libs/i386/gmp.so
>>> Expected in: flat namespace
>>> in /Library/Frameworks/R.framework/Resources/library/gmp/libs/i386/ 
>>> gmp.so
>>> Warning in eval(expr, envir, enclos) :
>>> Data for RFC 2409 Oakley groups requires package 'gmp'
>>> Error in dyn.load(file, DLLpath = DLLpath, ...) :
>>> unable to load shared library '/Library/Frameworks/R.framework/ 
>>> Resources/library/gmp/libs/i386/gmp.so':
>>> dlopen(/Library/Frameworks/R.framework/Resources/library/gmp/libs/ 
>>> i386/gmp.so, 6): Symbol not found: ___gmpq_add
>>> Referenced from: /Library/Frameworks/R.framework/Resources/library/ 
>>> gmp/libs/i386/gmp.so
>>> Expected in: flat namespace
>>> in /Library/Frameworks/R.framework/Resources/library/gmp/libs/i386/ 
>>> gmp.so
>>> Warning in eval(expr, envir, enclos) :
>>> Data for RFC 2409 Oakley groups requires package 'gmp'
>>> * DONE (gmp)
>>> Mini:devel neuwirth$
>>>
>>>
>>>
>>> trying to do 'library(gmp)' in R64 then produces
>>> > library(gmp)
>>> Error: package 'gmp' is not installed for 'arch=x86_64'
>>> again, therefore I tried
>>>
>>> Mini:devel neuwirth$ R_ARCH=x86_64 sudo R CMD INSTALL --libs-only  
>>> gmp_0.4-10.tar.gz
>>
>> It is either R_ARCH=/x86_64 ... (note the slash!) or R --arch=x86_64
>>
>>
>>> and this produced the following output
>>>
>>> * Installing to library ‘/Library/Frameworks/R.framework/Resources/ 
>>> library’
>>> * Installing *source* package ‘gmp’ ...
>>> creating cache ./config.cache
>>> checking for __gmpz_ui_sub in -lgmp... yes
>>> updating cache ./config.cache
>>> creating ./config.status
>>> creating src/Makevars
>>> ** libs
>>> ** arch - i386
>>
>> ^--- it's still building 32-bit as you can see here
>>
>>> g++-4.2 -arch i386 -I/Library/Frameworks/R.framework/Resources/ 
>>> include -I/Library/Frameworks/R.framework/Resources/include/i386 - 
>>> I/usr/local/include/   -I/usr/local/include    -fPIC  -g -O2 -c  
>>> apply.cc -o apply.o
>>> g++-4.2 -arch i386 -I/Library/Frameworks/R.framework/Resources/ 
>>> include -I/Library/Frameworks/R.framework/Resources/include/i386 - 
>>> I/usr/local/include/   -I/usr/local/include    -fPIC  -g -O2 -c  
>>> biginteger.cc -o biginteger.o
>>> g++-4.2 -arch i386 -I/Library/Frameworks/R.framework/Resources/ 
>>> include -I/Library/Frameworks/R.framework/Resources/include/i386 - 
>>> I/usr/local/include/   -I/usr/local/include    -fPIC  -g -O2 -c  
>>> bigintegerR.cc -o bigintegerR.o
>>> g++-4.2 -arch i386 -I/Library/Frameworks/R.framework/Resources/ 
>>> include -I/Library/Frameworks/R.framework/Resources/include/i386 - 
>>> I/usr/local/include/   -I/usr/local/include    -fPIC  -g -O2 -c  
>>> bigmod.cc -o bigmod.o
>>> g++-4.2 -arch i386 -I/Library/Frameworks/R.framework/Resources/ 
>>> include -I/Library/Frameworks/R.framework/Resources/include/i386 - 
>>> I/usr/local/include/   -I/usr/local/include    -fPIC  -g -O2 -c  
>>> bigrational.cc -o bigrational.o
>>> g++-4.2 -arch i386 -I/Library/Frameworks/R.framework/Resources/ 
>>> include -I/Library/Frameworks/R.framework/Resources/include/i386 - 
>>> I/usr/local/include/   -I/usr/local/include    -fPIC  -g -O2 -c  
>>> bigrationalR.cc -o bigrationalR.o
>>> g++-4.2 -arch i386 -I/Library/Frameworks/R.framework/Resources/ 
>>> include -I/Library/Frameworks/R.framework/Resources/include/i386 - 
>>> I/usr/local/include/   -I/usr/local/include    -fPIC  -g -O2 -c  
>>> bigvec.cc -o bigvec.o
>>> g++-4.2 -arch i386 -I/Library/Frameworks/R.framework/Resources/ 
>>> include -I/Library/Frameworks/R.framework/Resources/include/i386 - 
>>> I/usr/local/include/   -I/usr/local/include    -fPIC  -g -O2 -c  
>>> bigvec_q.cc -o bigvec_q.o
>>> g++-4.2 -arch i386 -I/Library/Frameworks/R.framework/Resources/ 
>>> include -I/Library/Frameworks/R.framework/Resources/include/i386 - 
>>> I/usr/local/include/   -I/usr/local/include    -fPIC  -g -O2 -c  
>>> extract_matrix.cc -o extract_matrix.o
>>> g++-4.2 -arch i386 -I/Library/Frameworks/R.framework/Resources/ 
>>> include -I/Library/Frameworks/R.framework/Resources/include/i386 - 
>>> I/usr/local/include/   -I/usr/local/include    -fPIC  -g -O2 -c  
>>> factor.cc -o factor.o
>>> g++-4.2 -arch i386 -I/Library/Frameworks/R.framework/Resources/ 
>>> include -I/Library/Frameworks/R.framework/Resources/include/i386 - 
>>> I/usr/local/include/   -I/usr/local/include    -fPIC  -g -O2 -c  
>>> matrix.cc -o matrix.o
>>> g++-4.2 -arch i386 -I/Library/Frameworks/R.framework/Resources/ 
>>> include -I/Library/Frameworks/R.framework/Resources/include/i386 - 
>>> I/usr/local/include/   -I/usr/local/include    -fPIC  -g -O2 -c  
>>> matrixq.cc -o matrixq.o
>>> g++-4.2 -arch i386 -I/Library/Frameworks/R.framework/Resources/ 
>>> include -I/Library/Frameworks/R.framework/Resources/include/i386 - 
>>> I/usr/local/include/   -I/usr/local/include    -fPIC  -g -O2 -c  
>>> solve.cc -o solve.o
>>> g++-4.2 -arch i386 -dynamiclib -Wl,-headerpad_max_install_names - 
>>> undefined dynamic_lookup -single_module -multiply_defined suppress  
>>> -L/usr/local/lib -o gmp.so apply.o biginteger.o bigintegerR.o  
>>> bigmod.o bigrational.o bigrationalR.o bigvec.o bigvec_q.o  
>>> extract_matrix.o factor.o matrix.o matrixq.o solve.o -L/usr/local/ 
>>> lib/ -lgmp -F/Library/Frameworks/R.framework/.. -framework R -Wl,- 
>>> framework -Wl,CoreFoundation
>>> ld: warning: in /usr/local/lib/libgmp.dylib, file is not of  
>>> required architecture
>>
>> Since you apparently have only 64-bit libgmp, don't use --libs-only  
>> since the 32-bit version of the package fails anyway.
>>
>> Cheers,
>> Simon
>>
>>
>>> * DONE (gmp)
>>> Mini:devel neuwirth$
>>>
>>>
>>> What am I doing wrong here. My guess is that I am still getting  
>>> some switches wrong.
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> On Sep 13, 2009, at 1:59 AM, Simon Urbanek wrote:
>>>
>>>> To answer all those recent posts on both mailing lists regarding  
>>>> JGR on OS X 10.6 (Snow Leopard):
>>>> 2) install necessary packages as follows:
>>>> install.packages(c("rJava","JavaGD","iplots"))
>>>> install.packages("JGR",type="mac.binary")
>>>
>>>
>>
>>
>
>



More information about the R-SIG-Mac mailing list