[R] Compilation failures: mgcv, spatstat, Matrix, cluster
Douglas Bates
dmbates at gmail.com
Mon Aug 15 20:02:46 CEST 2005
On 8/13/05, Paul Roebuck <roebuck at odin.mdacc.tmc.edu> wrote:
> On Sat, 13 Aug 2005, Michael Kubovy wrote:
>
> > With Version 2.1.1 (2005-06-20) on Power Mac G5 running Mac OS X
> > 10.4.2 (8C46):
> >
> > Some compilations work (e.g., MatchIt, RGraphics, Zelig), and some
> > don't, e.g., mgcv, spatstat, and the following (Matrix, cluster):
> >
> > trying URL 'http://www.ibiblio.org/pub/languages/R/CRAN/src/contrib/
> > Matrix_0.98-3.tar.gz'
> > Content type 'application/x-tar' length 626712 bytes
> > opened URL
> > ==================================================
> > downloaded 612Kb
> >
> > * Installing *source* package 'Matrix' ...
> > ** libs
> >
> > The downloaded packages are in
> > /private/tmp/RtmpPddsAE/downloaded_packages
> > gcc-3.3 -no-cpp-precomp -I/Library/Frameworks/R.framework/Resources/
> > include -I/usr/local/include -I./Metis -fno-common -g -O2 -c
> > HBMM.c -o HBMM.o
> > In file included from HBMM.c:2:
> > iohb.h:6:19: malloc.h: No such file or directory
> > make: *** [HBMM.o] Error 1
> > ERROR: compilation failed for package 'Matrix'
>
> Didn't check package for actually functioning correctly,
> but the following changes will allow compilation on OS X
> 10.3. In ANSI C, the standard memory allocation routines
> are declared in <stdlib.h>; <malloc.h> is obsolete for that
> purpose and isn't guaranteed to exist.
>
>
> Matrix/src/mmio.c:
> Add #include <stdlib.h>
> Remove #include <malloc.h>
>
> Matrix/src/iohb.h:
> Remove #include <malloc.h>
Thanks for the suggestion, Paul. I wasn't quite as sloppy as it may
seem. I recently introduced the iohb.[hc] and mmio.[hc] files from
NIST into the Matrix package but I didn't check them thoroughly before
doing so. I should have. Those are not the only antiquated C
constructs in those files. The author of iohb.c also assumes that he
can pass a string constant to a function that modifies the contents of
that argument and, of course, gcc will produce code that segfaults at
that point if you do not use -fwriteable-strings and we don't want to
do that.
More information about the R-help
mailing list