|
Boost Users : |
Subject: Re: [Boost-users] boost/numeric/ublas/matrix_sparse.hpp does not play well with RICE
From: OvermindDL1 (overminddl1_at_[hidden])
Date: 2010-05-20 18:54:32
On Thu, May 20, 2010 at 4:04 PM, John O. Woods
<john.woods_at_[hidden]> wrote:
> 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')
Try compiling this:
#ifdef ValueType
# undef ValueType
#endif
#ifdef key_equal
# undef key_equal
#endif
#include <boost/unordered_map.hpp>
int main() { return 0; }
If that works, somehow a macro is getting set that should not be set.
If it does not work, that could still be what is happening if the
compiler enforces it. That seems to be the common thing amongst what
you posted for unordered_map. Regardless, it seems kind of like
something is defining some macros. Generate a preprocessed file and
see how it looks.
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