[Bioc-devel] C++ header changes in R-devel

Henrik Bengtsson henrik.bengtsson at gmail.com
Mon Mar 7 00:40:23 CET 2016


If of any help, at least for affxparser the fix was very simple.  It
was just a matter of moving #include statements outside of the +extern
"C" { ... }:

https://github.com/HenrikBengtsson/affxparser/commit/e750159a9abeeb463661095f6c07f1bb7bf611d9

So not as scary as it first may sound.  The compile errors before the
fix (https://travis-ci.org/HenrikBengtsson/affxparser/jobs/87249834#L1707-L1845)
looked like this:

In file included from /home/travis/R-bin/R-devel/lib/R/include/R.h:36:0,
                 from R_affx_cel_parser.cpp:10:
/usr/include/c++/4.6/cmath: In function ‘double std::abs(double)’:
/usr/include/c++/4.6/cmath:82:17: error: declaration of C function
‘double std::abs(double)’ conflicts with
/usr/include/c++/4.6/cstdlib:139:3: error: previous declaration ‘long
int std::abs(long int)’ here
[...]
/usr/include/c++/4.6/cmath:813:3: error: template with C linkage
/usr/include/c++/4.6/cmath:822:3: error: template with C linkage
/usr/include/c++/4.6/cmath:831:3: error: template with C linkage
make: *** [R_affx_cel_parser.o] Error 1
ERROR: compilation failed for package ‘affxparser’

/Henrik

On Wed, Mar 2, 2016 at 8:38 AM, Dan Tenenbaum <dtenenba at fredhutch.org> wrote:
> Hi,
>
> I contacted some of you yesterday because your packages are breaking in R-devel.
>
> Specifically these packages MAY have this issue:
>
> AffyTiling
> bgx
> CALIB
> Cardinal
> flipflop
> Ringo
> rMAT
> seqbias
>
>
> I may have said something like this:
>
> "Probably due to changes in R headers in recent R-devel. Please use
> recent R-devel to find and fix the problem."
>
> That's not super helpful (plus, what are R headers?).
>
> This may be more helpful. Here is Brian Ripley describing several affected packages:
>
> "These now fail to install in R-devel as they include headers such as R.h
> from C++ code inside an extern "C" block. That has been failing in some
> pre-release compilers and we have switched to including C++ headers such
> as cmath (rather than math.h). Installation now fails with current
> versions of common C++ compilers such as g++ and clang++."
>
> See also this excerpt from the NEWS file (https://github.com/wch/r-source/blob/trunk/doc/NEWS.Rd#L439-L449):
>
>       \item When \R{} headers such as \file{R.h} and \file{Rmath.h} are
>       called from C++ code in packages they include the C++ versions of
>       system headers such as \file{<cmath>} rather than the legacy
>       headers such as \file{<math.h>}.  (Headers \file{Rinternals.h} and
>       \file{Rinterface.h} already did, and inclusion of system headers
>       can still be circumvented by defining \code{NO_C_HEADERS},
>       including as from this version for those two headers.)
>
>       The manual has long said that \R{} headers should \bold{not} be
>       included within an \code{extern "C"} block, and almost all the
>       packages affected by this change are doing so.
>
> Hope this is more helpful.
>
> Dan
>
> _______________________________________________
> Bioc-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/bioc-devel



More information about the Bioc-devel mailing list