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

0.0.6 build fails for ruby 1.8.7 with gcc 4.8.2 #8

Closed
jhoblitt opened this issue May 28, 2014 · 1 comment
Closed

0.0.6 build fails for ruby 1.8.7 with gcc 4.8.2 #8

jhoblitt opened this issue May 28, 2014 · 1 comment

Comments

@jhoblitt
Copy link

I've been unable to build 0.0.6 (or any earlier version) on Fedora 20 for ruby 1.8.7 with gcc 4.8.2. gcc 4.8.2 + ruby 2.0.0 builds as expected. I used a Gentoo box and was able to get 0.0.6 to build for ruby 1.8.7 using gcc 4.7.2.

gcc version (fedora 20):

$ gcc -v
Using built-in specs.
COLLECT_GCC=/usr/bin/gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.8.2/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin --enable-initfini-array --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-isl=/builddir/build/BUILD/gcc-4.8.2-20131212/obj-x86_64-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.8.2-20131212/obj-x86_64-redhat-linux/cloog-install --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.8.2 20131212 (Red Hat 4.8.2-7) (GCC) 

Build error:

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

    /home/jhoblitt/.rvm/rubies/ruby-1.8.7-p374/bin/ruby extconf.rb 
checking for main() in -lstdc++... yes
checking for ruby/encoding.h... yes
creating Makefile
CXX is automatically set to g++

make
g++ -I. -I. -I/home/jhoblitt/.rvm/rubies/ruby-1.8.7-p374/lib/ruby/1.8/x86_64-linux -I. -DHAVE_RUBY_ENCODING_H    -fPIC -O2 -fno-tree-dce -fno-optimize-sibling-calls  -fPIC    -c unf.cc
In file included from unf.cc:5:0:
/usr/include/ruby/encoding.h:102:68: error: expected identifier before numeric constant
 PRINTF_ARGS(VALUE rb_enc_sprintf(rb_encoding *, const char*, ...), 2, 3);
                                                                    ^
/usr/include/ruby/encoding.h:102:68: error: expected ‘,’ or ‘...’ before numeric constant
/usr/include/ruby/encoding.h:102:73: error: expected constructor, destructor, or type conversion before ‘;’ token
 PRINTF_ARGS(VALUE rb_enc_sprintf(rb_encoding *, const char*, ...), 2, 3);
                                                                         ^
/usr/include/ruby/encoding.h:115:99: error: expected identifier before numeric constant
 PRINTF_ARGS(NORETURN(void rb_enc_raise(rb_encoding *, VALUE, const char*, ...)), 3, 4);
                                                                                                   ^
/usr/include/ruby/encoding.h:115:99: error: expected ‘,’ or ‘...’ before numeric constant
/usr/include/ruby/encoding.h:115:104: error: expected constructor, destructor, or type conversion before ‘;’ token
 PRINTF_ARGS(NORETURN(void rb_enc_raise(rb_encoding *, VALUE, const char*, ...)), 3, 4);
                                                                                                        ^
In file included from unf.cc:5:0:
/usr/include/ruby/encoding.h:216:65: error: declaration of C function ‘long int rb_memsearch(const void*, long int, const void*, long int, rb_encoding*)’ conflicts with
 long rb_memsearch(const void*,long,const void*,long,rb_encoding*);
                                                                 ^
In file included from /home/jhoblitt/.rvm/rubies/ruby-1.8.7-p374/lib/ruby/1.8/x86_64-linux/ruby.h:756:0,
                 from unf.cc:3:
/home/jhoblitt/.rvm/rubies/ruby-1.8.7-p374/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
 long rb_memsearch _((const void*,long,const void*,long));
      ^
make: *** [unf.o] Error 1


Gem files will remain installed in /home/jhoblitt/github/puppetlabs-concat/.bundle/ruby/1.8/gems/unf_ext-0.0.6 for inspection.
Results logged to /home/jhoblitt/github/puppetlabs-concat/.bundle/ruby/1.8/gems/unf_ext-0.0.6/ext/unf_ext/gem_make.out
An error occurred while installing unf_ext (0.0.6), and Bundler cannot continue.
Make sure that `gem install unf_ext -v '0.0.6'` succeeds before bundling.
@knu
Copy link
Owner

knu commented Apr 11, 2017

Sorry for replying too late. It looks like the compiler is using header files for ruby >=1.9, because ruby/encoding.h first appeared in ruby 1.9.1. I know the ruby-devel package inappropriately installs the header files directly under the system include directory, and it didn't get a fix before its EOL. You either need to temporarily uninstall ruby-devel or specify --with-opt-include=/path/to/ruby/1.8/headers, I suppose.

@knu knu closed this as completed Apr 11, 2017
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