https://redmine.ruby-lang.org/https://redmine.ruby-lang.org/favicon.ico?17113305112012-12-01T08:41:25ZRuby Issue Tracking SystemRuby master - Bug #7485: ruby cannot build on mingw32 or FreeBSD 8 due to missing __sync_val_compare_and_swaphttps://redmine.ruby-lang.org/issues/7485?journal_id=342532012-12-01T08:41:25Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul></ul><p>__sync_or_and_fetch wasn't available in Apple derivative gcc.</p> Ruby master - Bug #7485: ruby cannot build on mingw32 or FreeBSD 8 due to missing __sync_val_compare_and_swaphttps://redmine.ruby-lang.org/issues/7485?journal_id=342562012-12-01T09:11:55Zshyouhei (Shyouhei Urabe)shyouhei@ruby-lang.org
<ul></ul><p><a class="user active user-mention" href="https://redmine.ruby-lang.org/users/4">@nobu (Nobuyoshi Nakada)</a> Why do we have to bother old broken compiler?</p> Ruby master - Bug #7485: ruby cannot build on mingw32 or FreeBSD 8 due to missing __sync_val_compare_and_swaphttps://redmine.ruby-lang.org/issues/7485?journal_id=342642012-12-01T13:52:43Zkosaki (Motohiro KOSAKI)kosaki.motohiro@gmail.com
<ul></ul><p>I guess -march=i486 enable __sync_val_compare_and_swap.</p> Ruby master - Bug #7485: ruby cannot build on mingw32 or FreeBSD 8 due to missing __sync_val_compare_and_swaphttps://redmine.ruby-lang.org/issues/7485?journal_id=342972012-12-02T10:41:29Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul></ul><p>Hmmm, if it can help, should add it by the default on mingw32?</p> Ruby master - Bug #7485: ruby cannot build on mingw32 or FreeBSD 8 due to missing __sync_val_compare_and_swaphttps://redmine.ruby-lang.org/issues/7485?journal_id=343102012-12-02T18:19:32Zluislavena (Luis Lavena)luislavena@gmail.com
<ul></ul><p>Hello,</p>
<p>I just tested several native compilers on Windows 7 (without your patch) here are the results for those that define HAVE_GCC_ATOMIC_BUILTINS:</p>
<p>C:\Users\Luis\Code\ruby\ruby\build>gcc --version<br>
gcc (tdm-1) 4.5.2</p>
<p>C:\Users\Luis\Code\ruby\ruby\build>cat .ext/include/i386-mingw32/ruby/config.h | grep ATOMIC<br>
#define HAVE_GCC_ATOMIC_BUILTINS 1</p>
<p>C:\Users\Luis\Code\ruby\ruby\build>gcc --version<br>
gcc (tdm-1) 4.6.1</p>
<p>C:\Users\Luis\Code\ruby\ruby\build>cat .ext/include/i386-mingw32/ruby/config.h | grep ATOMIC<br>
#define HAVE_GCC_ATOMIC_BUILTINS 1</p>
<p>C:\Users\Luis\Code\ruby\ruby\build>gcc --version<br>
gcc (rubenvb-4.7.2-release) 4.7.2</p>
<p>C:\Users\Luis\Code\ruby\ruby\build>cat .ext/include/i386-mingw32/ruby/config.h | grep ATOMIC<br>
#define HAVE_GCC_ATOMIC_BUILTINS 1</p>
<p>In all scenarios it found the atomic builtins</p>
<p>On Windows XP (32bits), ATOMIC do get defined:</p>
<p>C:\Code\ruby\ruby\build>ver</p>
<p>Microsoft Windows XP [Version 5.1.2600]</p>
<p>C:\Code\ruby\ruby\build>gcc --version<br>
gcc (rubenvb-4.7.2-release) 4.7.2</p>
<p>C:\Code\ruby\ruby\build>cat .ext\include\i386-mingw32\ruby\config.h | grep ATOMIC<br>
#define HAVE_GCC_ATOMIC_BUILTINS 1</p>
<p>I was also able to compile Ruby without issues with "make all test"</p>
<p>I don't get the problem reported on this ticket on neither my systems.</p>
<p>I'm missing something?</p>
<p>Thank you.</p> Ruby master - Bug #7485: ruby cannot build on mingw32 or FreeBSD 8 due to missing __sync_val_compare_and_swaphttps://redmine.ruby-lang.org/issues/7485?journal_id=343222012-12-03T00:55:34Zjonforums (Jon Forums)
<ul></ul><p>I agree with Luis' results and think we've just not fully debugged Eric's XP VM setup as in <a class="issue tracker-2 status-5 priority-4 priority-default closed" title="Feature: Update Rubygems (Closed)" href="https://redmine.ruby-lang.org/issues/7427">#7427</a>.</p>
<p>With this snippet <a href="http://pastie.org/5460872" class="external">http://pastie.org/5460872</a> and Kosaki-san's feedback I see:</p>
<a name="mingw-w64-32bit-gcc-472"></a>
<h2 >mingw-w64 32bit gcc 4.7.2<a href="#mingw-w64-32bit-gcc-472" class="wiki-anchor">¶</a></h2>
<p>C:\sandbox>gcc --version<br>
gcc (rubenvb-4.7.2-release) 4.7.2</p>
<p>C:\sandbox>gcc -Wall -o atomics.exe gcc_atomic.c</p>
<p>C:\sandbox>atomics.exe<br>
Got 1</p>
<p>C:\sandbox>gcc -Wall -march=i386 -o atomics.exe gcc_atomic.c<br>
C:\Users\Jon\AppData\Local\Temp\ccK9GPwk.o:gcc_atomic.c:(.text+0x2e): undefined reference<br>
to `__sync_val_compare_and_swap_4'<br>
collect2.exe: error: ld returned 1 exit status</p>
<a name="mingw-32bit-gcc-462"></a>
<h2 >mingw 32bit gcc 4.6.2<a href="#mingw-32bit-gcc-462" class="wiki-anchor">¶</a></h2>
<p>C:\sandbox>gcc --version<br>
gcc (GCC) 4.6.2</p>
<p>C:\sandbox>gcc -Wall -o atomics.exe gcc_atomic.c<br>
C:\Users\Jon\AppData\Local\Temp\ccpeH4Vt.o:gcc_atomic.c:(.text+0x2e): undefined reference<br>
to `__sync_val_compare_and_swap_4'<br>
collect2: ld returned 1 exit status</p>
<p>C:\sandbox>gcc -Wall -march={i486,i586,i686,native,core2} -o atomics.exe gcc_atomic.c</p>
<p>C:\Users\Jon\Documents\CDev\sandbox>atomics.exe<br>
Got 1</p>
<p>Bottom line: even with these snippet results I see no build failures due to the current mingw32 build configuration.</p> Ruby master - Bug #7485: ruby cannot build on mingw32 or FreeBSD 8 due to missing __sync_val_compare_and_swaphttps://redmine.ruby-lang.org/issues/7485?journal_id=346442012-12-12T10:35:17Zdrbrain (Eric Hodel)drbrain@segment7.net
<ul><li><strong>Subject</strong> changed from <i>ruby cannot build on mingw32 due to missing __sync_val_compare_and_swap</i> to <i>ruby cannot build on mingw32 or FreeBSD 8 due to missing __sync_val_compare_and_swap</i></li></ul> Ruby master - Bug #7485: ruby cannot build on mingw32 or FreeBSD 8 due to missing __sync_val_compare_and_swaphttps://redmine.ruby-lang.org/issues/7485?journal_id=346452012-12-12T10:42:14Zdrbrain (Eric Hodel)drbrain@segment7.net
<ul></ul><p>=begin<br>
I'm also experiencing this on FreeBSD 8 with gcc 4.2.1:</p>
<p>$ gcc -v<br>
Using built-in specs.<br>
Target: i386-undermydesk-freebsd<br>
Configured with: FreeBSD/i386 system compiler<br>
Thread model: posix<br>
gcc version 4.2.1 20070719 [FreeBSD]<br>
$ make<br>
linking miniruby<br>
thread.o(.text+0x3f20): In function <code>rb_threadptr_execute_interrupts': /data/home/drbrain/Work/svn/ruby/thread.c:1807: undefined reference to </code>__sync_val_compare_and_swap_4'<br>
*** Error code 1</p>
<p>Stop in /data/home/drbrain/Work/svn/ruby.</p>
<p>So it seems to be an old GCC issue, not a mingw-specific issue.</p>
<p>Is ruby 2.0 abandoning gcc 4.2.x?</p>
<p>=end</p> Ruby master - Bug #7485: ruby cannot build on mingw32 or FreeBSD 8 due to missing __sync_val_compare_and_swaphttps://redmine.ruby-lang.org/issues/7485?journal_id=346462012-12-12T11:05:40Zkosaki (Motohiro KOSAKI)kosaki.motohiro@gmail.com
<ul></ul><p>Hi</p>
<p>Does following patch fix your issue?</p>
<p>diff --git a/configure.in b/configure.in<br>
index c916cd5..4a34334 100644<br>
--- a/configure.in<br>
+++ b/configure.in<br>
@@ -1534,7 +1534,7 @@ AS_CASE(["$target_os"],<br>
[])</p>
<p>-AS_CASE(["$target_cpu-$target_os"], [[i[3-6]86-linux*]], [<br>
+AS_CASE(["$target_cpu-$target_os"], [[i[3-6]86-*]], [<br>
AC_CACHE_CHECK([for __sync_val_compare_and_swap], [rb_cv_gcc_co<br>
AC_TRY_LINK([unsigned long atomic_var;],<br>
[</p> Ruby master - Bug #7485: ruby cannot build on mingw32 or FreeBSD 8 due to missing __sync_val_compare_and_swaphttps://redmine.ruby-lang.org/issues/7485?journal_id=347272012-12-14T09:57:07Zdrbrain (Eric Hodel)drbrain@segment7.net
<ul></ul><p>This patch works, thanks!</p> Ruby master - Bug #7485: ruby cannot build on mingw32 or FreeBSD 8 due to missing __sync_val_compare_and_swaphttps://redmine.ruby-lang.org/issues/7485?journal_id=347382012-12-14T17:36:24Zkosaki (Motohiro KOSAKI)kosaki.motohiro@gmail.com
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Assigned</i></li><li><strong>Assignee</strong> changed from <i>nobu (Nobuyoshi Nakada)</i> to <i>drbrain (Eric Hodel)</i></li></ul><p><a class="user active user-mention" href="https://redmine.ruby-lang.org/users/47">@drbrain (Eric Hodel)</a>, could you please commit the patch instead of me? I have no test environment and I don't like commit w/o make test-all.</p> Ruby master - Bug #7485: ruby cannot build on mingw32 or FreeBSD 8 due to missing __sync_val_compare_and_swaphttps://redmine.ruby-lang.org/issues/7485?journal_id=347492012-12-15T04:20:56Zdrbrain (Eric Hodel)drbrain@segment7.net
<ul></ul><p>I have confirmed it fixes mingw32 as well, I will commit it after lunch. Thanks for the patch!</p> Ruby master - Bug #7485: ruby cannot build on mingw32 or FreeBSD 8 due to missing __sync_val_compare_and_swaphttps://redmine.ruby-lang.org/issues/7485?journal_id=347502012-12-15T06:18:04Zdrbrain (Eric Hodel)drbrain@segment7.net
<ul><li><strong>Status</strong> changed from <i>Assigned</i> to <i>Closed</i></li><li><strong>% Done</strong> changed from <i>0</i> to <i>100</i></li></ul><p>This issue was solved with changeset r38386.<br>
Eric, thank you for reporting this issue.<br>
Your contribution to Ruby is greatly appreciated.<br>
May Ruby be with you.</p>
<hr>
<ul>
<li>configure.in (HAVE_GCC_ATOMIC_BUILTINS): Set -march=i486 to enable<br>
__sync_val_compare_and_swap. Patch by KOSAKI Motohiro.<br>
[ruby-trunk - Bug <a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Bug: ruby cannot build on mingw32 or FreeBSD 8 due to missing __sync_val_compare_and_swap (Closed)" href="https://redmine.ruby-lang.org/issues/7485">#7485</a>]</li>
</ul> Ruby master - Bug #7485: ruby cannot build on mingw32 or FreeBSD 8 due to missing __sync_val_compare_and_swaphttps://redmine.ruby-lang.org/issues/7485?journal_id=347512012-12-15T06:21:42Zdrbrain (Eric Hodel)drbrain@segment7.net
<ul></ul><p>Please check my ChangeLog message for accuracy.</p> Ruby master - Bug #7485: ruby cannot build on mingw32 or FreeBSD 8 due to missing __sync_val_compare_and_swaphttps://redmine.ruby-lang.org/issues/7485?journal_id=347522012-12-15T06:36:57Zkosaki (Motohiro KOSAKI)kosaki.motohiro@gmail.com
<ul></ul><blockquote>
<p>Please check my ChangeLog message for accuracy.</p>
</blockquote>
<p>Looks correct. thank you!</p>