[R-SIG-Mac] odd problem building gmp from source

Carl Witthoft carl at witthoft.com
Wed Jan 12 21:35:34 CET 2011


Simon,
thanks for the suggestion.  I downloaded gmp-4.3.1-darwin9-bin3.tar.gz 
from research.att.com and installed per their instructions.

R (2.12.1)  successfully built the "gmp" package from my modified code.

Two problems.  First,  every time I execute a function from gmp,  I get 
something like:

apply.bigz(mxg,2,max)
[1] "17" "18" "19" "20"
R(95552,0xa01f9720) malloc: *** error for object 0x1abf5674: Non-aligned 
pointer being freed
*** set a breakpoint in malloc_error_break to debug
R(95552,0xa01f9720) malloc: *** error for object 0x1abf5674: Non-aligned 
pointer being freed
*** set a breakpoint in malloc_error_break to debug
R(95552,0xa01f9720) malloc: *** error for object 0x1abf5674: Non-aligned 
pointer being freed
*** set a breakpoint in malloc_error_break to debug
R(95552,0xa01f9720) malloc: *** error for object 0x1abf5674: Non-aligned 
pointer being freed
*** set a breakpoint in malloc_error_break to debug

note that the returned values are correct for the "mxg" bigz matrix in 
question.

The other problem seems to be one of search order, in that, for an 
integer matrix mx,

apply(mx,2,max)   works properly.  But   apply(mxg,2,max) fails to 
"find" the bigz method and returns an error:

Rgames> apply(mxg,2,max)
Error in aperm(X, c(s.call, s.ans)) :
   invalid first argument, must be an array

which is because the character matrix 'mxg' was passed to base::apply.

Any ideas?  and thanks again.

Carl

On 1/11/11 9:01 PM, Simon Urbanek wrote:
> On Jan 11, 2011, at 6:06 PM, Carl Witthoft wrote:
>
>> Hi,
>> I chose to make a minor edit to the R-source  matrixz.R in the gmp package (not to be confused with the GNU gmp library which it calls).
>>
>> On my Intel iMac at work, running OSX 10.6.4,  it compiled just fine.
>>
>> for reference, that Mac has:
>> %gcc -version
>> i686-apple-darwin10-gcc-4.2.1: no input files
>>
>> and I honestly forget which version of gmplib I installed.
>>
>> So, I took the R-gmp source home, where I have an Intel iMac w/ 10.5.8, and I get the following foulup:
>>
>> TheiMac:~/downloads/gmpmod:cgw-507$ ./configure
>> creating cache ./config.cache
>> checking for __gmpz_ui_sub in -lgmp... no
>> configure: error: GNU MP not found, or not 4.1.4 or up, see http://swox.com.gmp
>>
>> I've tried installing both GNU gmp 4.3.2 and 5.0.1, same problem.  And the libraries are in /usr/local/lib, just as they are on my work iMac.
>>
>
> If you have doubt about your builds of gmp you can always pick the one used on CRAN if you wish at
> http://r.research.att.com/libs/
>
>
>> I thought it might be the compiler, so I checked:
>>
>> TheiMac:~/downloads/gmpmod:cgw-508$ gcc -version
>> i686-apple-darwin9-gcc-4.2.1: no input files
>>
>
> You really meant to use --version I presume:
>
> ginaz:~$ gcc --version
> i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5664)
>
> but the version usually doesn't matter - especially not on on 10.6 ;)
>
>
>> Any ideas what I've got set up wrong? Let me know what other system or app diagnostics I can supply.
>>
>
> Well, the only useful diagnostics is the config.log - it will tell you exactly what the error is ...
>
> Cheers,
> Simon
>
>
>
>> thanks
>> Carl
>>
>> (I did finagle an ugly workaround, by bringing home a copy of the installed R-gmp package.  I had to go to the Library/Frameworks/... /libs/i386 directory and swap in the original gmp.so  file (from the CRAN package) to get things mostly working))
>>
>> _______________________________________________
>> R-SIG-Mac mailing list
>> R-SIG-Mac at r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
>>
>>
>
>



More information about the R-SIG-Mac mailing list