Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error compiling on Ruby 1.8.7 #5

Closed
postmodern opened this issue Jun 19, 2013 · 11 comments
Closed

Error compiling on Ruby 1.8.7 #5

postmodern opened this issue Jun 19, 2013 · 11 comments

Comments

@postmodern
Copy link

g++ -I. -I. -I/opt/rubies/ruby-1.8.7-p371/lib/ruby/1.8/x86_64-linux -I. -DHAVE_RUBY_ENCODING_H    -fPIC -g -O2    -c unf.cc
In file included from unf.cc:5:0:
/usr/include/ruby/encoding.h:101:68: error: expected identifier before numeric constant
/usr/include/ruby/encoding.h:101:68: error: expected ‘,’ or ‘...’ before numeric constant
/usr/include/ruby/encoding.h:101:73: error: expected constructor, destructor, or type conversion before ‘;’ token
In file included from unf.cc:5:0:
/usr/include/ruby/encoding.h:213:65: error: declaration of C function ‘long int rb_memsearch(const void*, long int, const void*, long int, rb_encoding*)’ conflicts with
In file included from /opt/rubies/ruby-1.8.7-p371/lib/ruby/1.8/x86_64-linux/ruby.h:756:0,
                 from unf.cc:3:
/opt/rubies/ruby-1.8.7-p371/lib/ruby/1.8/x86_64-linux/intern.h:387:6: error: previous declaration ‘long int rb_memsearch(const void*, long int, const void*, long int)’ here
make: *** [unf.o] Error 1

It does successfully build on Ruby 1.9.3. I would be OK if unf_ext set gemspec.required_ruby_version to >= 1.9.1.

@knu
Copy link
Owner

knu commented Jun 19, 2013

Having /usr/include/ruby/encoding.h is unusual and it seems something is seriously broken with your installation.
Ruby's header files should be placed inside each version specific directory and must not be globally exposed.

@knu
Copy link
Owner

knu commented Jun 19, 2013

Solution: Just remove /usr/include/ruby/. If it was installed by some package, ask the vendor to fix it.

@knu knu closed this as completed Jun 19, 2013
@knu
Copy link
Owner

knu commented Jun 19, 2013

Maybe there are also /usr/include/ruby.h and /usr/lib/libruby*, which may as well be moved away.

@postmodern
Copy link
Author

Ah ha! I have ruby 1.8.7 installed into /opt/rubies/ruby-1.8.7-p371. For some reason extconf isn't finding it's headers, but instead using system's ruby headers.

@postmodern
Copy link
Author

Ah there is no encoding.h in /opt/rubies/ruby-1.8.7-p371/lib/ruby/1.8/x86_64-linux/.

@knu
Copy link
Owner

knu commented Jun 19, 2013

ruby/encoding.h was introduced in ruby 1.9.

And ruby never installs its header files directly under /usr/include unless wrongly configured.

@postmodern
Copy link
Author

It appears have_header('ruby/encoding.h') in ext/unf/extconf.rb is causing -DHAVE_RUBY_ENCODING_H to be passed in, and thus ruby/encoding.h get's included in. You should probably also check the version of Ruby, since ruby/encoding.h should never be included for Ruby 1.8.x.

@knu
Copy link
Owner

knu commented Jun 19, 2013

This is a bug of the ruby-devel rpm. I'll bug report the issue when I feel like it.
There are many other modules that do have_header("ruby/...") in their extconf.rb, so it doesn't help if I only "fix" my module.

@postmodern
Copy link
Author

Confirmed. I renamed /usr/include/ruby to /usr/include/ruby-1.9.1 and the module compiled.

@knu
Copy link
Owner

knu commented Jun 19, 2013

Just filed a bug report: https://bugzilla.redhat.com/show_bug.cgi?id=245446

Thanks for the report. I wouldn't notice the issue if it weren't for this.

@knu
Copy link
Owner

knu commented Jul 15, 2013

The URL I posted above was a wrong one. Follow this instead: https://bugzilla.redhat.com/show_bug.cgi?id=975660

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants