Skip to content

[Rcpp-devel] Can not install Rcpp on Mac OS X 10.9.5

11 messages · Peng Yu, Steve Lianoglou, Kevin Ushey +1 more

#
Hi,

I having been trying to install Rcpp on Mac OS X 10.9.5 from
source. But I got the following error. Do you know how to fix this
problem?


  There is a binary version available but the source version is later:
     binary source needs_compilation
Rcpp 0.11.5 0.11.6              TRUE

installing the source package ?Rcpp?

trying URL 'http://cran.r-project.org/src/contrib/Rcpp_0.11.6.tar.gz'
Content type 'application/x-gzip' length 2352221 bytes (2.2 MB)
==================================================
downloaded 2.2 MB

* installing *source* package ?Rcpp? ...
** package ?Rcpp? successfully unpacked and MD5 sums checked
** libs
g++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG
-I../inst/include/ -I/usr/local/include -I/usr/local/include/freetype2
-I/opt/X11/include    -fPIC  -Wall -mtune=core2 -g -O2  -c Date.cpp -o
Date.o
g++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG
-I../inst/include/ -I/usr/local/include -I/usr/local/include/freetype2
-I/opt/X11/include    -fPIC  -Wall -mtune=core2 -g -O2  -c Module.cpp
-o Module.o
g++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG
-I../inst/include/ -I/usr/local/include -I/usr/local/include/freetype2
-I/opt/X11/include    -fPIC  -Wall -mtune=core2 -g -O2  -c
Rcpp_init.cpp -o Rcpp_init.o
g++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG
-I../inst/include/ -I/usr/local/include -I/usr/local/include/freetype2
-I/opt/X11/include    -fPIC  -Wall -mtune=core2 -g -O2  -c api.cpp -o
api.o
g++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG
-I../inst/include/ -I/usr/local/include -I/usr/local/include/freetype2
-I/opt/X11/include    -fPIC  -Wall -mtune=core2 -g -O2  -c
attributes.cpp -o attributes.o
g++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG
-I../inst/include/ -I/usr/local/include -I/usr/local/include/freetype2
-I/opt/X11/include    -fPIC  -Wall -mtune=core2 -g -O2  -c barrier.cpp
-o barrier.o
g++ -dynamiclib -Wl,-headerpad_max_install_names -undefined
dynamic_lookup -single_module -multiply_defined suppress
-L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o
Rcpp.so Date.o Module.o Rcpp_init.o api.o attributes.o barrier.o
-F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework
-Wl,CoreFoundation
installing to /Users/py/Library/R/3.2/library/Rcpp/libs
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
Error in dyn.load(file, DLLpath = DLLpath, ...) :
  unable to load shared object
'/Users/py/Library/R/3.2/library/Rcpp/libs/Rcpp.so':
  dlopen(/Users/py/Library/R/3.2/library/Rcpp/libs/Rcpp.so, 6): Symbol
not found: __ZNSoD0Ev
  Referenced from: /Users/py/Library/R/3.2/library/Rcpp/libs/Rcpp.so
  Expected in: flat namespace
 in /Users/py/Library/R/3.2/library/Rcpp/libs/Rcpp.so
Error: loading failed
Execution halted
ERROR: loading failed
* removing ?/Users/py/Library/R/3.2/library/Rcpp?
* restoring previous ?/Users/py/Library/R/3.2/library/Rcpp?

The downloaded source packages are in
?/private/var/folders/nn/p4t2bp0n0znc79dc77q45y9m0000gn/T/RtmpCaaP7K/downloaded_packages?
Warning message:
In install.packages("Rcpp", lib = r_libs_user_dir, repos =
"http://cran.r-project.org",  :
  installation of package ?Rcpp? had non-zero exit status
2 days later
#
Following the instructions here worked for me:

http://www.thecoatlessprofessor.com/programming/rcpp-rcpparmadillo-and-os-x-mavericks-lgfortran-and-lquadmath-error

Although the instructions have a slight typo in them, and probably should read:

  curl -O http://r.research.att.com/libs/gfortran-4.8.2-darwin13.tar.bz2
  sudo tar fvxz gfortran-4.8.2-darwin13.tar.bz2 -C /

I should note that I was having different problems than what you
report, though, but try that.

Which version of R did you install, btw? I'm assuming you've got a
binary 3.2-mavericks binary from CRAN (and not compiled your own).

HTH,
-steve
On Sat, May 2, 2015 at 6:43 PM, Peng Yu <pengyu.ut at gmail.com> wrote:

  
    
#
On Tue, May 5, 2015 at 3:12 PM, Steve Lianoglou
<lianoglou.steve at gene.com> wrote:
Nothing has been fixed. I have macports installed. Could it be the problem?
Yes. Here is my R version.

~$ R --version
R version 3.2.0 (2015-04-16) -- "Full of Ingredients"
Copyright (C) 2015 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin13.4.0 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under the terms of the
GNU General Public License versions 2 or 3.
For more information about these matters see
http://www.gnu.org/licenses/.
#
Hi,
On Tue, May 5, 2015 at 8:41 PM, Peng Yu <pengyu.ut at gmail.com> wrote:
On second thought, I'm not sure why I thought to suggest that other
than you'll probably need it later (ie. if you want to compile
RcppArmadillo, which is what tripped me up) -- Rcpp doesn't require a
"working" fortran compiler, I'd imagine ;-)
Maybe?

You didn't happen to install an updated gcc from macports, did you?
What's the output of:

  $ which g++

and

  $ g++ --version

from the command line?

-steve
#
Your error:

Error in dyn.load(file, DLLpath = DLLpath, ...) :
  unable to load shared object
'/Users/py/Library/R/3.2/library/Rcpp/libs/Rcpp.so':
  dlopen(/Users/py/Library/R/3.2/library/Rcpp/libs/Rcpp.so, 6): Symbol
not found: __ZNSoD0Ev


says some (mangled) symbol named `__ZNSoD0Ev` could not be found. Using the
online demangling tool at http://demangler.com/, I see this symbol is:

_std::basic_ostream<char, std::char_traits<char> >::~basic_ostream()


which should be provided by your C++ standard library.

Given that you're using `g++` on OS X, I'm assuming you installed gcc from
macports or something like that, but either that was provided without a
standard library (libstdc++), or it's distributed in such a way that
libstdc++ isn't located on its default library search path.

So, you should either:

1. Figure out where you can get libstdc++ for the g++ compiler you've
obtained, or
2. Just use Apple's command line tools (clang etc) as that will 'just work'.

Kevin
On Tue, May 5, 2015 at 8:41 PM, Peng Yu <pengyu.ut at gmail.com> wrote:

            
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20150505/5213dffd/attachment.html>
#
On Tue, May 5, 2015 at 10:51 PM, Steve Lianoglou
<lianoglou.steve at gene.com> wrote:
~$ type -P g++
/usr/bin/g++
~$ g++ --version
Configured with:
--prefix=/Applications/Xcode.app/Contents/Developer/usr
--with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin13.4.0
Thread model: posix

  
    
#
On Tue, May 5, 2015 at 10:52 PM, Kevin Ushey <kevinushey at gmail.com> wrote:
I use install.packages(). How to clang with it?
#
Oh, I wonder if you have the Snow Leopard version of R installed, when you
should have the Mavericks version? What is the output of `sessionInfo()`?
You might need to install the (Mavericks, non-Snow Leopard) version of R
here:  http://cran.r-project.org/bin/macosx/
On Tue, May 5, 2015 at 8:57 PM, Peng Yu <pengyu.ut at gmail.com> wrote:

            
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20150505/0be68ec5/attachment-0001.html>
#
Finally, you could always try placing this in a file located at
`~/.R/Makevars`:

CC=clang

CXX=clang++


This was an 'old' workaround that ensured packages were built with `clang`
on Mavericks and above, when the transition first began...
On Tue, May 5, 2015 at 9:01 PM, Kevin Ushey <kevinushey at gmail.com> wrote:

            
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20150505/776878b7/attachment.html>
#
I still have the errors.

