问题
We have been trying to install RQuantLib on a redhat linux machine. After a month (embarassingly long time!) of trial and error, we have succesfully compiled the latest version of boost and also quantlib. I am not a linux expert at all, so I am having a little trouble debugging the compile flags when I run install.packages("RQuantLib"). Rcpp is installed and working perfectly as well.
The error message below details the issue. I am confused because the file I think it should want (libQuantLib.so.0) exists in /usr/local/lib. Sorry that this is most likely a stupid question, but I think we are very close to having access to quantlib in R on linux.
The error message is below:
g++ -I/apps/R/R-3.0.0/include -DNDEBUG -I/usr/local/include -I"/apps/R/R-3.0.0/library/Rcpp/include" -g -O2 -I/usr/local/include -I/usr/loca
l/include/boost -I. -fpic -g -O2 -c zero.cpp -o zero.o
g++ -shared -L/usr/local/lib64 -o RQuantLib.so asian.o barrier_binary.o bermudan.o bonds.o calendars.o curves.o daycounter.o discount.o hullwhi
te.o implieds.o utils.o vanilla.o zero.o -L/apps/R/R-3.0.0/library/Rcpp/lib -lRcpp -Wl,-rpath,/apps/R/R-3.0.0/library/Rcpp/lib -L/usr/local/lib
-L/usr/local/lib -lQuantLib
installing to /apps/R/R-3.0.0/library/RQuantLib/libs
** R
** demo
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/apps/R/R-3.0.0/library/RQuantLib/libs/RQuantLib.so':
libQuantLib.so.0: cannot open shared object file: No such file or directory
Error: loading failed
Execution halted
ERROR: loading failed
回答1:
It might just be that the dynamic loader hasn't realized yet that you've added QuantLib. Try adding the line
/usr/local/lib
to /etc/ld.so.conf
(if it's not already there) and then run
sudo ldconfig
On your system there should be man pages for both ld.so
and ldconfig
if you want to understand what you're doing, which is always a good proposition. Never execute commands given by strangers on the internet, especially in sudo
mode :)
After you do the above, you should be able to load libQuantLib
.
来源:https://stackoverflow.com/questions/18644436/installing-rquantlib-on-linux