[Rquantlib-devel] Problem compiling RQuantLib on OSX

Michael Waßmann info at wasix.biz
Mon Feb 2 08:45:13 CET 2015


> Hi there,
> 
> I have a problem in compiling RQuantlib on OS X. (full output see below)

Error Message(s): 
duplicate symbol __ZNK8QuantLib24BaseCorrelationLossModelINS_20GaussianLHPLossModelENS_21BilinearInterpolationEE11setupModelsEv in:
    RcppExports.o
    asian.o


> Do you have any ideas what I have to do?
> 
> With Linux/Ubuntu I have no trouble compiling RQuantlib  (see appendix)
> My OS X environment is listed below too. The difference between Linux and OS X seems to be  g++ vers clang++,
> 
> Kind regards
> 
> 
> Michael



Output

Mac:downloaded_packages wasi$ R CMD INSTALL RQuantLib
* installing to library ‘/Users/wasi/Library/R/3.1/library’
* installing *source* package ‘RQuantLib’ ...
** Paket ‘RQuantLib’ erfolgreich entpackt und MD5 Summen überprüft
checking for g++... g++
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking how to run the C++ preprocessor... g++ -E
checking whether we are using the GNU C++ compiler... (cached) yes
checking whether g++ accepts -g... (cached) yes
checking for R... yes
checking for quantlib-config... yes
checking for Boost development files... yes
checking for minimal Boost version... yes
configure: creating ./config.status
config.status: creating src/Makevars
Completed configuration and ready to build.
** libs
/usr/bin/clang++ -I/opt/local/Library/Frameworks/R.framework/Resources/include -DNDEBUG  -I/opt/local/include -I"/Users/wasi/Library/R/3.1/library/Rcpp/include"  -pipe -Os -arch x86_64 -stdlib=libc++  -I/gaia/local/include -I/opt/local/include  -I../inst/include -I.  -fPIC  -pipe -Os -arch x86_64 -stdlib=libc++  -c RcppExports.cpp -o RcppExports.o

<cut>

/usr/bin/clang++ -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/opt/local/Library/Frameworks/R.framework/Resources/lib -L/opt/local/lib -Wl,-headerpad_max_install_names -arch x86_64 -o RQuantLib.so RcppExports.o asian.o barrier_binary.o bermudan.o bonds.o calendars.o curves.o dates.o daycounter.o discount.o hullwhite.o implieds.o modules.o schedule.o utils.o vanilla.o zero.o -L/gaia/local/lib -L/opt/local/lib -lQuantLib -F/opt/local/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
duplicate symbol __ZNK8QuantLib24BaseCorrelationLossModelINS_20GaussianLHPLossModelENS_21BilinearInterpolationEE11setupModelsEv in:
    RcppExports.o
    asian.o


<cut>

duplicate symbol __ZNK8QuantLib24BaseCorrelationLossModelINS_26InhomogeneousPoolLossModelINS_20GaussianCopulaPolicyEEENS_21BilinearInterpolationEE11setupModelsEv in:
    RcppExports.o
    zero.o
ld: 64 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [RQuantLib.so] Error 1
ERROR: compilation failed for package ‘RQuantLib’
* removing ‘/Users/wasi/Library/R/3.1/library/RQuantLib’
Mac:downloaded_packages wasi$ 



Environment OSX


uname -a
Darwin Mac.fritz.box 14.1.0 Darwin Kernel Version 14.1.0: Mon Dec 22 23:10:38 PST 2014; root:xnu-2782.10.72~2/RELEASE_X86_64 x86_64


Mac:downloaded_packages wasi$ clang++ --version
Apple LLVM version 6.0 (clang-600.0.56) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin14.1.0
Thread model: posix



Mac:downloaded_packages wasi$ R --version
R version 3.1.2 (2014-10-31) -- "Pumpkin Helmet"
Copyright (C) 2014 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin14.0.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/.



Mac:downloaded_packages wasi$ quantlib-config --version
1.5



Mac:downloaded_packages wasi$ more RQuantLib/DESCRIPTION 
Package: RQuantLib
Title: R Interface to the QuantLib Library
Version: 0.4.0
Date: 2014-12-01
Maintainer: Dirk Eddelbuettel <edd at debian.org>
Author: Dirk Eddelbuettel, Khanh Nguyen (during 2009-2010)
Description: The RQuantLib package makes parts of QuantLib accessible from R
 The QuantLib project aims to provide a comprehensive software framework for
 quantitative finance. The goal is to provide a standard open source library
 for quantitative analysis, modeling, trading, and risk management of
 financial assets.
Depends: R (>= 2.10.0)
Suggests: rgl, zoo, RUnit
Imports: methods, Rcpp (>= 0.11.0)
LinkingTo: Rcpp
SystemRequirements: QuantLib library (>= 1.4.0) from
        http://quantlib.org, Boost library from http://www.boost.org
License: GPL (>= 2)
URL: http://quantlib.org
        http://dirk.eddelbuettel.com/code/rquantlib.html
Packaged: 2014-12-01 12:10:25.68506 UTC; edd
NeedsCompilation: yes
Repository: CRAN
Date/Publication: 2014-12-02 12:18:45


APPENDIX/LINUX

Linux/Ubuntu works fine without any problems:

- sudo apt-get install r-base libboost-all-dev libquantlib0  libquantlib0-dev 
- tar -xzf RQuantLib-current.tar.gz

wasi at ubuntu:~/work$ R CMD INSTALL RQuantLib
* installing to library ‘/home/wasi/R/x86_64-pc-linux-gnu-library/3.0’
* installing *source* package ‘RQuantLib’ ...
checking for g++... g++
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking how to run the C++ preprocessor... g++ -E
checking whether we are using the GNU C++ compiler... (cached) yes
checking whether g++ accepts -g... (cached) yes
checking for R... yes
checking for quantlib-config... yes
checking for Boost development files... yes
checking for minimal Boost version... yes
configure: creating ./config.status
config.status: creating src/Makevars
Completed configuration and ready to build.
** libs
g++ -I/usr/share/R/include -DNDEBUG   -I"/home/wasi/R/x86_64-pc-linux-gnu-library/3.0/Rcpp/include"  -O3 -pipe -g  -I/usr/include -fpermissive -I../inst/include -I. -fpic  -O3 -pipe  -g  -c asian.cpp -o asian.o

<cut>

g++ -I/usr/share/R/include -DNDEBUG   -I"/home/wasi/R/x86_64-pc-linux-gnu-library/3.0/Rcpp/include"  -O3 -pipe -g  -I/usr/include -fpermissive -I../inst/include -I. -fpic  -O3 -pipe  -g  -c zero.cpp -o zero.o
g++ -shared -o RQuantLib.so asian.o barrier_binary.o bermudan.o bonds.o calendars.o curves.o daycounter.o discount.o hullwhite.o implieds.o modules.o utils.o vanilla.o zero.o -L/usr/lib -lQuantLib -L/usr/lib/R/lib -lR
installing to /home/wasi/R/x86_64-pc-linux-gnu-library/3.0/RQuantLib/libs
** R
** demo
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
* DONE (RQuantLib)
wasi at ubuntu:~/work$ 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rquantlib-devel/attachments/20150202/d4c560c5/attachment.html>


More information about the Rquantlib-devel mailing list