Hi I am trying to develop a package which links against a C library which is installed on my system (Mac OSX) in the /usr/local/lib directory.
The C library against which I am linking is called 'Sundials <http://computation.llnl.gov/projects/sundials-suite-nonlinear-differential-algebraic-equation-solvers>' (an efficient solver for large scale ordinary differential/algebraic equations) and the specific error I get when I perform 'clean and rebuild` in RStudio, I get the following error Library not loaded: libsundials_nvecserial.0.dylib The Makevars is as follows PKG_CPPFLAGS= -I../inst/include/ -I src/sundials > PKG_LIBS= $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) -L/usr/local/lib > -lsundials_nvecserial -lsundials_cvode -lm Initially, I was thinking of building the library in the package itself so that the users don't have to install `sundials` to use the package, but I have abandoned that approach (for now) and I am now trying to link to the libraries installed on the system. Currently, the package does not do anything useful, I am just trying to allocate values to the N_VNew_Serial() (a vector type defined by the sundials library), see - https://github.com/sn248/Rcppsbmod/blob/pr/1/src/sundials_test.cpp I have confirmed that /usr/local/lib does contain libsundials_nvecserial.0.dylib The source code for the entire package can be found at - https://github.com/sn248/Rcppsbmod/tree/pr/1 In the interest of full disclosure, I have asked a similar question before on StackOverflow also - http://stackoverflow.com/questions/37819967/compiling-c-in-rcpp-with-external-c-library and received comments that this is a linking error, not compilation. To confirm that I have sundials installed and working on my laptop, I tried to compile and link an example from the library using the command gcc -Wall cvRoberts_dns.c -o cvRoberts_dns.exe -I/usr/local/include -L/usr/local/lib/ -lsundials_cvode -lsundials_nvecserial -lm and was able to run it successfully. Any help in linking successfully to this library in my package would be highly appreciated. Thanks! SN [[alternative HTML version deleted]] ______________________________________________ R-package-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel