jasonroelofs / rbplusplus

Use rbgccxml and rice to automatically generate Ruby extensions around C++ source and libraries.
MIT License
61 stars 7 forks source link

gccxml_cc1plus: error: gccxml_builtins.h: No such file or directory #14

Closed kpm closed 12 years ago

kpm commented 12 years ago

I'm trying to use c++ code from ruby, http://kheafield.com/code/kenlm/developers/ . I'm getting an error from algorithm:62: which is #including bits/stl_algobase.h. Here is the rbplusplus file and the error follows. I'm not sure if this is a rbplusplus issue, but I don't know how to find out whether it comes from another gem or not.

require 'rubygems'
require 'rbplusplus'
require 'fileutils'
include RbPlusPlus

KENLM_DIR = File.dirname(__FILE__)

Extension.new "kenlm" do |e|
  e.working_dir = File.join(KENLM_DIR, "generated")
  e.sources [
      File.join(KENLM_DIR, "lm/model.hh")
    ],
    :include_paths => KENLM_DIR,
    :include_source_dir => File.join(KENLM_DIR, "lm"),
    :include_source_dir => File.join(KENLM_DIR, "util")

  e.module "Kenlm" do |m|
    node = m.namespace "lm"

    m.module "Ngram" do |ngram|
      node = ngram.namespace "ngram"

      node.classes("TrieModel").use_constructor(
    node.classes("TrieModel").constructors.find(:arguments => [nil])
      )
      node.classes("TrieModel").methods("Score").find(:arguments => [nil, nil, nil]).ignore
    end
  end
end

