Skip to content

[Rcpp-devel] Mac problem (possibly not Rcpp's fault)

13 messages · Jay Emerson, Romain Francois, Simon Urbanek +1 more

#
I've Rcpp-ified the new package bcp (Bayesian change point analysis)
and it seems to work on Linux and Windows.  We're having some Mac
problems (and I don't have a Mac).  I have one current and one past
student, both getting similar problems in different ways.  For one,
she started with (I think) Rcpp installing properly, but the RESULT 1
bus error when trying to build bcp.  I recommended she rebuild R from
scratch using updated everyting; after doing so, she got a similar bus
error RESULT 2, this time in the process of trying to install Rcpp.
The other student has the same bus error.

I've exhausted my guesses and recommendations.  I note the same bus
error appears in some RcppModel logs, at

https://r-forge.r-project.org/R/?group_id=155&log=build_mac&pkg=RcppModels&flavor=patched

?? Any advice ??

Jay


RESULT 1:
xiao-yangs-macbook:Week10 Grace$ R CMD INSTALL bcp
* installing to library '/Library/Frameworks/R.framework/Resources/library'
* installing *source* package 'bcp' ...
** libs
make: *** No rule to make target `Cbcp.o', needed by `bcp.so'.  Stop.
*** arch - i386
g++ -arch i386 -I/Library/Frameworks/R.framework/Resources/include
-I/Library/Frameworks/R.framework/Resources/include/i386
-I/usr/local/include
-I"/Library/Frameworks/R.framework/Resources/library/Rcpp/include"
-fPIC  -g -O2 -c Cbcp.cpp -o Cbcp.o
/Library/Frameworks/R.framework/Resources/library/Rcpp/include/Rcpp/internal/export.h:
In function 'void Rcpp::internal::export_range__dispatch(SEXPREC*,
InputIterator, Rcpp::traits::r_type_primitive_tag)':
/Library/Frameworks/R.framework/Resources/library/Rcpp/include/Rcpp/internal/export.h:56:
internal compiler error: Bus error

Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://developer.apple.com/bugreporter> for instructions.
make: *** [Cbcp.o] Error 1
ERROR: compilation failed for package 'bcp'
* removing '/Library/Frameworks/R.framework/Resources/library/bcp'


RESULT 2:
I downloaded Xcode 3.1.3 from the web and restarted the computer and
compiled R again. But Rcpp still cannot be installed; the error
message is the same:
--- Please select a CRAN mirror for use in this session ---
Loading Tcl/Tk interface ... done
trying URL 'http://cran.stat.ucla.edu/src/contrib/Rcpp_0.9.2.tar.gz'
Content type 'application/x-tar' length 1921635 bytes (1.8 Mb)

opened URL
==================================================
downloaded 1.8 Mb

* installing *source* package 'Rcpp' ...
** libs
g++ -I/Users/Grace/Study/Statistics/2011Spring/STAT662/Week10/R-2.12.2/include
-I../inst/include/ -I/usr/local/include    -fPIC  -g -O2 -c Date.cpp
-o Date.o
../inst/include/Rcpp/internal/export.h: In function 'void
Rcpp::internal::export_range__dispatch(SEXPREC*, InputIterator,
Rcpp::traits::r_type_primitive_tag)':
../inst/include/Rcpp/internal/export.h:56: internal compiler error: Bus error
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://developer.apple.com/bugreporter> for instructions.
make: *** [Date.o] Error 1
ERROR: compilation failed for package 'Rcpp'
* removing '/Users/Grace/Study/Statistics/2011Spring/STAT662/Week10/R-2.12.2/library/Rcpp'

The downloaded packages are in
       '/private/var/folders/rB/rByzYYffEzadShxSslfirU+++TI/-Tmp-/RtmpNVHfDM/downloaded_packages'

Updating HTML index of packages in '.Library'
Warning message:
In install.packages("Rcpp") :
 installation of package 'Rcpp' had non-zero exit status
#
Hello,

Which OS and compiler version is this ?

With :

romain at naxos ~/svn/rcpp/pkg $ uname -a
Darwin naxos 10.7.0 Darwin Kernel Version 10.7.0: Sat Jan 29 15:17:16 
PST 2011; root:xnu-1504.9.37~1/RELEASE_I386 i386
romain at naxos ~/svn/rcpp/pkg $ g++ --version
i686-apple-darwin10-g++-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


Things work fine for me.


These messages usually appear when someone tries to compile Rcpp with an 
older version of gcc (4.0.0 IIRC).

Romain

Le 05/04/11 17:59, Jay Emerson a ?crit :

  
    
#
Hi Jay,

Thanks for posting here!
On 5 April 2011 at 11:59, Jay Emerson wrote:
| I've Rcpp-ified the new package bcp (Bayesian change point analysis)
| and it seems to work on Linux and Windows.  We're having some Mac
| problems (and I don't have a Mac).  I have one current and one past
| student, both getting similar problems in different ways.  For one,
| she started with (I think) Rcpp installing properly, but the RESULT 1
| bus error when trying to build bcp.  I recommended she rebuild R from
| scratch using updated everyting; after doing so, she got a similar bus
| error RESULT 2, this time in the process of trying to install Rcpp.
| The other student has the same bus error.
| 
| I've exhausted my guesses and recommendations.  I note the same bus
| error appears in some RcppModel logs, at
| 
| https://r-forge.r-project.org/R/?group_id=155&log=build_mac&pkg=RcppModels&flavor=patched
| 
| ?? Any advice ??

Hm, it so happens that Romain committed something today (r2950) which seems
to be around the same or similar spot -- I have not been hit by anything like
it.  OS X uses g++ 4.2.1 which is starting to pose challenges as we are being
pushed at the same time to use g++ 4.5 and even 4.6 (now in Debian unstable
and already used by Kurt on CRAN tests).

We sort-of have 0.9.3 pre-releases; we are being hang-up by a modules issue
right now we are debugging. Rcpp 0.9.3 may help you -- can you and your
students try the version from my site at
    
   http://dirk.eddelbuettel.com/code/rcpp/Rcpp_0.9.3.tar.gz 

I just put a new tarball there that corresponds to r2956 which is very
current.  Passes R CMD check here... but it not 'officially released' so it
bites your cat and sets your car on fire none of that is our business :)

Romain may have more pertinent help for the OS X issues.

Dirk
 
| Jay
| 
| 
| RESULT 1:
| xiao-yangs-macbook:Week10 Grace$ R CMD INSTALL bcp
| * installing to library '/Library/Frameworks/R.framework/Resources/library'
| * installing *source* package 'bcp' ...
| ** libs
| make: *** No rule to make target `Cbcp.o', needed by `bcp.so'.  Stop.
| *** arch - i386
| g++ -arch i386 -I/Library/Frameworks/R.framework/Resources/include
| -I/Library/Frameworks/R.framework/Resources/include/i386
| -I/usr/local/include
| -I"/Library/Frameworks/R.framework/Resources/library/Rcpp/include"
| -fPIC  -g -O2 -c Cbcp.cpp -o Cbcp.o
| /Library/Frameworks/R.framework/Resources/library/Rcpp/include/Rcpp/internal/export.h:
| In function 'void Rcpp::internal::export_range__dispatch(SEXPREC*,
| InputIterator, Rcpp::traits::r_type_primitive_tag)':
| /Library/Frameworks/R.framework/Resources/library/Rcpp/include/Rcpp/internal/export.h:56:
| internal compiler error: Bus error
| 
| Please submit a full bug report,
| with preprocessed source if appropriate.
| See <URL:http://developer.apple.com/bugreporter> for instructions.
| make: *** [Cbcp.o] Error 1
| ERROR: compilation failed for package 'bcp'
| * removing '/Library/Frameworks/R.framework/Resources/library/bcp'
| 
| 
| RESULT 2:
| I downloaded Xcode 3.1.3 from the web and restarted the computer and
| compiled R again. But Rcpp still cannot be installed; the error
| message is the same:
| 
| > install.packages("Rcpp")
| --- Please select a CRAN mirror for use in this session ---
| Loading Tcl/Tk interface ... done
| trying URL 'http://cran.stat.ucla.edu/src/contrib/Rcpp_0.9.2.tar.gz'
| Content type 'application/x-tar' length 1921635 bytes (1.8 Mb)
| 
| opened URL
| ==================================================
| downloaded 1.8 Mb
| 
| * installing *source* package 'Rcpp' ...
| ** libs
| g++ -I/Users/Grace/Study/Statistics/2011Spring/STAT662/Week10/R-2.12.2/include
| -I../inst/include/ -I/usr/local/include    -fPIC  -g -O2 -c Date.cpp
| -o Date.o
| ../inst/include/Rcpp/internal/export.h: In function 'void
| Rcpp::internal::export_range__dispatch(SEXPREC*, InputIterator,
| Rcpp::traits::r_type_primitive_tag)':
| ../inst/include/Rcpp/internal/export.h:56: internal compiler error: Bus error
| Please submit a full bug report,
| with preprocessed source if appropriate.
| See <URL:http://developer.apple.com/bugreporter> for instructions.
| make: *** [Date.o] Error 1
| ERROR: compilation failed for package 'Rcpp'
| * removing '/Users/Grace/Study/Statistics/2011Spring/STAT662/Week10/R-2.12.2/library/Rcpp'
| 
| The downloaded packages are in
|        '/private/var/folders/rB/rByzYYffEzadShxSslfirU+++TI/-Tmp-/RtmpNVHfDM/downloaded_packages'
| 
| Updating HTML index of packages in '.Library'
| Warning message:
| In install.packages("Rcpp") :
|  installation of package 'Rcpp' had non-zero exit status
| 
| 
| 
| 
| -- 
| John W. Emerson (Jay)
| Associate Professor of Statistics
| Department of Statistics
| Yale University
| http://www.stat.yale.edu/~jay
| _______________________________________________
| Rcpp-devel mailing list
| Rcpp-devel at lists.r-forge.r-project.org
| https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
#
I'm making a guess that the R-Forge setup is having the same problems
as we are, though -- more than just RcppModels show that same bus
error.  Executive summary: I now have a local success, with his
information given below, as well as information on one of the
failures; it does indeed appear to be a compiler version issue, as
Romain suspected.  I'll badger the students again to make sure they
are up to date.

