The R Installation and Administration manual: http://cran.r-project.org/doc/manuals/R-admin.html recommends setting -std=gnu99 in CFLAGS in /usr/lib/R/etc/Makeconf but the current ~x86 ebuild of dev-lang/R (for R 2.4.0) does not do so. This causes compilation failures when installing certain R packages that depend on C99. More details at http://www.laakshmi.com/aarre/wiki/index.php/Incident_2006-10-21.01 if you want them. laakshmi portage # emerge --info Portage 2.1.1 (default-linux/x86/2006.0, gcc-3.4.6, glibc-2.4-r3, 2.6.17-gentoo-r4 i686) ================================================================= System uname: 2.6.17-gentoo-r4 i686 AMD Athlon(tm) processor Gentoo Base System version 1.12.5 Last Sync: Wed, 11 Oct 2006 21:00:08 +0000 ccache version 2.3 [enabled] app-admin/eselect-compiler: [Not Present] dev-java/java-config: 1.2.11-r1 dev-lang/python: 2.4.3-r4 dev-python/pycrypto: 2.0.1-r5 dev-util/ccache: 2.3 dev-util/confcache: [Not Present] sys-apps/sandbox: 1.2.17 sys-devel/autoconf: 2.13, 2.59-r7 sys-devel/automake: 1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2 sys-devel/binutils: 2.16.1-r3 sys-devel/gcc-config: 1.3.13-r4 sys-devel/libtool: 1.5.22 virtual/os-headers: 2.6.17-r1 ACCEPT_KEYWORDS="x86" AUTOCLEAN="yes" CBUILD="i686-pc-linux-gnu" CFLAGS="-march=athlon-tbird -O3 -pipe" CHOST="i686-pc-linux-gnu" CONFIG_PROTECT="/etc /usr/kde/3.4/env /usr/kde/3.4/share/config /usr/kde/3.4/shutdown /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/lib/mozilla/defaults/pref /usr/share/X11/xkb /usr/share/config /usr/share/texmf/dvipdfm/config/ /usr/share/texmf/dvips/config/ /usr/share/texmf/tex/generic/config/ /usr/share/texmf/tex/platex/config/ /usr/share/texmf/xdvi/" CONFIG_PROTECT_MASK="/etc/env.d /etc/gconf /etc/revdep-rebuild /etc/terminfo" CXXFLAGS="-march=athlon-tbird -O3 -pipe" DISTDIR="/usr/portage/distfiles" FEATURES="autoconfig ccache distlocks metadata-transfer sandbox sfperms strict" GENTOO_MIRRORS="ftp://ftp.ussg.iu.edu/pub/linux/gentoo http://distfiles.gentoo.org http://www.ibiblio.org/pub/Linux/distributions/gentoo" LINGUAS="" MAKEOPTS="-j2" PKGDIR="/usr/portage/packages" PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude='/distfiles' --exclude='/local' --exclude='/packages'" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" SYNC="rsync://rsync.gentoo.org/gentoo-portage" USE="x86 X aac aim alsa apache2 apm arts bash-completion berkdb bitmap-fonts blas bzip2 canna cdparanoia cdr cjk cli crypt cups curl dlloader dri dv eds elibc_glibc emacs emacs-w3 emboss encode esd examples exif ffmpeg fftw flac font foomaticdb fortran gd gdbm gif gnome gnuplot gpm graphviz gs gstreamer gtk gtk2 imagemagick imap imlib input_devices_keyboard input_devices_mouse isdnlog java javascript jbig jpeg jpeg2k kde kdeenablefinal kernel_linux lapack leim libg++ libwww lm_sensors mad maildir mbox mikmod mmx motif mozilla mp3 mpeg msn mule mysql mysqli ncurses nls nptl nptlonly offensive ofx ogg opengl oss pam pcre pdf perl php plotutils png pppd python qt qt3 qt4 quicktime readline reflection samba sasl sdl session spell spl ssl svg symlink tcltk tcpd tetex tidy tiff truetype truetype-fonts type1-fonts udev unicode usb userland_GNU video_cards_fbdev video_cards_nvidia video_cards_vesa vorbis win32codecs wmf wxwindows xcomposite xemacs xml xmms xorg xscreensaver xv xvid yahoo zlib" Unset: CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, LDFLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PORTDIR_OVERLAY
Hi Aarre, Thanks for pointing this out! I looked into this and it indeed looks like we should append -std=gnu99 to CFLAGS. I've just changed this in the ebuild for R-2.4.0. Thanks, Markus
Can we do -std=c99 instead, or does it actually use the gnu-specific extensions?
(In reply to comment #2) > Can we do -std=c99 instead, or does it actually use the gnu-specific > extensions? > Their docs state that ".. the C compiler should be IEC 600596, POSIX 1003.1 and C99-compliant..". As far as I know, std=c99 will not cover POSIX compliance but std=gnu99 will. I might be wrong though. Thanks, Markus
A little searching suggests you are right, but I couldn't actually find it anywhere in official documentation.
I see that this is marked "RESOLVED FIXED" (thank you!) but FYI (or in case it should come up again), the R Installation and Administration manual (downloaded 10/28/06 3:40am EDT): http://cran.r-project.org/doc/manuals/R-admin.html which is "official documentation", states specifically and clearly that -std=gnu99 as opposed to -std=c99 is required because of POSIX compliance: "You need a means of compiling C and FORTRAN 77 (see Using FORTRAN). Some add-on packages also need a C++ compiler. Your C compiler should be IEC 600596, POSIX 1003.1 and C99-compliant if at all possible. R tries to choose suitable flags for the C compilers it knows about, but you may have to set CFLAGS suitably. For recent versions of gcc with glibc this means including -std=gnu99 in CFLAGS (-std=c99 excludes POSIX functionality)."
Oh, and keep in mind that this CFLAGS setting (in /usr/lib/R/etc/Makeconf) is used *only* for compiling R add-on packages. It does not affect your environment CFLAGS, so will not cause changes with compiling anything other than R add-on packages.