trying URL 'http://cran.r-project.org/src/contrib/Rcpp_0.11.6.tar.gz'
Content type 'application/x-gzip' length 2352221 bytes (2.2 MB)
==================================================
downloaded 2.2 MB

* installing *source* package ?Rcpp? ...
** package ?Rcpp? successfully unpacked and MD5 sums checked
** libs
clang++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG
-I../inst/include/ -I/usr/local/include -I/usr/local/include/freetype2
-I/opt/X11/include    -fPIC  -Wall -mtune=core2 -g -O2  -c Date.cpp -o
Date.o
clang++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG
-I../inst/include/ -I/usr/local/include -I/usr/local/include/freetype2
-I/opt/X11/include    -fPIC  -Wall -mtune=core2 -g -O2  -c Module.cpp
-o Module.o
clang++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG
-I../inst/include/ -I/usr/local/include -I/usr/local/include/freetype2
-I/opt/X11/include    -fPIC  -Wall -mtune=core2 -g -O2  -c
Rcpp_init.cpp -o Rcpp_init.o
clang++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG
-I../inst/include/ -I/usr/local/include -I/usr/local/include/freetype2
-I/opt/X11/include    -fPIC  -Wall -mtune=core2 -g -O2  -c api.cpp -o
api.o
clang++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG
-I../inst/include/ -I/usr/local/include -I/usr/local/include/freetype2
-I/opt/X11/include    -fPIC  -Wall -mtune=core2 -g -O2  -c
attributes.cpp -o attributes.o
clang++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG
-I../inst/include/ -I/usr/local/include -I/usr/local/include/freetype2
-I/opt/X11/include    -fPIC  -Wall -mtune=core2 -g -O2  -c barrier.cpp
-o barrier.o
clang++ -dynamiclib -Wl,-headerpad_max_install_names -undefined
dynamic_lookup -single_module -multiply_defined suppress
-L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o
Rcpp.so Date.o Module.o Rcpp_init.o api.o attributes.o barrier.o
-F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework
-Wl,CoreFoundation
installing to /Users/py/Library/R/3.2/library/Rcpp/libs
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
Error in dyn.load(file, DLLpath = DLLpath, ...) :
  unable to load shared object
'/Users/py/Library/R/3.2/library/Rcpp/libs/Rcpp.so':
  dlopen(/Users/py/Library/R/3.2/library/Rcpp/libs/Rcpp.so, 6): Symbol
not found: __ZNSoD0Ev
  Referenced from: /Users/py/Library/R/3.2/library/Rcpp/libs/Rcpp.so
  Expected in: flat namespace
 in /Users/py/Library/R/3.2/library/Rcpp/libs/Rcpp.so
Error: loading failed
Execution halted
ERROR: loading failed
* removing ?/Users/py/Library/R/3.2/library/Rcpp?
* restoring previous ?/Users/py/Library/R/3.2/library/Rcpp?

The downloaded source packages are in
?/private/var/folders/nn/p4t2bp0n0znc79dc77q45y9m0000gn/T/Rtmp6dAToo/downloaded_packages?
Warning message:
In install.packages("Rcpp", lib = r_libs_user_dir, repos =
"http://cran.r-project.org",  :
  installation of package ?Rcpp? had non-zero exit status
On Tue, May 5, 2015 at 11:03 PM, Kevin Ushey <kevinushey at gmail.com> wrote:

  
    
#
Steve Lianoglou <lianoglou.steve at gene.com> writes:
My *guess* is that it has to do, as you point out, a problem of
different compilers and mixed installations from binaries (R) and from
source, i.e. using different compilers and compiler versions.

I had similar troubles until I removed all remnants of the binary
installation of R and installed everything via homebrew (no experience
with MacPorts).

But then (just a guess), as far I understand MacPorts, they provide
binaries, and they not necessarily correspond to the same compilers you
have installed?

If this is really causing the problem, I guess you have to install
everything from source, which you ca do using homebrew.

Cheers,

Rainer