From Lodewijk.Bonebakker at sun.com  Wed Mar 26 00:21:24 2008
From: Lodewijk.Bonebakker at sun.com (Lodewijk Bonebakker)
Date: Tue, 25 Mar 2008 16:21:24 -0700
Subject: [Rd] Incorrect behavior in 64-bit version (PR#11034) (solved)
In-Reply-To: <47E9782B.1060608@biostat.ku.dk>
References: <20080325211506.B0292282EFF6@mail.pubhealth.ku.dk>
	<47E9782B.1060608@biostat.ku.dk>
Message-ID: <F53A7F3B-8F03-47B5-B250-C8FC55D99351@sun.com>

Peter,

thank you for your reply, the provided link had the answer:

The problem is the Sun cc compiler not following the C99 syntax  
standard. Adding -xc99 to compiler flags fixed the problem.

My incorrect assumption was that configure.in would contain most of  
the recommended flags for compilation, combined with using the same  
wrapper script for compilation that has worked successfully since  
version 1.9. Obviously it is no longer current and I have added 'make  
check' as additional safety.

Thank you again,

Lodewijk Bonebakker


For general interest (since this is going to be public anyway), here  
is my wrapper script:

#!/bin/bash
## quick-buildR,64
##
## build R, libiconv and readline should be installed in /usr/sfw/lib/ 
amd64
##
export CC="cc -xc99"
export CPP=""
export CXX=CC
export FC=f95
export F77=f95
##
export BASEFLAGS="-m64 -I/usr/sfw/include"
# export FPICFLAGS="-Bdynamic -G"
# export CXXPICFLAGS="-pic"
# export SHLIB_CXXFLAGS="-Bdynamic -G"
# export MAIN_CFLAGS="-m64 -I/usr/sfw/include"
# export SHLIB_CFLAGS="-m64"
# export MAIN_FFLAGS="-m64"
# export SHLIB_FFLAGS="-m64"
##
export CFLAGS="${BASEFLAGS} -O -xO5 -xc99 -xlibmieee -xlibmil -nofstore"
export FFLAGS="${BASEFLAGS} -O5 -libmil -nofstore"
export CXXFLAGS="${BASEFLAGS} -O -xO5 -xlibmil -nofstore"
export FCFLAGS=${FFLAGS}
export SHLIB_CXXLDFLAGS="-G -lCstd"
export SAFE_FFLAGS="-O5 -libmil -fstore"
##
export LDFLAGS="-m64 -L/usr/sfw/lib/amd64  -L/usr/sfw/lib"

##
./configure --prefix=/opt/R/v2.6.2,64 --with-blas=sunperf --with-lapack

RESULT=$?
if [ $RESULT -eq 0 ]; then
         gmake
         RESULT=$?
fi
if [ $RESULT -eq 0 ]; then
         gmake check
	RESULT=$?
fi
if [ $RESULT -eq 0 ]; then
         gmake install
         RESULT=$?
fi
echo "RESULT $RESULT"

## end of script



On Mar 25, 2008, at 15:09, Peter Dalgaard wrote:

> lodewijk.bonebakker at sun.com wrote:
>> Full_Name: Lodewijk Bonebakker
>> Version: v2.6.2
>> OS: Solaris, x86, snv_80
>> Submission from: (NULL) (192.18.43.225)
>>
>>
>> when I build R in 32-bit mode on my 64-bit OS, R works as expected:
>>
>> R version 2.6.2 (2008-02-08)
>> ...
>> Type 'q()' to quit R.
>>
>>
>>> m <- matrix(ncol=2,c(1:6))
>>>
>>> m
>>>
>>     [,1] [,2]
>> [1,]    1    4
>> [2,]    2    5
>> [3,]    3    6
>>
>>> n <- log10(m)
>>> n
>>>
>>          [,1]      [,2]
>> [1,] 0.0000000 0.6020600
>> [2,] 0.3010300 0.6989700
>> [3,] 0.4771213 0.7781513
>>
>>
>> On a 64-bit build, uisng *only* the "-m64" to instruct the sun  
>> compilers to
>> generate a 64 bit binary, the following happens (there are no  
>> compilation
>> errors)
>>
>>
>> R version 2.6.2 (2008-02-08)
>> ...
>> Type 'q()' to quit R.
>>
>>
>>> m <- matrix(ncol=2,c(1:6))
>>> m
>>>
>>     [,1] [,2]
>> [1,]    1    4
>> [2,]    2    5
>> [3,]    3    6
>>
>>> n <- log10(m)
>>>
>> Warning message:
>> In log(1:6, 10) : NaNs produced
>>
>>> n
>>>
>>            [,1] [,2]
>> [1,]   0.1428914    0
>> [2,]  -1.1834403    0
>> [3,]         NaN    0
>>
>> ______________________________________________
>> R-devel at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>
> There is not sufficient information to go on here (with a sun.com  
> address you could be expected to know better). R works fine as a 64  
> bit program on several platforms, as far as I know including  
> Solaris, so the issue has to be specific to your compiler and  
> library setup.
>
> This has all the hallmarks of a math header file error (either args  
> or return value declared of the wrong type), or a linker issue (log  
> not really log). I surely hope it fails "make check"!
>
> So, exactly what did you do, which compiler and build tools and  
> which version?
> Did you read the http://cran.r-project.org/doc/manuals/R-admin.html,  
> including Appendix C?
> (Please keep R-bugs in the recipient list. I'm not the resident  
> expert.)
>
> -- 
>  O__  ---- Peter Dalgaard             ?ster Farimagsgade 5, Entr.B
> c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
> (*) \(*) -- University of Copenhagen   Denmark      Ph:  (+45)  
> 35327918
> ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)              FAX: (+45)  
> 35327907
>
>



[Rd] Incorrect behavior in 64-bit version (PR#11034) (solved)
Lodewijk Bonebakker