[ruby-trunk - Bug #8901][Open] "-lgmp: not found" でlibruby-static.a 作成に失敗する

Issue #8901 has been reported by ngoto (Naohisa G.).


Bug #8901: “-lgmp: not found” でlibruby-static.a 作成に失敗する
https://bugs.ruby-lang.org/issues/8901

Author: ngoto (Naohisa G.)
Status: Open
Priority: Normal
Assignee: nobu (Nobuyoshi N.)
Category: build
Target version:
ruby -v: ruby 2.1.0dev (2013-09-11) [sparc64-solaris2.10]
Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN

BignumにGMPを使うようになって以降、Solarisで以下のようにlibruby-static.a の作成に失敗するようになりました。
Solaris以外にも、LDFLAGSでライブラリの場所を指定する必要のある環境では同様に失敗すると思います。

% CC=cc
% CXX=CC
% CPPLAGS="-I/usr/local/64/lib/libffi-3.0.10/include
-I/usr/local/64/include"
% CFLAGS="-xO1 -xtarget=sparc64viiplus -m64"
% CXXFLAGS="-xO1 -xtarget=sparc64viiplus -m64"
% LDFLAGS="-m64 -L/usr/local/64/lib -R/usr/local/64/lib"
% DLDFLAGS="-m64 -L/usr/local/64/lib -R/usr/local/64/lib"
% export CC CXX CPPFLAGS CFLAGS CXXFLAGS LDFLAGS DLDFLAGS
% ./configure --prefix=/XXX --build=sparc64-sun-solaris2.10
–with-tclConfig-dir=/usr/local/64/lib
–with-tkConfig-dir=/usr/local/64/lib --enable-shared
(中略)
checking gmp.h usability… yes
checking gmp.h presence… yes
checking for gmp.h… yes
checking for __gmpz_init in -lgmp… yes
(中略)
configure: creating ./config.status
config.status: creating GNUmakefile
config.status: creating Makefile
config.status: creating ruby-2.1.pc
% make V=1
(中略)
ar rcu libruby-static.a ruby-glommed.o dmyext.o
ld: fatal: library -lgmp: not found
ld: fatal: file processing errors. No output written to conftest
make: *** [libruby-static.a] Error 2

以下のように verifying static-library [email protected] のところで $(LDFLAGS) の順番を ruby
本体を作成するときと同じように $(XLDFLAGS) の直前に変更すると治りました。

Index: Makefile.in

— Makefile.in (revision 42917)
+++ Makefile.in (working copy)
@@ -215,7 +215,7 @@
$(Q) $(AR) $(ARFLAGS) [email protected] $(LIBRUBY_A_OBJS) $(DMYEXT)
@-$(RANLIB) [email protected] 2> /dev/null || true
$(ECHO) verifying static-library [email protected]

  •           @$(PURIFY) $(CC) $(XLDFLAGS) $(MAINOBJ) $(LIBRUBY_A) 
    

$(MAINLIBS) $(EXTLIBS) $(LIBS) $(OUTFLAG)conftest$(EXEEXT) $(LDFLAGS)

  •           @$(PURIFY) $(CC) $(LDFLAGS) $(XLDFLAGS) $(MAINOBJ) 
    

$(LIBRUBY_A) $(MAINLIBS) $(EXTLIBS) $(LIBS) $(OUTFLAG)conftest$(EXEEXT)
@$(RM) conftest$(EXEEXT) conftest.c

$(LIBRUBY_SO):

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs