Skip to content
Prev 46182 / 63461 Next

Cross-platform linking of a simple front-end

On 06/07/2013 03:19, Simon Urbanek wrote:
I was able to reproduce this on Fedora: that is not the error if R was 
not built as a shared library.

I would simply copy how R does it (for R.bin in src/main).  libtool 
(used by R CMD LINK) is not coming up with the same flags.  On my system 
R is not using -lm:

gcc -std=gnu99 -Wl,--export-dynamic -fopenmp  -L/usr/local/lib64 -o 
R.bin Rmain.o  -L../../lib -lR -lRblas


Adding -lm is not portable (some OSes do not have a separate libm and 
some always add it when linking via $(CC)), but there is a LIBM macro in 
etc/Makeconf which tells you if configure found one.