Installation Error on Mac
I'm trying to install RQuantLib on mac, but have some issues. Here are the steps I followed:
I first installed boost and QuantLib by following the official instructions http://quantlib.org/install/macosx.shtml The make process used Apple default clang complier.
I then go to Rstudio and try to install RQuantLib. It complained about '-fopenmp' not supported, which is understandable. So I then installed gcc-7 by
brew install gcc
Then I modified ~/.R/MakeVars and added the following:
CC=gcc-7
CXX=g++-7
Then I tried to install RQuantLib again. The process went on for a few mins (with a lot of warnings on syntax, etc), and finally it gives the following error:
installing to /Library/Frameworks/R.framework/Versions/3.4/Resources/library/RQuantLib/libs
** R
** data
** demo
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
Error: package or namespace load failed for ‘RQuantLib’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/Library/Frameworks/R.framework/Versions/3.4/Resources/library/RQuantLib/libs/RQuantLib.so':
dlopen(/Library/Frameworks/R.framework/Versions/3.4/Resources/library/RQuantLib/libs/RQuantLib.so, 6): Symbol not found: __ZN8QuantLib13MultiStepSwap12nextTimeStepERKNS_10CurveStateERSt6vectorImSaImEERS4_IS4_INS_23MarketModelMultiProduct8CashFlowESaIS9_EESaISB_EE
Referenced from: /Library/Frameworks/R.framework/Versions/3.4/Resources/library/RQuantLib/libs/RQuantLib.so
Expected in: flat namespace
in /Library/Frameworks/R.framework/Versions/3.4/Resources/library/RQuantLib/libs/RQuantLib.so
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/Library/Frameworks/R.framework/Versions/3.4/Resources/library/RQuantLib’
Warning in install.packages :
installation of package ‘RQuantLib’ had non-zero exit status
The downloaded source packages are in
‘/private/var/folders/fw/678zkqyd6b99rlzr6pydq71dvhrx3y/T/RtmpbsLRh6/downloaded_packages’
I don't quite understand the error message
Error: package or namespace load failed for ‘RQuantLib’ in dyn.load(file, DLLpath = DLLpath, ...): unable to load shared object '/Library/Frameworks/R.framework/Versions/3.4/Resources/library/RQuantLib/libs/RQuantLib.so': dlopen(/Library/Frameworks/R.framework/Versions/3.4/Resources/library/RQuantLib/libs/RQuantLib.so, 6): Symbol not found: __ZN8QuantLib13MultiStepSwap12nextTimeStepERKNS_10CurveStateERSt6vectorImSaImEERS4_IS4_INS_23MarketModelMultiProduct8CashFlowESaIS9_EESaISB_EE
-
Is this because I installed boost and QuantLib using Apple clang, and then RQuantLib using gcc-7?
-
Is there a way to uninstall QuantLib and boost so that it gets complied by gcc-7?
-
is there a way to upgrade clang so it supports -fopenmp?
Yes, quantlib and RQuantLib need to be compiled with gcc. The error you are seeing is the mismatch in the way the two compilers name objects. You can't mix object libraries from different compilers. Rebuild quantlib.
Thank you @tleitch! Do you mind to share more detailed instruction on how exactly (step by step) to build boost and quantlib, specifying gcc-7 and g++-7 as the complier?
Review this link. You will need to update the library versions to match current: http://quantlib.org/install/macosx.shtml
Also see this thread: https://github.com/eddelbuettel/rquantlib/issues/80
This https://github.com/eddelbuettel/rquantlib/wiki/RQuantLib worked. Thanks!
Ok, I guess we can close this.