|
Boost Users : |
Subject: Re: [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 18:04:42
I posted earlier today, and I think now that the problem might not be RICE
at all. I just tried to compile something that I *know* should compile
properly, which does not use RICE, and it didn't work with a *different* boost
library (in this case <boost/unordered_map.hpp>).
I'm not really sure how to troubleshoot this. I know I upgraded recently
from boost 1.41 to 1.43, but I can't see how that would be the issue.
Perhaps I somehow have multiple versions of boost hidden here and there and
it's trying to use the headers from one but libraries from another?
For example, compiling this file:
#include <boost/unordered_map.hpp>
int main() { return 0; }
Gives these errors:
$ g++ -I. -I. -I/usr/lib/ruby/1.8/i486-linux -I. -D_FILE_OFFSET_BITS=64
-fPIC -fno-strict-aliasing -g -g -O2 -fPIC -Wall -g -c main.cppIn file
included from /usr/local/include/boost/unordered/detail/equivalent.hpp:11,
from
/usr/local/include/boost/unordered/unordered_map.hpp:19,
from /usr/local/include/boost/unordered_map.hpp:16,
from main.cpp:4:
/usr/local/include/boost/unordered/detail/extract_key.hpp:31: error:
template argument required for struct set_extractor
/usr/local/include/boost/unordered/detail/extract_key.hpp:77: error:
template argument required for struct map_extractor
In file included from
/usr/local/include/boost/unordered/unordered_map.hpp:19,
from /usr/local/include/boost/unordered_map.hpp:16,
from main.cpp:4:
/usr/local/include/boost/unordered/detail/equivalent.hpp:19: error: wrong
number of template arguments (4, should be 1)
/usr/local/include/boost/unordered/detail/fwd.hpp:661: error: provided for
template<class T> class boost::unordered_detail::hash_equivalent_table
(continues for a few pages)
It does not do this with all boost libraries. I have no problems with
lexical_cast.
Grateful for any assistance,
John
On Thu, May 20, 2010 at 11:32 AM, John O. Woods
<john.woods_at_[hidden]>wrote:
> 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