Project

General

Profile

Actions

Bug #11245

closed

Build failure on Solaris 10 with gcc since r50804

Added by ngoto (Naohisa Goto) almost 9 years ago. Updated over 8 years ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-dev:49051]

Description

Solaris 10 + gcc 4.6.2 にて、r50804以降、以下のように ext/bigdecimal のビルドに失敗します。

make -C ext/bigdecimal -w V=1 all
make[2]: Entering directory `/XXXXX-gcc-trunk-50804/ext/bigdecimal'
gcc -I. -I../../.ext/include/sparc64-solaris2.10 -I../.././include -I../.././ext/bigdecimal -DRUBY_EXTCONF_H=\"extconf.h\"  -I/usr/local/64/lib/libffi-3.0.10/include -I/usr/local/64/include -fPIC  -O -m64 -m64 -o bigdecimal.o -c bigdecimal.c
bigdecimal.c:107:1: error: static declaration of 'rb_rational_num' follows non-static declaration
../.././include/ruby/intern.h:171:7: note: previous declaration of 'rb_rational_num' was here
bigdecimal.c: In function 'rb_rational_num':
bigdecimal.c:112:5: error: too few arguments to function 'rb_funcall'
../.././include/ruby/ruby.h:1535:7: note: declared here
bigdecimal.c: At top level:
bigdecimal.c:119:1: error: static declaration of 'rb_rational_den' follows non-static declaration
../.././include/ruby/intern.h:172:7: note: previous declaration of 'rb_rational_den' was here
bigdecimal.c: In function 'rb_rational_den':
bigdecimal.c:124:5: error: too few arguments to function 'rb_funcall'
../.././include/ruby/ruby.h:1535:7: note: declared here
make[2]: *** [bigdecimal.o] Error 1
make[2]: Leaving directory `/XXXXX-gcc-trunk-50804/ext/bigdecimal'
make[1]: *** [ext/bigdecimal/all] Error 2
make[1]: Leaving directory `/XXXXX-gcc-trunk-50804'
make: *** [build-ext] Error 2

ext/bigdecimal/extconf.rb の r50803 と r50804 の差分は以下のとおりです。

--- XXXXX-gcc-trunk-50803/ext/bigdecimal/extconf.h	2015-06-10 20:43:34.880118000 +0900
+++ XXXXX-gcc-trunk-50804/ext/bigdecimal/extconf.h	2015-06-10 20:55:45.316991000 +0900
@@ -2,6 +2,4 @@
 #define EXTCONF_H
 #define HAVE_LABS 1
 #define HAVE_LLABS 1
-#define HAVE_RB_RATIONAL_NUM 1
-#define HAVE_RB_RATIONAL_DEN 1
 #endif

r50804 では rb_rational_num() と rb_rational_den() が無いことにされています。

mkmf.log の差分(の抜粋)を見ると、r50803 ではgcc実行時に付いていたオプション -fstack-protector が r50804 では無くなっていて、このためにリンクエラーになって実行に失敗しているのがわかります。

--- XXXXX-trunk-50803/ext/bigdecimal/mkmf.log     2015-06-10 20:43:34.894944000 +0900
+++ XXXXX-trunk-50804/ext/bigdecimal/mkmf.log     2015-06-10 20:55:45.331985000 +0900
@@ -66,10 +66,16 @@
 
 --------------------
 
-have_func: checking for rb_rational_num() in ruby.h... -------------------- yes
+have_func: checking for rb_rational_num() in ruby.h... -------------------- no
 
-"gcc -o conftest -I../../.ext/include/sparc64-solaris2.10 -I../.././include -I../.././ext/bigdecimal  -I/usr/local/64/lib/libffi-3.0.10/include -I/usr/local/64/include    -O conftest.c  -L. -L../.. -L. -L/usr/local/64/lib -R/usr/local/64/lib -fstack-protector  -m64   -Wl,-R/XXXXX-gcc-trunk/lib -L/XXXXX-gcc-trunk/lib -lruby-static  -lpthread -lrt -lgmp -lsocket -ldl -lcrypt -lm   -lc"
-\{\"LD_LIBRARY_PATH_64\"\=\>\".:../..\"\} gcc\ -o\ conftest\ -I../../.ext/include/sparc64-solaris2.10\ -I../.././include\ -I../.././ext/bigdecimal\ \ -I/usr/local/64/lib/libffi-3.0.10/include\ -I/usr/local/64/include\ \ \ \ -O\ conftest.c\ \ -L.\ -L../..\ -L.\ -L/usr/local/64/lib\ -R/usr/local/64/lib\ -fstack-protector\ \ -m64\ \ \ -Wl,-R/XXXXX-gcc-trunk/lib\ -L/XXXXX-gcc-trunk/lib\ -lruby-static\ \ -lpthread\ -lrt\ -lgmp\ -lsocket\ -ldl\ -lcrypt\ -lm\ \ \ -lc
+"gcc -o conftest -I../../.ext/include/sparc64-solaris2.10 -I../.././include -I../.././ext/bigdecimal  -I/usr/local/64/lib/libffi-3.0.10/include -I/usr/local/64/include  -O -m64 conftest.c  -L. -L../.. -L/usr/local/64/lib -R/usr/local/64/lib  -m64   -Wl,-R/XXXXX-gcc-trunk/lib -L/XXXXX-gcc-trunk/lib -lruby-static  -lpthread -lrt -lgmp -lsocket -ldl -lcrypt -lm   -lc"
+\{\"LD_LIBRARY_PATH_64\"\=\>\".:../..\"\} gcc\ -o\ conftest\ -I../../.ext/include/sparc64-solaris2.10\ -I../.././include\ -I../.././ext/bigdecimal\ \ -I/usr/local/64/lib/libffi-3.0.10/include\ -I/usr/local/64/include\ \ -O\ -m64\ conftest.c\ \ -L.\ -L../..\ -L/usr/local/64/lib\ -R/usr/local/64/lib\ \ -m64\ \ \ -Wl,-R/XXXXX-gcc-trunk/lib\ -L/XXXXX-gcc-trunk/lib\ -lruby-static\ \ -lpthread\ -lrt\ -lgmp\ -lsocket\ -ldl\ -lcrypt\ -lm\ \ \ -lc
+Undefined                      first referenced
+ symbol                            in file
+__stack_chk_fail                    ../../libruby-static.a(ruby-glommed.o)
+__stack_chk_guard                   ../../libruby-static.a(ruby-glommed.o)
+ld: fatal: symbol referencing errors. No output written to conftest
+collect2: ld returned 1 exit status
 checked program was:
 /* begin */
  1: #include "ruby.h"

この -fstack-protector が消えてしまうのは、以下の理由によると考えられます。

  1. ruby本体の ./configure 時に以下のように LDFLAGS その他を X=Y 形式で指定している
  2. -fstack-protector は ruby本体の ./configure スクリプト中で、利用可能な場合は、自動的に付与される
  3. r50804 の変更で RbConfig::MAKEFILE_CONFIG["configure_args"] の X=Y 形式の指定をパースするようになったので、最初のruby本体のconfigure時に渡したオプションのLDFLAGS その他をそのまま拡張モジュールのビルドに使うようになった。
  4. このため、ruby本体のconfigureが後から自動的に追加した -fstack-protector は無視されてしまうことになった。
CC=gcc
CXX=g++
CPPLAGS=" -I/usr/local/64/lib/libffi-3.0.10/include -I/usr/local/64/include"
CFLAGS=" -O -m64"
CXXFLAGS=" -O -m64"
LDFLAGS="-L/usr/local/64/lib -R/usr/local/64/lib"
DLDFLAGS=" -L/usr/local/64/lib -R/usr/local/64/lib"
./configure --prefix=/XXXXX-gcc-trunk --build=sparc64-sun-solaris2.10 --with-tclConfig-dir=/usr/local/64/lib --with-tkConfig-dir=/usr/local/64/lib

このように r50804 の変更は不具合があるため、いったんはリバートを提案します。

この変更の主旨を汲むとすれば、以下のいずれかが必要と思います。
A. CFLAGS, LDFLAGS など、ruby本体の ./configure 内で触った可能性のあるものは渡さないようにする
B. ruby本体の ./configure 内でいじくり回した後の CFLAGS や LDFLAGS その他を渡すようにする
C. RUBY本体の ./configure と同じ -fstack-protector などのオプションの自動付与処理を mkmf.rb 内で行う

Actions #1

Updated by ngoto (Naohisa Goto) almost 9 years ago

  • Status changed from Open to Closed

Applied in changeset r50815.


  • lib/mkmf.rb: revert r50804 because of build failure when specifying
    LDFLAGS during configure, observed on Solaris with GCC 4.6.
    [Bug #11245]

Updated by ngoto (Naohisa Goto) almost 9 years ago

r50804 は Changelog も無いことですし、さっさと revert しました。

Updated by usa (Usaku NAKAMURA) over 8 years ago

  • Backport changed from 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN to 2.0.0: DONTNEED, 2.1: DONTNEED, 2.2: DONTNEED
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0