Dear all,

I have a simple front-end program which uses the APIs described in section
8 of "Writing R Extensions" to deviate from the standard R behaviour in
fairly minor ways. However, I'm having some difficulty getting it to link
reliably across different platforms.

R CMD LINK seemed like it would help, but I've had difficulty finding many
real-world examples online. I've tried

  R CMD LINK $(R CMD config CC) $(R CMD config --cppflags) $(R CMD config
--ldflags) -o ../bin/exec/tractor tractor.c

and this works on one of my test platforms (OS X.8.4, R 3.0.1), but not the
other (Ubuntu 12.04 LTS, R 2.14.1). In the latter case I get the error

  /usr/bin/ld: /tmp/ccmKf57E.o: undefined reference to symbol 'log10@
@GLIBC_2.0'
  /usr/bin/ld: note: 'log10@@GLIBC_2.0' is defined in DSO
/lib/i386-linux-gnu/libm.so.6 so try adding it to the linker command line
  /lib/i386-linux-gnu/libm.so.6: could not read symbols: Invalid operation
  collect2: ld returned 1 exit status

I can correct this by adding "-lm" manually to the command, but I'm not
sure how portable that will itself be.

Could anyone advise on the best way to make this work portably, please? For
this application I'm not concerned about Windows compatibility -
portability across Unix-alikes is sufficient. The source code is at <
https://github.com/jonclayden/tractor/blob/master/src/tractor.c>, if that
is useful.

All the best,
Jon

	[[alternative HTML version deleted]]