%ruby kenlm-rbpp.rb (INFO) Parsing ["./lm/model.hh"] gccxml_cc1plus: error: gccxml_builtins.h: No such file or directory In file included from /usr/include/c++/4.6/algorithm:62, from ./util/sorted_uniform.hh:4, from ./lm/bhiksha.hh:22, from ./lm/model.hh:4: /usr/include/c++/4.6/bits/stl_algobase.h: In function '_OI std::copy_move_a(_II, _II, _OI)': /usr/include/c++/4.6/bits/stl_algobase.h:378: error: expected primary-expression before ')' token /usr/include/c++/4.6/bits/stl_algobase.h:378: error: there are no arguments to '__is_trivial' that depend on a template parameter, so a declaration of 'is_trivial' must be available /usr/include/c++/4.6/bits/stl_algobase.h:378: error: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated) /usr/include/c++/4.6/bits/stl_algobase.h:383: error: 'simple' cannot appear in a constant-expression /usr/include/c++/4.6/bits/stl_algobase.h:384: error: template argument 2 is invalid /usr/include/c++/4.6/bits/stl_algobase.h: In function '_BI2 std::copy_move_backward_a(_BI1, _BI1, _BI2)': /usr/include/c++/4.6/bits/stl_algobase.h:573: error: expected primary-expression before ')' token /usr/include/c++/4.6/bits/stl_algobase.h:573: error: there are no arguments to 'is_trivial' that depend on a template parameter, so a declaration of 'is_trivial' must be available /usr/include/c++/4.6/bits/stl_algobase.h:578: error: 'simple' cannot appear in a constant-expression /usr/include/c++/4.6/bits/stl_algobase.h:579: error: template argument 2 is invalid /usr/include/c++/4.6/bits/stl_algobase.h: In function 'typename gnu_cxx::enable_if<(! std::is_scalar<_Tp>::value), _OutputIterator>::type std::fill_n_a(_OutputIterator, _Size, const _Tp&)': /usr/include/c++/4.6/bits/stl_algobase.h:731: error: expected `;' before 'niter' /usr/include/c++/4.6/bits/stl_algobase.h:732: error: 'niter' was not declared in this scope /usr/include/c++/4.6/bits/stl_algobase.h: In function 'typename __gnu_cxx::enable_if<std::is_scalar<_Tp>::value, _OutputIterator>::type std::fill_n_a(_OutputIterator, _Size, const _Tp&)': /usr/include/c++/4.6/bits/stl_algobase.h:743: error: expected;' before '__niter' /usr/include/c++/4.6/bits/stl_algobase.h:744: error: '__niter' was not declared in this scope In file included from /usr/include/c++/4.6/bits/stl_tempbuf.h:61, from /usr/include/c++/4.6/bits/stl_algo.h:64, from /usr/include/c++/4.6/algorithm:63, from ./util/sorted_uniform.hh:4, from ./lm/bhiksha.hh:22, from ./lm/model.hh:4: /usr/include/c++/4.6/bits/stl_construct.h: In function 'void std::_Destroy(_ForwardIterator, _ForwardIterator)': /usr/include/c++/4.6/bits/stl_construct.h:127: error: a function call cannot appear in a constant-expression /usr/include/c++/4.6/bits/stl_construct.h:127: error: template argument 1 is invalid /usr/include/c++/4.6/bits/stl_construct.h:128: error: invalid type in declaration before '(' token /usr/include/c++/4.6/bits/stl_construct.h:128: error: invalid use of qualified-name '::__destroy' In file included from /usr/include/c++/4.6/bits/stl_algo.h:64, from /usr/include/c++/4.6/algorithm:63, from ./util/sorted_uniform.hh:4, from ./lm/bhiksha.hh:22, from ./lm/model.hh:4: /usr/include/c++/4.6/bits/stl_tempbuf.h: In function 'void std::__uninitialized_construct_buf(_ForwardIterator, _ForwardIterator, _Tp&)': /usr/include/c++/4.6/bits/stl_tempbuf.h:240: error: a function call cannot appear in a constant-expression /usr/include/c++/4.6/bits/stl_tempbuf.h:240: error: template argument 1 is invalid /usr/include/c++/4.6/bits/stl_tempbuf.h:241: error: invalid type in declaration before '(' token /usr/include/c++/4.6/bits/stl_tempbuf.h:241: error: invalid use of qualified-name '::__ucr' In file included from /usr/include/c++/4.6/algorithm:63, from ./util/sorted_uniform.hh:4, from ./lm/bhiksha.hh:22, from ./lm/model.hh:4: /usr/include/c++/4.6/bits/stl_algo.h: In function 'void std::__rotate(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, std::random_access_iterator_tag)': /usr/include/c++/4.6/bits/stl_algo.h:1603: error: expected primary-expression before ')' token /usr/include/c++/4.6/bits/stl_algo.h:1603: error: there are no arguments to '__is_pod' that depend on a template parameter, so a declaration of '__is_pod' must be available /usr/include/c++/4.6/bits/stl_algo.h:1626: error: expected primary-expression before ')' token /usr/include/c++/4.6/bits/stl_algo.h:1626: error: there are no arguments to '__is_pod' that depend on a template parameter, so a declaration of '__is_pod' must be available /usr/include/c++/4.6/bits/stl_algo.h: In function '_OIter std::generate_n(_OIter, _Size, _Generator)': /usr/include/c++/4.6/bits/stl_algo.h:4964: error: expected;' before 'niter' /usr/include/c++/4.6/bits/stl_algo.h:4965: error: 'niter' was not declared in this scope In file included from /usr/include/c++/4.6/ios:41, from /usr/include/c++/4.6/istream:40, from /usr/include/c++/4.6/sstream:39, from ./util/exception.hh:5, from ./lm/lm_exception.hh:6, from ./lm/config.hh:6, from ./lm/binary_format.hh:4, from ./lm/model.hh:5: /usr/include/c++/4.6/bits/char_traits.h: In static member function 'static const char std::char_traits::find(const char, std::size_t, const char&)': /usr/include/c++/4.6/bits/char_traits.h:265: error: 'builtin_memchr' was not declared in this scope In file included from /usr/include/c++/4.6/string:43, from /usr/include/c++/4.6/bits/locale_classes.h:42, from /usr/include/c++/4.6/bits/ios_base.h:43, from /usr/include/c++/4.6/ios:43, from /usr/include/c++/4.6/istream:40, from /usr/include/c++/4.6/sstream:39, from ./util/exception.hh:5, from ./lm/lm_exception.hh:6, from ./lm/config.hh:6, from ./lm/binary_format.hh:4, from ./lm/model.hh:5: /usr/include/c++/4.6/bits/allocator.h: At global scope: /usr/include/c++/4.6/bits/allocator.h:151: error: expected primary-expression before ')' token /usr/include/c++/4.6/bits/allocator.h:151: error: there are no arguments to 'is_empty' that depend on a template parameter, so a declaration of 'is_empty' must be available /usr/include/c++/4.6/bits/allocator.h:168: error: expected primary-expression before ')' token /usr/include/c++/4.6/bits/allocator.h:168: error: there are no arguments to '__is_empty' that depend on a template parameter, so a declaration of 'is_empty' must be available In file included from /usr/include/c++/4.6/vector:64, from ./lm/read_arpa.hh:11, from ./lm/binary_format.hh:6, from ./lm/model.hh:5: /usr/include/c++/4.6/bits/stl_uninitialized.h: In function '_ForwardIterator std::uninitialized_copy(_InputIterator, _InputIterator, _ForwardIterator)': /usr/include/c++/4.6/bits/stl_uninitialized.h:117: error: a function call cannot appear in a constant-expression /usr/include/c++/4.6/bits/stl_uninitialized.h:118: error: a function call cannot appear in a constant-expression /usr/include/c++/4.6/bits/stl_uninitialized.h:118: error: template argument 1 is invalid /usr/include/c++/4.6/bits/stl_uninitialized.h: In function 'void std::uninitialized_fill(_ForwardIterator, _ForwardIterator, const _Tp&)': /usr/include/c++/4.6/bits/stl_uninitialized.h:172: error: a function call cannot appear in a constant-expression /usr/include/c++/4.6/bits/stl_uninitialized.h:172: error: template argument 1 is invalid /usr/include/c++/4.6/bits/stl_uninitialized.h:173: error: invalid type in declaration before '(' token /usr/include/c++/4.6/bits/stl_uninitialized.h:173: error: invalid use of qualified-name '::uninit_fill' /usr/include/c++/4.6/bits/stl_uninitialized.h: In function 'void std::uninitialized_fill_n(_ForwardIterator, _Size, const _Tp&)': /usr/include/c++/4.6/bits/stl_uninitialized.h:225: error: a function call cannot appear in a constant-expression /usr/include/c++/4.6/bits/stl_uninitialized.h:225: error: template argument 1 is invalid /usr/include/c++/4.6/bits/stl_uninitialized.h:226: error: invalid type in declaration before '(' token /usr/include/c++/4.6/bits/stl_uninitialized.h:226: error: invalid use of qualified-name '::uninit_fill_n' In file included from /usr/include/c++/4.6/vector:65, from ./lm/read_arpa.hh:11, from ./lm/binary_format.hh:6, from ./lm/model.hh:5: /usr/include/c++/4.6/bits/stl_vector.h: In member function 'void std::vector<_Tp, _Alloc>::swap(std::vector<_Tp, _Alloc>&)': /usr/include/c++/4.6/bits/stl_vector.h:1028: error: there are no arguments to 'is_empty' that depend on a template parameter, so a declaration of 'is_empty' must be available /usr/include/c++/4.6/bits/stl_vector.h:1028: error: 'is_empty' was not declared in this scope /usr/include/c++/4.6/bits/stl_vector.h:1028: error: template argument 2 is invalid /usr/include/c++/4.6/bits/stl_vector.h:1028: error: invalid type in declaration before '(' token In file included from /usr/include/c++/4.6/vector:66, from ./lm/read_arpa.hh:11, from ./lm/binary_format.hh:6, from ./lm/model.hh:5: /usr/include/c++/4.6/bits/stl_bvector.h: In member function 'void std::vector<bool, _Alloc>::swap(std::vector<bool, _Alloc>&)': /usr/include/c++/4.6/bits/stl_bvector.h:765: error: there are no arguments to '__is_empty' that depend on a template parameter, so a declaration of 'is_empty' must be available /usr/include/c++/4.6/bits/stl_bvector.h:765: error: '__is_empty' was not declared in this scope /usr/include/c++/4.6/bits/stl_bvector.h:765: error: template argument 2 is invalid /usr/include/c++/4.6/bits/stl_bvector.h:766: error: invalid type in declaration before '(' token /usr/lib/ruby/gems/1.8/gems/gccxml_gem-0.9.3-x86_64-linux/./gccxml.rb:29:inparse': Error executing gccxml command line: /usr/lib/ruby/gems/1.8/gems/gccxml_gem-0.9.3-x86_64-linux/bin/gccxml -I. ./lm/model.hh -fxml=/tmp/rbgccxml20120319-30302-vnj9cx-0 (RuntimeError) from /usr/lib/ruby/gems/1.8/gems/rbgccxml-1.0.3/lib/rbgccxml/parser.rb:56:inparse' from /usr/lib/ruby/gems/1.8/gems/rbgccxml-1.0.3/lib/rbgccxml/rbgccxml.rb:27:inparse' from /usr/lib/ruby/gems/1.8/gems/rbplusplus-1.0.1/lib/rbplusplus/extension.rb:159:insources' from kenlm-rbpp.rb:10 from /usr/lib/ruby/gems/1.8/gems/rbplusplus-1.0.1/lib/rbplusplus/extension.rb:82:incall' from /usr/lib/ruby/gems/1.8/gems/rbplusplus-1.0.1/lib/rbplusplus/extension.rb:82:ininitialize' from kenlm-rbpp.rb:8:in`new' from kenlm-rbpp.rb:8