Thanks!

The success setup:

R version 2.12.2 (2011-02-25)
Copyright (C) 2011 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)

$ g++ --version
i686-apple-darwin10-g++-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5664)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ uname -a
Darwin Taylors-MacBook-Pro.local 10.6.0 Darwin Kernel Version 10.6.0:
Wed Nov 10 18:13:17 PST 2010; root:xnu-1504.9.26~3/RELEASE_I386 i386

-------------------------------------
My other student (who couldn't succeed) has an older version it
appears.  She seems to think she installed the newest version of
everything, up apparently not.

dhcp128036180037:R-2.12.2 Grace$ g++ --version
i686-apple-darwin9-g++-4.0.1 (GCC) 4.0.1 (Apple Inc. build 5493)
Copyright (C) 2005 Free Software Foundation, Inc.

dhcp128036180037:Week10 Grace$ uname -a
Darwin dhcp128036046230.central.yale.edu 9.8.0 Darwin Kernel Version
9.8.0: Wed Jul 15 16:55:01 PDT 2009; root:xnu-1228.15.4~1/RELEASE_I386
i386
On Tue, Apr 5, 2011 at 12:14 PM, Dirk Eddelbuettel <edd at debian.org> wrote:

  
    
#
Le 05/04/11 18:58, Jay Emerson a ?crit :
This is it I guess. IIRC R is only currently supported for versions 
greater than leopard (10.5).

(adding simon to the cc, he probably knows better than my vague memory)

  
    
#
On Apr 5, 2011, at 1:09 PM, Romain Francois wrote:

            
Nope - we do support 10.5 (Leopard) of course. The difference above is that the latter student has probably an ancient Xcode installed (2.x) whereas we recommend Xcode 3.x (and require it for compatibility with CRAN binaries). It is available from ADC free of charge (the latest version for Leopard is Xcode 3.1.4)

Cheers,
Simon
#
On 5 April 2011 at 14:00, Simon Urbanek wrote:
| Nope - we do support 10.5 (Leopard) of course. The difference above is that the latter student has probably an ancient Xcode installed (2.x) whereas we recommend Xcode 3.x (and require it for compatibility with CRAN binaries). It is available from ADC free of charge (the latest version for Leopard is Xcode 3.1.4)

Very, very good -- thank you! 

I took this opportunity to add this to the Rcpp-FAQ as the following.
Corrections or suggestions welcome.  We did just wrap up 0.9.3 which should
hit CRAN either today or tomorrow so this won't be in it yet.

Dirk


\subsection{I am having problems building Rcpp on OS X, any help ?}

OS X is a little more conservative with compiler versions, so it pays to get
the latest of whatever Apple releases which may already be a little behind
what is used on Linux or Windows.

At the time of writing this paragraph (in the spring of 2011), \pkg{Rcpp}
(just like CRAN) supports all OS X releases greater or equal to 10.5.
However, building \pkg{Rcpp} from source (or building packages using
\pkg{Rcpp}) also requires a recent-enough version of Xcode; the current
version is 3.1.4 which can be downloaded free of charge from the Apple
Developer site.
#
On Apr 5, 2011, at 2:31 PM, Dirk Eddelbuettel wrote:

            
Two minor comments: 

a) Xcode 3.1.x is for Leopard only, Snow Leopard comes with Xcode 3.2.x (but there any version will work since there is nothing older than 3.2.0 for SL).

