[R-sig-dyn-mod] Problem with loading compiled code into R

Thomas Petzoldt thomas.petzoldt at tu-dresden.de
Fri Apr 7 19:36:35 CEST 2017


Hi Mathilde,

a short question: which version of deSolve did you use? The stable 
version 1.14 from CRAN (i.e. the usual case) or a development snapshot 
from R-Forge (currently 1.20)?

Can you test your model on a Windows or Linux system?

Another idea may be a change of the compiler on the Mac. The CRAN tests 
of deSolve (1.14) are ok for the Mac, but I have personally no Mac at 
hand for testing. Is anybody else able to check this, or provide 
information about changes of the C compilers on the Mac?

You may also consider to ask the R-Sig-Mac mailing list:
https://stat.ethz.ch/mailman/listinfo/r-sig-mac

Thomas

Am 07.04.2017 um 12:20 schrieb Hagens, M. (Mathilde):
> Dear all,
>
> I’m using compiled code (written in C) in combination with the deSolve package to run a one-dimensional reactive transport model in R. On a server I use running on Linux this works flawlessly, but on a MacBook Pro (macOS 10.12.4) I have problems loading the compiled code into R (version 3.3.3).
>
> The output I get when compiling the code in R using
> system("R CMD SHLIB Model.c”)
> is:
> clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG  -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include    -fPIC  -Wall -mtune=core2 -g -O2  -c Model.c -o Model.o
> clang -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o Model.so Model.o -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
>
> However, when I try to load the resulting shared object via
> dyn.load(paste("Model", .Platform$dynlib.ext, sep = ""))
> I get:
> Error in dyn.load(paste("Model", .Platform$dynlib.ext, sep = "")) :
>   unable to load shared object '/Users/mathilde/Model.so':
>   dlopen(/Users/mathilde/Model.so, 6): Symbol not found: _dH_dt
>   Referenced from: /Users/mathilde/Model.so
>   Expected in: flat namespace
>  in /Users/mathilde/Model.so
>
> The shared object created after compiling seems to look fine. Also, I tried compiling directly from the Terminal, but that doesn’t make a difference. Strangely, when I ran this model on a Mac in the past (~1 year ago) it also worked without problems, leaving me wondering whether it may be due to an R / macOS update. However, switching to an older R version (2.15.2) didn’t solve the issue either. Has anyone experienced similar behaviour and/or knows of a possible solution?
>
> Best wishes,
> Mathilde
>
> 	[[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-dynamic-models mailing list
> R-sig-dynamic-models at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-dynamic-models
>


-- 
Dr. Thomas Petzoldt
Technische Universitaet Dresden
Faculty of Environmental Sciences
Institute of Hydrobiology
01062 Dresden, Germany

Tel.: +49 351 463 34954
Fax:  +49 351 463 37108
E-Mail: thomas.petzoldt at tu-dresden.de
http://tu-dresden.de/Members/thomas.petzoldt

-- limnology and ecological modelling --



More information about the R-sig-dynamic-models mailing list