Project

General

Profile

Actions

Bug #942

closed

Build fails on IA-32 Linux with gcc 4.3.2

Added by antares (Michael Klishin) almost 16 years ago. Updated over 13 years ago.

Status:
Closed
Target version:
ruby -v:
Backport:
[ruby-core:20944]

Description

=begin
I have the following build failure on IA-32 on Linux, gcc version is 4.3.2.

Build trace:
https://gist.github.com/9a1ac12553028068a31b

gcc -v:
https://gist.github.com/dae57f2331bc3ebbd268

configure flags:
./configure --program-suffix=1.9.1 --prefix=/usr/local/ruby1.9.1 --enable-debug

This happens on ruby_1_9_1 branch, on the tip.
=end

Actions #1

Updated by mike (Michael Selig) almost 16 years ago

=begin
I reported this on ruby-core last week ([ruby-core:20850] Re: Problems compiling R20933 on Ubuntu 8.10 Linux), expecting a quick reply & fix, but nothing appears to have been done. Here is an extract from it:

FYI

I managed to compile sprintf.c by commenting out the following 4 lines:

#undef vsnprintf
#undef snprintf
#undef HAVE_VSNPRINTF
#undef HAVE_SNPRINTF

Mike
=end

Actions #2

Updated by usa (Usaku NAKAMURA) almost 16 years ago

  • Assignee set to nobu (Nobuyoshi Nakada)

=begin
We know that this is a bug of gcc.
( http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33763 )

nobu is looking for the way to avoid the bug.
=end

Actions #3

Updated by znmeb (Ed Borasky) almost 16 years ago

=begin
Did you capture a log of the entire build process? I'm running a 64-bit Linux with gcc 4.3.2 and it works for me. Here's my build script -- maybe there's a step missing from yours:

#! /bin/bash -v
export DIR='ruby'
rm -fr ${DIR}
svn co http://svn.ruby-lang.org/repos/ruby/trunk ruby
cd ${DIR}
autoconf
./configure --prefix=/home/znmeb/test 2>&1 | tee ../ruby-configure.log
make -j1 2>&1 | tee ../ruby-make.log
make test 2>&1 | tee ../ruby-test.log
make install 2>&1 | tee ../ruby-install.log
cd ..

s> gcc --version
gcc (SUSE Linux) 4.3.2 [gcc-4_3-branch revision 141291]
Copyright (C) 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

=end

Actions #4

Updated by shyouhei (Shyouhei Urabe) almost 16 years ago

=begin
Usaku NAKAMURA wrote:

We know that this is a bug of gcc.
( http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33763 )

And I have a workaround that passes "make test" on my ubuntu intrepid box.

Index: branches/ruby_1_9_1/configure.in

--- branches/ruby_1_9_1/configure.in (revision 21148)
+++ branches/ruby_1_9_1/configure.in (working copy)
@@ -776,6 +776,68 @@
yes) ac_cv_func_erf=no;;
esac

+# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33763
+# Ubuntu intrepid's libc6 2.8~20080505-0ubuntu7 has this problem.
+# Debian GNU/Linux Etch's libc6 2.3.6.ds1-13etch8 has no problem.
+AC_CACHE_CHECK(for broken ``extern inline'' of glibc-2.7,

  • rb_cv_broken_glibc_extern_inline,
  • [AC_TRY_COMPILE([
    +typedef struct
    +{
  • void *a;
  • void *b;
    +} T;
    +extern void *foo (const char *, const char *);
    +extern void *bar (void *, const char *, T);
    +extern int baz (const char *, int);

+extern inline attribute ((always_inline, gnu_inline)) int
+baz (const char *x, int y)
+{

  • return 2;
    +}

+int
+baz (const char *x, int y)
+{

  • return 1;
    +}

+int xa, xb;
+
+static void *
+inl (const char *x, const char *y)
+{

  • T t = { &xa, &xb };
  • int *f = (int *) __builtin_malloc (sizeof (int));
  • const char *z;
  • int o = 0;
  • void *r = 0;
  • for (z = y; *z; z++)
  • {
  •  if (*z == 'r')
    
  •    o |= 1;
    
  •  if (*z == 'w')
    
  •    o |= 2;
    
  • }
  • if (o == 1)
  • *f = baz (x, 0);
  • if (o == 2)
  • *f = baz (x, 1);
  • if (o == 3)
  • *f = baz (x, 2);
  • if (o && *f > 0)
  • r = bar (f, "w", t);
  • return r;
    +}],[inl("x", "y")],
  • rb_cv_broken_glibc_extern_inline=no,
  • rb_cv_broken_glibc_extern_inline=yes)])
    +case $rb_cv_broken_glibc_extern_inline in
  • yes) AC_DEFINE(HAVE_BROKEN_EXTERN_INLINE);;
    +esac

