[Rd] Installing R-packages in Windows Using Rtools - compilation error when <signal.h> included in C header

Naim Rashid homeriq5 at gmail.com
Sat Mar 27 18:59:41 CET 2010

Hi all,

I have been attempting to find a resolution to this problem but could
not to any avail. I am attempting to install an R-package from source
in windows that depends on underlying C-code.  I should mention that
this error is not found when installing this package from source in
Linux or Mac.  To do this I have installed R-tools 2.11 and was
successfully able to use R and basic unix commands from the windows
command prompt.

When I install my package from the windows command prompt with R CMD
INSTALL <packagename> however, the C files within the source directory
all compiles until it hits a file called cheapcgi.c, where the
following error is given:

gcc -I"c:/R/include"        -O3 -Wall  -std=gnu99 -c cheapcgi.c -o cheapcgi.o
cheapcgi.c: In function 'catchSignal':
cheapcgi.c:538: error: 'SIGBUS' undeclared (first use in this function)
cheapcgi.c:538: error: (Each undeclared identifier is reported only once
cheapcgi.c:538: error: for each function it appears in.)
cheapcgi.c:546: error: 'SIGKILL' undeclared (first use in this function)
cheapcgi.c: In function 'initSigHandlers':
cheapcgi.c:558: error: 'SIGBUS' undeclared (first use in this function)
make: *** [cheapcgi.o] Error 1
  ... done
ERROR: compilation failed for package 'zinba'
* removing 'c:/R/library/zinba'

Exploring this error further, I see these variables are defined in the
standard C header file signal.h, and is linked to in cheapcgi.c using

#include <signal.h>

in the beginning of the file.  Now, the other C files have compiled
successfully before reaching this file, so I know that the MinGW
compiler is at least working.  When checking the mingw/include
directory in the Rtools folder, I do indeed see a file for signal.h,
so it is not missing.

This problem is baffling and I could not find any documents talking
about this issues online.  I do realize that system signals may not
work in windows, but at least the header files for the signal.h should
be found.  I would be greatly appreciative if anyone can shed any
insight on this issue. Again, this is only when installing R packages
in windows using Rtools, not in Mac or Linux.

Thanks very much,

More information about the R-devel mailing list