b) I'm not 100% sure whether gcc 4.2 is the default in Xcode 3.1.4 -- I think and hope it is, but there is a very small probability that it may not be (mine is already set to gcc 4.2 and I don't have a "clean" machine to test it).

Cheers,
Simon
#
Is there some possibility 4.2 might be included in addition to 4.0,
but that 4.0 could be the default behavior?  This might be consistent
with the following email from my student (though it's also possible
that she did some installation improperly).  I'm starting to think I
ought to have a Mac in my office to play around with.  !-)

---------------------

It seems i have g++4.2 on my mac.

dhcp128036180037:R-2.12.2 Grace$ /Developer/usr/bin/g++-4.2
i686-apple-darwin9-g++-4.2.1: no input files

But, still, seems does not call by g++ --version.

dhcp128036180037:R-2.12.2 Grace$ g++ --version
i686-apple-darwin9-g++-4.0.1 (GCC) 4.0.1 (Apple Inc. build 5493)
Copyright (C) 2005 Free Software Foundation, Inc.

This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

I double checked I indeed have "Xcode 3.1.3", unless it's a fake name
or I did not install correctly. I installed the XcodeTools package and
later the gcc4.2 package.
#
On Apr 5, 2011, at 3:24 PM, Jay Emerson wrote:

            
Xcode 3.1.x has definitely both. Unless they messed around with the installation, g++-4.2 will always call gcc 4.2 and g++-4.0 will call gcc 4.0. The only question is which is default and you can change the default (e.g. via gcc_select or directly with the symlinks). What I don't remember is what is the default in which version - and I think it may also depend on whether you upgraded or not - but I just don't remember it's been too long ;).

