[#30408] Ruby 1.8.6 preview2 has been released — "Akinori MUSHA" <knu@...>

 Ruby 1.8.6 preview2 をリリースしました。

20 messages 2007/02/24
[#30414] fail to autoload at $SAFE==4 (Re: Ruby 1.8.6 preview2 has been released) — Hidetoshi NAGAI <nagai@...> 2007/02/25

永井@知能.九工大です.

[#30418] Re: fail to autoload at $SAFE==4 (Re: Ruby 1.8.6 preview2 has been released) — Nobuyoshi Nakada <nobu@...> 2007/02/25

なかだです。

[ruby-dev:30242] [patch] Mac OS Xでtrunk(r11608)のminirubyをビルドできない

From: "Yoshinori Sano" <yoshinori.sano@...>
Date: 2007-02-02 07:26:44 UTC
List: ruby-dev #30242
さの よしのり です

最新のtrunk(r11608)では、Mac OS Xの環境でminirubyをビルドできません。

環境は以下の通りです。

% uname -a
Darwin MacBookPro.local 8.8.1 Darwin Kernel Version 8.8.1: Mon Sep 25
19:42:00 PDT 2006; root:xnu-792.13.8.obj~1/RELEASE_I386 i386 i386
% gcc --version
i686-apple-darwin8-gcc-4.0.1 (GCC) 4.0.1 (Apple Computer, Inc. build 5250)
Copyright (C) 2005 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.


makeすると、以下のようなエラーが出て停止してしまいます。

% make
[...]
gcc -g -O2 -pipe -fno-common   -L.   main.o  libruby-static.a
-lpthread -ldl -lobjc   -o miniruby
/usr/bin/ld: multiple definitions of symbol _rb_cBinding
libruby-static.a(eval.o) definition of _rb_cBinding in section (__DATA,__common)
libruby-static.a(proc.o) definition of _rb_cBinding in section (__DATA,__common)
/usr/bin/ld: multiple definitions of symbol _rb_cProc
libruby-static.a(eval.o) definition of _rb_cProc in section (__DATA,__common)
libruby-static.a(proc.o) definition of _rb_cProc in section (__DATA,__common)
/usr/bin/ld: warning multiple definitions of symbol _setregid
libruby-static.a(process.o) definition of _setregid in section (__TEXT,__text)
/usr/lib/gcc/i686-apple-darwin8/4.0.1/../../../libpthread.dylib(setregid.So)
definition of _setregid
/usr/bin/ld: warning multiple definitions of symbol _setreuid
libruby-static.a(process.o) definition of _setreuid in section (__TEXT,__text)
/usr/lib/gcc/i686-apple-darwin8/4.0.1/../../../libpthread.dylib(setreuid.So)
definition of _setreuid
collect2: ld returned 1 exit status
make: *** [miniruby] Error 1


どうやら、eval.cとproc.cの両方で、rb_cBindingとrb_cProcがグローバル変数として
変数宣言されているため、リンク時にエラーが出るようです。

そこで、以下のパッチを適用すると、minirubyがビルドできるようになりました。

Index: eval.c
===================================================================
--- eval.c      (revision 11608)
+++ eval.c      (working copy)
@@ -14,8 +14,8 @@

 #include "eval_intern.h"

-VALUE rb_cProc;
-VALUE rb_cBinding;
+extern VALUE rb_cProc;
+extern VALUE rb_cBinding;

 VALUE proc_invoke(VALUE, VALUE, VALUE, VALUE);
 VALUE rb_binding_new();


-- 
Yoshinori Sano <yoshinori.sano@gmail.com>

In This Thread

Prev Next