On 6 July 2015 at 12:10, Peng Yu wrote: | Hi, I made a package using Rcpp and FORTRAN. But I see the following | error message on Ubuntu (it can be installed correctly on Mac OS X). | | I searched for the solution to it. But it not clear how I should fix | the problem. Could anybody let me know how to solve this problem. | | Loading required package: Rcpp | R CMD INSTALL --preclean --no-multiarch /mnt/nfs/py/projects/Rusrpkg/lbfgsbr | > tools:::.install_packages() | * installing to library ‘/home/py/R/x86_64-pc-linux-gnu-library/3.1.0’ | * installing *source* package ‘lbfgsbr’ ... | ** libs | gfortran -fpic -g -O2 -c dcsrch.f90 -o dcsrch.o | gfortran -fpic -g -O2 -c dcstep.f90 -o dcstep.o | g++ -I/opt/packages/R/R-3.1.0/lib/R/include -DNDEBUG `echo | "Rcpp:::CxxFlags()"|R --vanilla --slave` -I/usr/local/include -fpic | -g -O2 -c mtlnsrch.cpp -o mtlnsrch.o | gfortran -shared -L/usr/local/lib -o lbfgsbr.so dcsrch.o dcstep.o | mtlnsrch.o -lgfortran | installing to /home/py/R/x86_64-pc-linux-gnu-library/3.1.0/lbfgsbr/libs | ** R | ** preparing package for lazy loading | ** help | *** installing help indices | ** building package indices | ** testing if installed package can be loaded | > tools:::.test_load_package('lbfgsbr', '/home/py/R/x86_64-pc-linux-gnu-library/3.1.0') | Error in dyn.load(file, DLLpath = DLLpath, ...) : | unable to load shared object | '/home/py/R/x86_64-pc-linux-gnu-library/3.1.0/lbfgsbr/libs/lbfgsbr.so': | /home/py/R/x86_64-pc-linux-gnu-library/3.1.0/lbfgsbr/libs/lbfgsbr.so: | undefined symbol: _ZTVN10__cxxabiv120__si_class_type_infoE | Error: loading failed | Execution halted | ERROR: loading failed | * removing ‘/home/py/R/x86_64-pc-linux-gnu-library/3.1.0/lbfgsbr’ | * restoring previous ‘/home/py/R/x86_64-pc-linux-gnu-library/3.1.0/lbfgsbr’
That is a linker error. Now, if look at the linker statement from above (wrapped to one line here) gfortran -shared -L/usr/local/lib -o lbfgsbr.so dcsrch.o dcstep.o mtlnsrch.o -lgfortran you see that is contains no linking of any (system) C++ library. So no wonder the symbol is missing. You could try to start from a working package (Rcpp.package.skeleton() can help) then add your Fortran file(s), and/or set LD in src/Makevars explicitly. Dirk -- http://dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org _______________________________________________ Rcpp-devel mailing list Rcpp-devel@lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel