Bug #8901

"-lgmp: not found" でlibruby-static.a 作成に失敗する

Added by Naohisa Goto 7 months ago. Updated 7 months ago.

[ruby-dev:47707]
Status:Closed
Priority:Normal
Assignee:Nobuyoshi Nakada
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

Description

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 _gmpzinit 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 $@ のところで $(LDFLAGS) の順番を ruby 本体を作成するときと同じように $(XLDFLAGS) の直前に変更すると治りました。

Index: Makefile.in

===================================================================

--- Makefile.in (revision 42917)

+++ Makefile.in (working copy)

@@ -215,7 +215,7 @@

$(Q) $(AR) $(ARFLAGS) $@ $(LIBRUBYAOBJS) $(DMYEXT)

@-$(RANLIB) $@ 2> /dev/null || true

$(ECHO) verifying static-library $@

- @$(PURIFY) $(CC) $(XLDFLAGS) $(MAINOBJ) $(LIBRUBYA) $(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):

Associated revisions

Revision 42919
Added by Naohisa Goto 7 months ago

  • Makefile.in (libruby-static.a): change LDFLAGS order. LDFLAGS may include library path that should be specified before LIBS. [Bug #8901]

History

#1 Updated by Naohisa Goto 7 months ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r42919.
Naohisa, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


  • Makefile.in (libruby-static.a): change LDFLAGS order. LDFLAGS may include library path that should be specified before LIBS. [Bug #8901]

Also available in: Atom PDF