Project

General

Profile

Actions

Bug #10710

closed

can't compile ruby 2.2.0 with gcc versions older than 4.4.0

Added by drkaes (Stefan Kaes) almost 10 years ago. Updated about 7 years ago.

Status:
Closed
Target version:
-
[ruby-core:67397]

Description

compilation stops because gcc before 4.4.0 does not support the flag -Wno-packed-bitfield-compat.

patch can be found here: https://github.com/skaes/rvm-patchsets/blob/master/patches/ruby/2.2.0/railsexpress/05-fix-packed-bitfield-compat-warning-for-older-gccs.patch


Files

Updated by normalperson (Eric Wong) almost 10 years ago

wrote:

compilation stops because gcc before 4.4.0 does not support the flag
-Wno-packed-bitfield-compat.

I'm curious what error you saw. An ancient CentOS 5.4 x86-64 machine
managed to build it using: gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-46)

--- a/configure.in
+++ b/configure.in
@@ -788,6 +788,9 @@ rb_cv_warnflags="$warnflags"
 if test "$GCC:${warnflags+set}:no" = yes::no; then
     if test $gcc_major -ge 4; then
 	extra_warning=-Werror=extra-tokens
+        if test $gcc_major -gt 4 -o $gcc_minor -ge 4; then
+            extra_warning="$extra_warning -Wno-packed-bitfield-compat"
+        fi

I think "||" is preferable to "-o" for portability. But maybe not a
problem nowadays...

Updated by drkaes (Stefan Kaes) almost 10 years ago

$ gcc --version
gcc (Debian 4.3.2-1.1) 4.3.2

The compilation of a given source file fails as soon as the compiler needs to emit some warning:

gcc -Wno-packed-bitfield-compat some_warning.c
some_warning.c: In function ‘main’:
some_warning.c:3: warning: return type of ‘main’ is not ‘int’
At top level:
cc1: error: unrecognized command line option "-Wno-packed-bitfield-compat"

Updated by normalperson (Eric Wong) almost 10 years ago

The compilation of a given source file fails as soon as the compiler
needs to emit some warning:

Right, but ./configure detects that failure, disables the
-Wno-packed-bitfield-compat switch, and the rest of the build continues
without it, right?

Updated by drkaes (Stefan Kaes) almost 10 years ago

no. it aborts the build.

Updated by nobu (Nobuyoshi Nakada) almost 10 years ago

  • Status changed from Open to Feedback

Could you show your config.log file, around checking -Wno-packed-bitfield-compat?

Updated by drkaes (Stefan Kaes) almost 10 years ago

the problem is that the compiler accepts the warning flag but fails to compile a piece of code as soon as it tries to emit some warning.

configure:7495: checking whether -Wno-packed-bitfield-compat is accepted as CFLAGS
configure:7518: gcc -c -g -O2  -Wno-packed-bitfield-compat  conftest.c >&5
configure:7518: $? = 0
configure:7533: result: yes

Updated by drkaes (Stefan Kaes) almost 10 years ago

here's the build output:

~/src/ruby-2.2.0 $ make
	CC = gcc
	LD = ld
	LDSHARED = gcc -shared
	CFLAGS = -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -Wdeprecated-declarations -Wno-packed-bitfield-compat -std=iso9899:1999  -fPIC 
	XCFLAGS = -D_FORTIFY_SOURCE=2 -fstack-protector -fno-strict-overflow -fvisibility=hidden -DRUBY_EXPORT
	CPPFLAGS =   -I. -I.ext/include/x86_64-linux -I./include -I.
	DLDFLAGS = -Wl,-soname,libruby.so.2.2  -fstack-protector  
	SOLIBS = -lpthread -lrt -lgmp -ldl -lcrypt -lm  
Using built-in specs.
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.3.2-1.1' --with-bugurl=file:///usr/share/doc/gcc-4.3/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.3 --program-suffix=-4.3 --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --enable-mpfr --enable-cld --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.3.2 (Debian 4.3.2-1.1) 
compiling main.c
compiling dmydln.c
compiling miniinit.c
compiling miniprelude.c
copying dummy probes.h
compiling array.c
compiling bignum.c
bignum.c: In function ‘rb_absint_numwords’:
bignum.c:3370: warning: ‘nlz_bits’ may be used uninitialized in this function
At top level:
cc1: error: unrecognized command line option "-Wno-packed-bitfield-compat"
make: *** [bignum.o] Error 1

Updated by drkaes (Stefan Kaes) about 7 years ago

  • Status changed from Feedback to Closed

no longer relevant

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0