[Rcpp-devel] Strange compiler error when using boost uBLAS on Ubuntu 11.04

Douglas Bates bates at stat.wisc.edu
Tue Jun 7 19:44:45 CEST 2011


Sorry to take so long to respond.

On Sat, Jun 4, 2011 at 12:26 PM, Dirk Eddelbuettel <edd at debian.org> wrote:
>
> On 4 June 2011 at 11:52, Douglas Bates wrote:
> | With
> |
> | > sessionInfo()
> | R version 2.14.0 Under development (unstable) (2011-05-26 r55995)
> | Platform: x86_64-unknown-linux-gnu (64-bit)
> |
> | locale:
> |  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
> |  [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
> |  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
> |  [7] LC_PAPER=C                 LC_NAME=C
> |  [9] LC_ADDRESS=C               LC_TELEPHONE=C
> | [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
> |
> | attached base packages:
> | [1] stats     graphics  grDevices utils     datasets  methods   base
> |
> | other attached packages:
> | [1] Rcpp_0.9.4.1 inline_0.3.8
> |
> | loaded via a namespace (and not attached):
> | [1] tools_2.14.0
> |
> | and
> |
> | $ g++ --version
> | g++ (Ubuntu/Linaro 4.5.2-8ubuntu4) 4.5.2
> | $ wajig list libboost-dev
> | ii  libboost-dev                   1.42.0.1ubuntu1
> | Boost C++ Libraries development files (default version)
> |
> | I get a strange compiler error when trying to compile the "Hello
> | World" example of the coordinate_matrix representation from Boost's
> | uBLAS, as shown in the enclosed.  The first two examples (the
> | mapped_matrix and the compressed_matrix) compile for me but the third
> | and the fourth don't.  The error I get is
> |
> | Error in compileCode(f, code, language = language, verbose = verbose) :
> |   Compilation ERROR, function(s)/method(s) not created! In file
> | included from /usr/include/c++/4.5/bits/stl_algo.h:63:0,
> |                  from /usr/include/c++/4.5/algorithm:63,
> |                  from
> | /home/bates/R/x86_64-unknown-linux-gnu-library/2.14/Rcpp/include/RcppCommon.h:121,
> |                  from
> | /home/bates/R/x86_64-unknown-linux-gnu-library/2.14/Rcpp/include/Rcpp.h:27,
> |                  from file6b444b24.cpp:4:
> | /usr/include/c++/4.5/bits/stl_tempbuf.h: In constructor
> | ‘std::_Temporary_buffer<_ForwardIterator,
> | _Tp>::_Temporary_buffer(_ForwardIterator, _ForwardIterator) [with
> | _ForwardIterator =
> | boost::numeric::ublas::indexed_iterator<boost::numeric::ublas::index_triple_array<std::vector<long
> | unsigned int>, std::vector<long unsigned int>, std::vector<double> >,
> | std::random_access_iterator_tag>, _Tp =
> | boost::numeric::ublas::index_triple<boost::numeric::ublas::index_triple_array<std::vector<long
> | unsigned int>, std::vector<long unsigned int>, std::vector<double> >
> | >]’:
> | /usr
> | In addition: Warning message:
> | running command '/home/bates/build/R-devel/bin/R CMD SHLIB
> | file6b444b24.cpp 2> file6b444b24.cpp.err.txt' had status 1
> |
> | Do others get this error for other versions of boost or other compilers?
>
> Yes, confirmed. Examples one and two build, three and four puke.
>
> Can you try them without Rcpp to see if there is a side-effect?

I did so. Trying to compile the example section of
http://www.boost.org/doc/libs/1_46_1/libs/numeric/ublas/doc/matrix_sparse.htm#coordinate_matrix

produces


$ g++ -O3 -g0 foo.cpp -o foo
In file included from /usr/include/c++/4.5/bits/stl_algo.h:63:0,
                 from /usr/include/c++/4.5/algorithm:63,
                 from /usr/include/boost/utility/swap.hpp:24,
                 from /usr/include/boost/swap.hpp:10,
                 from /usr/include/boost/array.hpp:37,
                 from /usr/include/boost/serialization/array.hpp:26,
                 from /usr/include/boost/numeric/ublas/storage_sparse.hpp:19,
                 from /usr/include/boost/numeric/ublas/vector_sparse.hpp:16,
                 from /usr/include/boost/numeric/ublas/matrix_sparse.hpp:16,
                 from foo.cpp:1:
/usr/include/c++/4.5/bits/stl_tempbuf.h: In constructor
‘std::_Temporary_buffer<_ForwardIterator,
_Tp>::_Temporary_buffer(_ForwardIterator, _ForwardIterator) [with
_ForwardIterator =
boost::numeric::ublas::indexed_iterator<boost::numeric::ublas::index_triple_array<boost::numeric::ublas::unbounded_array<long
unsigned int>, boost::numeric::ublas::unbounded_array<long unsigned
int>, boost::numeric::ublas::unbounded_array<double,
std::allocator<double> > >, std::random_access_iterator_tag>, _Tp =
boost::numeric::ublas::index_triple<boost::numeric::ublas::index_triple_array<boost::numeric::ublas::unbounded_array<long
unsigned int>, boost::numeric::ublas::unbounded_array<long unsigned
int>, boost::numeric::ublas::unbounded_array<double,
std::allocator<double> > > >]’:
/usr/include/c++/4.5/bits/stl_algo.h:3084:17:   instantiated from
‘void std::inplace_merge(_BIter, _BIter, _BIter) [with _BIter =
boost::numeric::ublas::indexed_iterator<boost::numeric::ublas::index_triple_array<boost::numeric::ublas::unbounded_array<long
unsigned int>, boost::numeric::ublas::unbounded_array<long unsigned
int>, boost::numeric::ublas::unbounded_array<double,
std::allocator<double> > >, std::random_access_iterator_tag>]’
/usr/include/boost/numeric/ublas/matrix_sparse.hpp:4387:17:
instantiated from ‘void boost::numeric::ublas::coordinate_matrix<T, L,
IB, IA, TA>::sort() const [with T = double, L =
boost::numeric::ublas::basic_row_major<>, long unsigned int IB = 0ul,
IA = boost::numeric::ublas::unbounded_array<long unsigned int>, TA =
boost::numeric::ublas::unbounded_array<double, std::allocator<double>
>]’
/usr/include/boost/numeric/ublas/matrix_sparse.hpp:4174:13:
instantiated from ‘const T*
boost::numeric::ublas::coordinate_matrix<T, L, IB, IA,
TA>::find_element(boost::numeric::ublas::coordinate_matrix<T, L, IB,
IA, TA>::size_type, boost::numeric::ublas::coordinate_matrix<T, L, IB,
IA, TA>::size_type) const [with T = double, L =
boost::numeric::ublas::basic_row_major<>, long unsigned int IB = 0ul,
IA = boost::numeric::ublas::unbounded_array<long unsigned int>, TA =
boost::numeric::ublas::unbounded_array<double, std::allocator<double>
>, const T* = const double*,
boost::numeric::ublas::coordinate_matrix<T, L, IB, IA, TA>::size_type
= long unsigned int]’
/usr/include/boost/numeric/ublas/matrix_sparse.hpp:4192:49:
instantiated from ‘const T&
boost::numeric::ublas::coordinate_matrix<T, L, IB, IA,
TA>::operator()(boost::numeric::ublas::coordinate_matrix<T, L, IB, IA,
TA>::size_type, boost::numeric::ublas::coordinate_matrix<T, L, IB, IA,
TA>::size_type) const [with T = double, L =
boost::numeric::ublas::basic_row_major<>, long unsigned int IB = 0ul,
IA = boost::numeric::ublas::unbounded_array<long unsigned int>, TA =
boost::numeric::ublas::unbounded_array<double, std::allocator<double>
>, const T& = const double&,
boost::numeric::ublas::coordinate_matrix<T, L, IB, IA, TA>::size_type
= long unsigned int]’
/usr/include/boost/numeric/ublas/io.hpp:96:17:   instantiated from
‘std::basic_ostream<_CharT, _Traits>&
boost::numeric::ublas::operator<<(std::basic_ostream<_CharT,
_Traits>&, const boost::numeric::ublas::matrix_expression<E2>&) [with
E = char, T = std::char_traits<char>, ME =
boost::numeric::ublas::coordinate_matrix<double>]’
foo.cpp:10:18:   instantiated from here
/usr/include/c++/4.5/bits/stl_tempbuf.h:192:6: error: invalid
initialization of non-const reference of type
‘boost::numeric::ublas::index_triple<boost::numeric::ublas::index_triple_array<boost::numeric::ublas::unbounded_array<long
unsigned int>, boost::numeric::ublas::unbounded_array<long unsigned
int>, boost::numeric::ublas::unbounded_array<double,
std::allocator<double> > > >&’ from an rvalue of type
‘boost::numeric::ublas::indexed_iterator<boost::numeric::ublas::index_triple_array<boost::numeric::ublas::unbounded_array<long
unsigned int>, boost::numeric::ublas::unbounded_array<long unsigned
int>, boost::numeric::ublas::unbounded_array<double,
std::allocator<double> > >,
std::random_access_iterator_tag>::reference’
/usr/include/c++/4.5/bits/stl_uninitialized.h:223:5: error: in passing
argument 3 of ‘void
std::__uninitialized_construct_range(_ForwardIterator,
_ForwardIterator, _Tp&) [with _ForwardIterator =
boost::numeric::ublas::index_triple<boost::numeric::ublas::index_triple_array<boost::numeric::ublas::unbounded_array<long
unsigned int>, boost::numeric::ublas::unbounded_array<long unsigned
int>, boost::numeric::ublas::unbounded_array<double,
std::allocator<double> > > >*, _Tp =
boost::numeric::ublas::index_triple<boost::numeric::ublas::index_triple_array<boost::numeric::ublas::unbounded_array<long
unsigned int>, boost::numeric::ublas::unbounded_array<long unsigned
int>, boost::numeric::ublas::unbounded_array<double,
std::allocator<double> > > >]’

which answers one of my original questions about the trailing '/usr'.
It resulted from truncation of the messages.

Strangely I can't find other reports of this problem on the ublas or
ubuntu lists.


More information about the Rcpp-devel mailing list