Cheers,
Simon
#
On 5 April 2011 at 15:14, Simon Urbanek wrote:
| Two minor comments: 
| 
| a) Xcode 3.1.x is for Leopard only, Snow Leopard comes with Xcode 3.2.x (but there any version will work since there is nothing older than 3.2.0 for SL).
| 
| b) I'm not 100% sure whether gcc 4.2 is the default in Xcode 3.1.4 -- I think and hope it is, but there is a very small probability that it may not be (mine is already set to gcc 4.2 and I don't have a "clean" machine to test it).

Thanks again. New versions tries to reflect this:


\subsection{I am having problems building Rcpp on OS X, any help ?}

OS X is a little more conservative with compiler versions, so it pays to get
the latest of whatever Apple releases which may already be a little behind
what is used on Linux or Windows.

At the time of writing this paragraph (in the spring of 2011), \pkg{Rcpp}
(just like CRAN) supports all OS X releases greater or equal to 10.5.
However, building \pkg{Rcpp} from source (or building packages using
\pkg{Rcpp}) also requires a recent-enough version of Xcode. For the
\textsl{Leopard} release of OS X, the current version is 3.1.4 which can be
downloaded free of charge from the Apple Developer site. The \textsl{Snow
  Leopard} release already comes with Xcode 3.2.x.




Dirk
#
Success!  This student had Xcode 3.1.3, and the default behavior seems
to be g++-4.0; after fixing up the symbolic link in /usr/bin to point
g++ to g++-4.2, everything started working.  Hope this helps
someone...

Jay
On Tue, Apr 5, 2011 at 3:49 PM, Dirk Eddelbuettel <edd at debian.org> wrote:

  
    
#
On 5 April 2011 at 16:38, Jay Emerson wrote:
| Success!  This student had Xcode 3.1.3, and the default behavior seems
| to be g++-4.0; after fixing up the symbolic link in /usr/bin to point
| g++ to g++-4.2, everything started working.  Hope this helps
| someone...

Ack -- I've added that too, so now we have


\subsection{I am having problems building Rcpp on OS X, any help ?}

OS X is a little more conservative with compiler versions, so it pays to get
the latest of whatever Apple releases which may already be a little behind
what is used on Linux or Windows.

At the time of writing this paragraph (in the spring of 2011), \pkg{Rcpp}
(just like CRAN) supports all OS X releases greater or equal to 10.5.
However, building \pkg{Rcpp} from source (or building packages using
\pkg{Rcpp}) also requires a recent-enough version of Xcode. For the
\textsl{Leopard} release of OS X, the current version is 3.1.4 which can be
downloaded free of charge from the Apple Developer site. Users may have to
manually select \code{g++-4.2} via the symbolic link \code{/usr/bin/g++}.
The \textsl{Snow Leopard} release already comes with Xcode 3.2.x and work as
is.


Thanks,  Dirk