Skip to content

[Rcpp-devel] Experiences with clang/llvm compilation of Rcpp-based code on Debian-based distributions

4 messages · Douglas Bates, Dirk Eddelbuettel

#
(Apologies for cross-posting but my request relates to both R/C++ and
to Debian-based platforms.)

I was recently compiling Rcpp-based code on an Ubuntu system and had a
syntax error that produced a page or two of complicated error
messages.  A developer who main platform is a Mac said that the
compilers in clang/llvm provided more focussed and comprehensible
error messages.

Has anyone tried compiling C++ code using Rcpp with clang++ on
Debian-based systems?  If so, what are your experiences?
#
On 29 August 2011 at 12:55, Douglas Bates wrote:
| (Apologies for cross-posting but my request relates to both R/C++ and
| to Debian-based platforms.)

(I'm keeping this on rcpp-devel as it is more compiler than distro related.)
 
| I was recently compiling Rcpp-based code on an Ubuntu system and had a
| syntax error that produced a page or two of complicated error
| messages.  A developer who main platform is a Mac said that the
| compilers in clang/llvm provided more focussed and comprehensible
| error messages.
| 
| Has anyone tried compiling C++ code using Rcpp with clang++ on
| Debian-based systems?  If so, what are your experiences?

Well, let's see -- we learned that a large and well known "internet company"
on the west coast, which also runs a rather popular search engine by the same
name (hint, hint) has been using llvm/clang alongside g++.  We even got some
patches for Rcpp and related projects (RInside, RProtoBuf) which we were glad
to integrate.  I cannot speak for them and would encourage them to post their
experiences here.

Given that, I was also curious but only tried very naively and very briefly,
and failed (on my default Ubuntu machine). Seems like it is not as easy as
'just' replacing the CXX variable.   

Anybody with more experience using clang++/llvm on Rcpp's code base please
share your tips and tricks.

Dirk
#
On Mon, Aug 29, 2011 at 1:16 PM, Dirk Eddelbuettel <edd at debian.org> wrote:
On Ubuntu 11.04 even the patched clang package still appears to have
some peculiarities behavior. It looks for the system-wide include
files in /usr/include/c++/4.4 and not /usr/include/c++/4.5, even
though 4.5 is the default version of gcc on these systems.  The
clang++ compiler complained about constructions in
/usr/include/4.4/type_traits whether or not I used -std=c++0x

I'll see if I can convince clang++ to use /usr/include/c++/4.5 instead
of 4.4.  Or I suppose I could wait until the end of the week and
install Ubuntu 11.11 beta1 on an unused partition and try the 2.9
series of clang/llvm
#
On Mon, Aug 29, 2011 at 1:37 PM, Douglas Bates <bates at stat.wisc.edu> wrote:
Following up on my own post, clang++ doesn't like the
/usr/include/c++/4.5/type_traits header either.  If complains about a
construction that doesn't make sense to me but apparently is accepted
by g++

...
In file included from /usr/include/c++/4.5/iterator:63:
In file included from /usr/include/c++/4.5/bits/stl_iterator.h:66:
In file included from /usr/include/c++/4.5/bits/move.h:38:
In file included from /usr/include/c++/4.5/type_traits:50:
/usr/include/c++/4.5/tr1_impl/type_traits:230:41: error: expected ')'
    struct is_function<_Res(_ArgTypes......)>
                                        ^
I don't know what the ...... construction is but it occurs several
times in that file.