https://redmine.ruby-lang.org/https://redmine.ruby-lang.org/favicon.ico?17113305112008-12-29T13:07:06ZRuby Issue Tracking SystemRuby master - Bug #942: Build fails on IA-32 Linux with gcc 4.3.2https://redmine.ruby-lang.org/issues/942?journal_id=24042008-12-29T13:07:06Zmike (Michael Selig)michael_selig@fs.com.au
<ul></ul><p>=begin<br>
I reported this on ruby-core last week (<a href="https://blade.ruby-lang.org/ruby-core/20850">[ruby-core:20850]</a> 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:</p>
<blockquote>
<p>FYI</p>
<p>I managed to compile sprintf.c by commenting out the following 4 lines:</p>
<p>#undef vsnprintf<br>
#undef snprintf<br>
#undef HAVE_VSNPRINTF<br>
#undef HAVE_SNPRINTF</p>
<p>Mike<br>
=end</p>
</blockquote> Ruby master - Bug #942: Build fails on IA-32 Linux with gcc 4.3.2https://redmine.ruby-lang.org/issues/942?journal_id=24052008-12-29T13:56:52Zusa (Usaku NAKAMURA)usa@garbagecollect.jp
<ul><li><strong>Assignee</strong> set to <i>nobu (Nobuyoshi Nakada)</i></li></ul><p>=begin<br>
We know that this is a bug of gcc.<br>
( <a href="http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33763" class="external">http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33763</a> )</p>
<p>nobu is looking for the way to avoid the bug.<br>
=end</p> Ruby master - Bug #942: Build fails on IA-32 Linux with gcc 4.3.2https://redmine.ruby-lang.org/issues/942?journal_id=24062008-12-29T13:58:17Zznmeb (Ed Borasky)znmeb@cesmail.net
<ul></ul><p>=begin<br>
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:</p>
<p>#! /bin/bash -v<br>
export DIR='ruby'<br>
rm -fr ${DIR}<br>
svn co <a href="http://svn.ruby-lang.org/repos/ruby/trunk" class="external">http://svn.ruby-lang.org/repos/ruby/trunk</a> ruby<br>
cd ${DIR}<br>
autoconf<br>
./configure --prefix=/home/znmeb/test 2>&1 | tee ../ruby-configure.log<br>
make -j1 2>&1 | tee ../ruby-make.log<br>
make test 2>&1 | tee ../ruby-test.log<br>
make install 2>&1 | tee ../ruby-install.log<br>
cd ..</p>
<p>s> gcc --version<br>
gcc (SUSE Linux) 4.3.2 [gcc-4_3-branch revision 141291]<br>
Copyright (C) 2008 Free Software Foundation, Inc.<br>
This is free software; see the source for copying conditions. There is NO<br>
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</p>
<p>=end</p> Ruby master - Bug #942: Build fails on IA-32 Linux with gcc 4.3.2https://redmine.ruby-lang.org/issues/942?journal_id=24162008-12-29T16:43:50Zshyouhei (Shyouhei Urabe)shyouhei@ruby-lang.org
<ul></ul><p>=begin<br>
Usaku NAKAMURA wrote:</p>
<blockquote>
<p>We know that this is a bug of gcc.<br>
( <a href="http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33763" class="external">http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33763</a> )</p>
</blockquote>
<p>And I have a workaround that passes "make test" on my ubuntu intrepid box.</p>
<a name="Index-branchesruby_1_9_1configurein"></a>
<h1 >Index: branches/ruby_1_9_1/configure.in<a href="#Index-branchesruby_1_9_1configurein" class="wiki-anchor">¶</a></h1>
<p>--- branches/ruby_1_9_1/configure.in (revision 21148)<br>
+++ branches/ruby_1_9_1/configure.in (working copy)<br>
@@ -776,6 +776,68 @@<br>
yes) ac_cv_func_erf=no;;<br>
esac</p>
<p>+# <a href="http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33763" class="external">http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33763</a><br>
+# Ubuntu intrepid's libc6 2.8~20080505-0ubuntu7 has this problem.<br>
+# Debian GNU/Linux Etch's libc6 2.3.6.ds1-13etch8 has no problem.<br>
+AC_CACHE_CHECK(for broken ``extern inline'' of glibc-2.7,</p>
<ul>
<li>rb_cv_broken_glibc_extern_inline,</li>
<li>[AC_TRY_COMPILE([<br>
+typedef struct<br>
+{</li>
<li>void *a;</li>
<li>void *b;<br>
+} T;<br>
+extern void *foo (const char *, const char *);<br>
+extern void *bar (void *, const char *, T);<br>
+extern int baz (const char *, int);</li>
<li>
</ul>
<p>+extern inline <strong>attribute</strong> ((always_inline, gnu_inline)) int<br>
+baz (const char *x, int y)<br>
+{</p>
<ul>
<li>return 2;<br>
+}</li>
<li>
</ul>
<p>+int<br>
+baz (const char *x, int y)<br>
+{</p>
<ul>
<li>return 1;<br>
+}</li>
<li>
</ul>
<p>+int xa, xb;<br>
+<br>
+static void *<br>
+inl (const char *x, const char *y)<br>
+{</p>
<ul>
<li>T t = { &xa, &xb };</li>
<li>int *f = (int *) __builtin_malloc (sizeof (int));</li>
<li>const char *z;</li>
<li>int o = 0;</li>
<li>void *r = 0;</li>
<li>
<li>for (z = y; *z; z++)</li>
<li>{</li>
<li>
<pre><code> if (*z == 'r')
</code></pre>
</li>
<li>
<pre><code> o |= 1;
</code></pre>
</li>
<li>
<pre><code> if (*z == 'w')
</code></pre>
</li>
<li>
<pre><code> o |= 2;
</code></pre>
</li>
<li>}</li>
<li>if (o == 1)</li>
<li>*f = baz (x, 0);</li>
<li>if (o == 2)</li>
<li>*f = baz (x, 1);</li>
<li>if (o == 3)</li>
<li>*f = baz (x, 2);</li>
<li>
<li>if (o && *f > 0)</li>
<li>r = bar (f, "w", t);</li>
<li>return r;<br>
+}],[inl("x", "y")],</li>
<li>rb_cv_broken_glibc_extern_inline=no,</li>
<li>rb_cv_broken_glibc_extern_inline=yes)])<br>
+case $rb_cv_broken_glibc_extern_inline in</li>
<li>yes) AC_DEFINE(HAVE_BROKEN_EXTERN_INLINE);;<br>
+esac</li>
<li>
</ul>
<h1>AC_REPLACE_FUNCS(dup2 memmove strerror<br>
strchr strstr crypt flock vsnprintf<br>
isnan finite isinf hypot acosh erf tgamma lgamma_r cbrt <br>
Index: branches/ruby_1_9_1/ChangeLog</h1>
<p>--- branches/ruby_1_9_1/ChangeLog (revision 21148)<br>
+++ branches/ruby_1_9_1/ChangeLog (working copy)<br>
@@ -1,3 +1,9 @@<br>
+Mon Dec 29 16:03:03 2008 URABE Shyouhei <a href="mailto:shyouhei@ruby-lang.org" class="email">shyouhei@ruby-lang.org</a><br>
+</p>
<ul>
<li>
<ul>
<li>sprintf.c: detect broken gcc. <a href="/issues/942">[ruby-core:20944]</a></li>
</ul>
</li>
<li>
<li>
<ul>
<li>configure.in: ditto.</li>
</ul>
</li>
<li>
</ul>
<p>Sun Dec 28 18:36:33 2008 Yuki Sonoda (Yugui) <a href="mailto:yugui@yugui.jp" class="email">yugui@yugui.jp</a></p>
<pre><code>* test/rubygems/test_gem_command.rb
</code></pre>
<a name="Index-branchesruby_1_9_1sprintfc"></a>
<h1 >Index: branches/ruby_1_9_1/sprintf.c<a href="#Index-branchesruby_1_9_1sprintfc" class="wiki-anchor">¶</a></h1>
<p>--- branches/ruby_1_9_1/sprintf.c (revision 21148)<br>
+++ branches/ruby_1_9_1/sprintf.c (working copy)<br>
@@ -25,6 +25,12 @@<br>
#define BITSPERDIG (SIZEOF_BDIGITS<em>CHAR_BIT)<br>
#define EXTENDSIGN(n, l) (((~0 << (n)) >> (((n)</em>(l)) % BITSPERDIG)) & ~(~0 << (n)))</p>
<p>+#ifdef HAVE_BROKEN_EXTERN_INLINE<br>
+#undef snprintf<br>
+/* <a href="/issues/942">[ruby-core:20944]</a> <em>/<br>
+#define snprintf rb_snprintf_evil_gcc4_and_glibc2_7_need_this_f_ing_workaround_<br>
+#endif<br>
+<br>
static void fmt_setup(char</em>,size_t,int,int,int,int);</p>
<p>static char*<br>
@@ -1082,7 +1088,9 @@</p>
<a name="endif"></a>
<h1 >endif<a href="#endif" class="wiki-anchor">¶</a></h1>
<p>#endif<br>
#undef vsnprintf<br>
+#ifndef HAVE_BROKEN_EXTERN_INLINE<br>
#undef snprintf<br>
+#endif<br>
#define FLOATING_POINT 1<br>
#define BSD__dtoa ruby_dtoa<br>
#undef HAVE_VSNPRINTF</p>
<p>=end</p> Ruby master - Bug #942: Build fails on IA-32 Linux with gcc 4.3.2https://redmine.ruby-lang.org/issues/942?journal_id=24562008-12-30T21:47:09Zyugui (Yuki Sonoda)yugui@yugui.jp
<ul><li><strong>Category</strong> set to <i>core</i></li><li><strong>Target version</strong> changed from <i>1.9.1 Release Candidate</i> to <i>1.9.1 RC2</i></li></ul><p>=begin</p>
<p>=end</p> Ruby master - Bug #942: Build fails on IA-32 Linux with gcc 4.3.2https://redmine.ruby-lang.org/issues/942?journal_id=24782008-12-31T19:36:55Zshyouhei (Shyouhei Urabe)shyouhei@ruby-lang.org
<ul></ul><p>=begin<br>
Michael Selig wrote:</p>
<blockquote>
<p>The basic issue here seems to me that "missing/vsnprintf.c" is being<br>
included even though snprintf() & vsnprintf() exist, and there is INHO<br>
an ugly kludge to get this to work. The "proper" Ruby way should be to<br>
change all calls to snprintf() & vsnprintf() to rb_snprintf() &<br>
rb_vsnprintf() if there is a "permanent" Ruby replacement for them. This<br>
wouldn't cause this compiler problem.</p>
</blockquote>
<p>We already have rb_sprintf(). This is why sprintf.c exists.</p>
<blockquote>
<p>But why do thay need replacing in Linux in the first place?</p>
</blockquote>
<p>Because the world is not built on top of Linux. Direct reason why we chose to<br>
include missing/vsnprintf.c rather than to check snprintf sanity in configure,<br>
is that checking itself should go insanely complex. It's much easier for us to<br>
silently ignore system-provided routines. Linux insanity is that it doesn't<br>
give us a chance to ignore glibc's.</p>
<p>Another reason for us to avoid libc-provided fuctions is that we don't want our<br>
printf variants to depend on locales, especially in representing floating point<br>
numbers. Localization mechanisms should be implemented on other layers than<br>
Ruby's core.</p>
<p>=end</p> Ruby master - Bug #942: Build fails on IA-32 Linux with gcc 4.3.2https://redmine.ruby-lang.org/issues/942?journal_id=26132009-01-14T09:08:29Zantares (Michael Klishin)
<ul></ul><p>=begin<br>
It is resolved now and can be closed, thank you.<br>
=end</p> Ruby master - Bug #942: Build fails on IA-32 Linux with gcc 4.3.2https://redmine.ruby-lang.org/issues/942?journal_id=26142009-01-14T10:40:08Zmatz (Yukihiro Matsumoto)matz@ruby.or.jp
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Closed</i></li></ul><p>=begin</p>
<p>=end</p>