[R-pkg-devel] Conditional linking in Makevars

David Cortes d@v|d@corte@@r|ver@ @end|ng |rom gm@||@com
Tue Aug 11 20:28:52 CEST 2020

I am having issues with undefined compiler symbols in a package with C
code that I recently updated:
The issue seems to be connected with usage of OpenMP, and happens only
when compiling with clang:
“Error: package or namespace load failed for 'poismf' in dyn.load(file,
DLLpath = DLLpath, ...):
 unable to load shared object '/home/hornik/tmp/R.check/r-devel-
poismf/00new/poismf/libs/poismf.so: undefined symbol:

Prof. Ripley left the following comment:
“I don't know what makes your use of OpenMP uniquely different but
using clang you need to include -latomic in the link (where it exists, 
as it does on Linux and probably on FreeBSD).”

I am wondering if it is somehow possible to add conditional link
arguments in a Makevars file depending on the user’s operating system,
or if not possible, whether it would somehow hurt in windows/mac
installations to add a raw -latomic in there.

Best regards,
David Cortes

More information about the R-package-devel mailing list