Boost logo

Boost Users :

Subject: [Boost-users] boost/numeric/ublas/matrix_sparse.hpp does not play well with RICE
From: John O. Woods (john.woods_at_[hidden])
Date: 2010-05-20 12:32:54


Hi there,

Cross-posted this to the RICE listserv, but they cannot reproduce. I can
reproduce it on karmic and lucid (ubuntu), separate machines, in boost
1.43.0. RICE is a C++ interface for Ruby (not unlike boost python).

If I include boost numeric ublas matrix_sparse and either rice/Data_Type.hpp
or rice/Constructor.hpp, I get a lot of errors -- even if I do nothing with
them.

For example, this works:

#include <boost/numeric/ublas/matrix_sparse.hpp>

int main() {
  return 0;
}

So does this:

#include <rice/Data_Type.hpp>

int main() {
  return 0;
}

But if I put both #includes in, it gives the following errors:

$ make
g++ -I. -I. -I/usr/lib/ruby/1.8/i486-linux -I. -D_FILE_OFFSET_BITS=64
-I/usr/lib/ruby/gems/1.8/gems/rice-1.3.2/ruby/lib/include -fPIC
-fno-strict-aliasing -g -g -O2 -fPIC -Wall -g -c main.cpp
In file included from
/usr/local/include/boost/numeric/ublas/storage_sparse.hpp:23,
                 from
/usr/local/include/boost/numeric/ublas/vector_sparse.hpp:16,
                 from
/usr/local/include/boost/numeric/ublas/matrix_sparse.hpp:16,
                 from main.cpp:5:
/usr/local/include/boost/numeric/ublas/storage.hpp:60: error: expected
primary-expression before ‘)’ token
/usr/local/include/boost/numeric/ublas/storage.hpp:65: error: expected
primary-expression before ‘)’ token
/usr/local/include/boost/numeric/ublas/storage.hpp:79: error: expected
primary-expression before ‘)’ token
/usr/local/include/boost/numeric/ublas/storage.hpp: In member function
‘typename ALLOC::size_type boost::numeric::ublas::unbounded_array<T,
ALLOC>::max_size() const’:
/usr/local/include/boost/numeric/ublas/storage.hpp:174: error: expected
primary-expression before ‘)’ token
/usr/local/include/boost/numeric/ublas/storage.hpp:174: error: expected ‘;’
before ‘ruby_xmalloc’
/usr/local/include/boost/numeric/ublas/storage.hpp:174: error: expected
primary-expression before ‘)’ token
/usr/local/include/boost/numeric/ublas/storage.hpp: In member function
‘typename ALLOC::size_type boost::numeric::ublas::bounded_array<T, N,
ALLOC>::max_size() const’:
/usr/local/include/boost/numeric/ublas/storage.hpp:357: error: expected
primary-expression before ‘)’ token
/usr/local/include/boost/numeric/ublas/storage.hpp:357: error: expected ‘;’
before ‘ruby_xmalloc’
/usr/local/include/boost/numeric/ublas/storage.hpp:357: error: expected
primary-expression before ‘)’ token
In file included from
/usr/local/include/boost/numeric/ublas/vector_sparse.hpp:16,
                 from
/usr/local/include/boost/numeric/ublas/matrix_sparse.hpp:16,
                 from main.cpp:5:
/usr/local/include/boost/numeric/ublas/storage_sparse.hpp: At global scope:
/usr/local/include/boost/numeric/ublas/storage_sparse.hpp:240: error:
expected primary-expression before ‘)’ token
make: *** [main.o] Error 1

ruby_xmalloc does not seem to exist in that file, so I gather it's having
some kind of syntax hiccup that is leaking into later #includes.

Here are other relevant details:

$ sudo gem list --local |grep rice
rice (1.3.2, 1.3.1)

I seem to get the same bug with both boost 1.41 and boost 1.43, though
sometimes I have trouble telling which one I'm including.

Should this be a bug report, or am I missing something stupid?

*(I'd be eternally grateful if you'd reply to me as well as to the list.)*

Thanks so much,
John

PS: extconf.rb below. Works fine for other projects, as long as I don't use
matrix_sparse.

require 'rubygems'
require 'mkmf-rice'

dir_config("boost")

have_library("stdc++")
have_library("boost")
have_library("boost_filesystem")
if RUBY_VERSION =~ /1.9/ then
  $CPPFLAGS += " -DRUBY_19"
end

create_makefile('main')

--
John Woods
Marcotte Lab
Center for Systems and Synthetic Biology
The University of Texas at Austin


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net