jasonroelofs commented 12 years ago

Hmm it seems your GCCXML install isn't able to find important files. What version of gccxml_gem do you have installed right now?

kpm commented 12 years ago

I have this one installed:

gccxml_gem (0.9.3 x86_64-linux)

jasonroelofs commented 12 years ago

Do you have a system-wide GCC-XML install per chance? If so you may be conflicting the version in the gem with your system-wide binary installation.

kpm commented 12 years ago

Yes I do, but only installed it to see if it would help with this issue.

jasonroelofs commented 12 years ago

Hmm if the binary build in the gem wasn't working, you could try using the non-binary version of the gem

gem install gccxml_gem --platform ruby

This will find and use your system-wide install instead, see if that works for you.

kpm commented 12 years ago

That works, thanks! Now I'm only getting ruby-related errors.

btw I'm running on 64bit ubuntu version 11.10 Oneiric. I had no problem with the c++ compiler when compiling the c++ project (except having to install zlib).

jasonroelofs commented 12 years ago

Glad that worked! Let me know if you have any other issues / questions.

senthilkuma commented 9 years ago

hai, i am trying to run Ns3 that time i got thses error related to GCCxml error can you help me to solve this problems?

pygccxml.parser.source_reader.gccxml_runtime_error_t: Error occured while running GCC-XML: gccxml_cc1plus: error: gccxml_builtins.h: No such file or directory

jasonroelofs commented 9 years ago

Your error seems to be from pygccxml, which isn't this project. You should ask over at https://github.com/gccxml/pygccxml instead.