AC_REPLACE_FUNCS(dup2 memmove strerror
strchr strstr crypt flock vsnprintf
isnan finite isinf hypot acosh erf tgamma lgamma_r cbrt
Index: branches/ruby_1_9_1/ChangeLog

--- branches/ruby_1_9_1/ChangeLog (revision 21148)
+++ branches/ruby_1_9_1/ChangeLog (working copy)
@@ -1,3 +1,9 @@
+Mon Dec 29 16:03:03 2008 URABE Shyouhei
+

Sun Dec 28 18:36:33 2008 Yuki Sonoda (Yugui)

* test/rubygems/test_gem_command.rb

Index: branches/ruby_1_9_1/sprintf.c

--- branches/ruby_1_9_1/sprintf.c (revision 21148)
+++ branches/ruby_1_9_1/sprintf.c (working copy)
@@ -25,6 +25,12 @@
#define BITSPERDIG (SIZEOF_BDIGITSCHAR_BIT)
#define EXTENDSIGN(n, l) (((~0 << (n)) >> (((n)
(l)) % BITSPERDIG)) & ~(~0 << (n)))

+#ifdef HAVE_BROKEN_EXTERN_INLINE
+#undef snprintf
+/* [ruby-core:20944] /
+#define snprintf rb_snprintf_evil_gcc4_and_glibc2_7_need_this_f_ing_workaround_
+#endif
+
static void fmt_setup(char
,size_t,int,int,int,int);

static char*
@@ -1082,7 +1088,9 @@

endif

#endif
#undef vsnprintf
+#ifndef HAVE_BROKEN_EXTERN_INLINE
#undef snprintf
+#endif
#define FLOATING_POINT 1
#define BSD__dtoa ruby_dtoa
#undef HAVE_VSNPRINTF

=end

Actions #5

Updated by yugui (Yuki Sonoda) almost 16 years ago

  • Category set to core
  • Target version changed from 1.9.1 Release Candidate to 1.9.1 RC2

=begin

=end

Actions #6

Updated by shyouhei (Shyouhei Urabe) almost 16 years ago

=begin
Michael Selig wrote:

The basic issue here seems to me that "missing/vsnprintf.c" is being
included even though snprintf() & vsnprintf() exist, and there is INHO
an ugly kludge to get this to work. The "proper" Ruby way should be to
change all calls to snprintf() & vsnprintf() to rb_snprintf() &
rb_vsnprintf() if there is a "permanent" Ruby replacement for them. This
wouldn't cause this compiler problem.

We already have rb_sprintf(). This is why sprintf.c exists.

But why do thay need replacing in Linux in the first place?

Because the world is not built on top of Linux. Direct reason why we chose to
include missing/vsnprintf.c rather than to check snprintf sanity in configure,
is that checking itself should go insanely complex. It's much easier for us to
silently ignore system-provided routines. Linux insanity is that it doesn't
give us a chance to ignore glibc's.

Another reason for us to avoid libc-provided fuctions is that we don't want our
printf variants to depend on locales, especially in representing floating point
numbers. Localization mechanisms should be implemented on other layers than
Ruby's core.

=end

Actions #7

Updated by antares (Michael Klishin) almost 16 years ago

=begin
It is resolved now and can be closed, thank you.
=end

Actions #8

Updated by matz (Yukihiro Matsumoto) almost 16 years ago

  • Status changed from Open to Closed

=begin

=end

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0