Project

General

Profile

Actions

Bug #14746

closed

$cppflags が ext/zlib/Makefile に反映されないため(?) Solaris 10 にて ext/zlib のmakeに失敗する

Added by ngoto (Naohisa Goto) almost 6 years ago. Updated almost 6 years ago.

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

Description

Solaris 10 にて、以下のように configure && make すると、ext/zlibのmakeに失敗します。(r63361 にて確認)

 $ export PATH=/usr/local/64/bin:/usr/local/bin:/usr/ccs/bin:/usr/xpg4/bin:/usr/bin:/bin:/usr/openwin/bin:/usr/dt/bin:/usr/X11/bin:/usr/sbin
 $ export PKG_CONFIG_PATH=/usr/local/64/lib/pkgconfig:/usr/lib/64/pkgconfig
 $ mkdir tmp004
 $ cd tmp004
 $ ../github/ruby/configure \
  --prefix="/XXXXXXXX/sparc64-gcc-tmp004-trunk" \
  --build=sparc64-sun-solaris2.10 \
  --with-tclConfig-dir=/usr/local/64/lib \
  --with-tkConfig-dir=/usr/local/64/lib \
  cppflags="-I/usr/local/64/lib/libffi-3.0.10/include -I/usr/local/64/include" \
  cflags="-m64" \
  cxxflags="-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"
 $ make V=1
(中略)
make -C ext/zlib V=1 all
make[2]: Entering directory `/XXXXXXXX/src/tmp004/ext/zlib'
gcc -I. -I../../.ext/include/sparc64-solaris2.10 -I../../../github/ruby/include -I../../../github/ruby/ext/zlib -DRUBY_EXTCONF_H=\"extconf.h\"    -fPIC -m64 -O3 -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wno-tautological-compare -Wno-parentheses-equality -Wno-constant-logical-operand -Wno-self-assign -Wunused-variable -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -Wdeprecated-declarations -Wno-overlength-strings -Wno-packed-bitfield-compat -Wsuggest-attribute=noreturn -Wmissing-noreturn  -o zlib.o -c ../../../github/ruby/ext/zlib/zlib.c
../../../github/ruby/ext/zlib/zlib.c: In function 'rb_zlib_crc_table':
../../../github/ruby/ext/zlib/zlib.c:511:5: error: unknown type name 'z_crc_t'
../../../github/ruby/ext/zlib/zlib.c:515:12: warning: assignment from incompatible pointer type [enabled by default]
../../../github/ruby/ext/zlib/zlib.c: At top level:
cc1: warning: unrecognized command line option "-Wno-self-assign" [enabled by default]
cc1: warning: unrecognized command line option "-Wno-constant-logical-operand" [enabled by default]
cc1: warning: unrecognized command line option "-Wno-parentheses-equality" [enabled by default]
cc1: warning: unrecognized command line option "-Wno-tautological-compare" [enabled by default]
make[2]: *** [zlib.o] Error 1
make[2]: Leaving directory `/XXXXXXXX/src/tmp004/ext/zlib'
make[1]: *** [ext/zlib/all] Error 2
make[1]: Leaving directory `/XXXXXXXX/src/tmp004'
make: *** [build-ext] Error 2

ext/zlib/mkmf.log, ext/zlib/Makefile と中略部分を含めたconfigureおよびmake時のログを添付します。

Solaris 10 では、OS標準の /usr/include/zlib.h は存在しますが、バージョンが古いため、
自分で /usr/local/64 にインストールした zlib その他の各種ライブラリを使用するために、
Rubyのconfigure時にオプションとして
cppflags="-I/usr/local/64/lib/libffi-3.0.10/include -I/usr/local/64/include"
を指定しています。

mkmf.log を見ると、mkmf時(extconf.rb実行時)のgccのコマンドラインにはこのcppflagsが反映されています。

しかし、make時には、与えたはずの cppflags の内容がコマンドラインに入っていません。
ext/zlib/Makefile を見る限り、$cppflags には初期値として何も入っていないようです。
このため、extconf.rb実行時と異なる、バージョンの古い /usr/include/zlib.h を読んだため、上記のエラーが発生した模様です。

zlib以外には、OpenSSLも同様にシステム標準のバージョンが古いため、新しいOpenSSLを自前でインストールしており、
ext/openssl でも同様の問題は発生しておかしくありませんが、ext/openssl/extconf.rb では pkg_config コマンドを呼び出して CFLAGS や LDFLAGS に追加すべき内容を取得しているため、環境変数 PKG_CONFIG_PATH を適切に設定さえしていれば問題なかったようです。


Files

0000-configure.log (26.4 KB) 0000-configure.log configure時のコンソール出力 ngoto (Naohisa Goto), 05/09/2018 01:29 PM
0000-make.log (182 KB) 0000-make.log make時のコンソール出力 ngoto (Naohisa Goto), 05/09/2018 01:30 PM
0000-ext.zlib.Makefile (8.62 KB) 0000-ext.zlib.Makefile ext/zlib/Makefile ngoto (Naohisa Goto), 05/09/2018 01:30 PM
0000-mkmf.log (15.5 KB) 0000-mkmf.log ext/zlib/mkmf.log ngoto (Naohisa Goto), 05/09/2018 01:30 PM

Updated by ngoto (Naohisa Goto) almost 6 years ago

mkmf時に使用した$cppflagsが生成されたMakefileに反映されないのはlib/mkmf.rbのバグだと思います。

以下のパッチで$cppflagsが生成されたMakefileに書き込まれ、ext/zlibのmakeも通ることを確認しました。(r63393にて確認)

--- a/lib/mkmf.rb
+++ b/lib/mkmf.rb
@@ -1982,6 +1982,7 @@ def configuration(srcdir)
 optflags = #{CONFIG['optflags']}
 debugflags = #{CONFIG['debugflags']}
 warnflags = #{$warnflags}
+cppflags = #{CONFIG['cppflags']}
 CCDLFLAGS = #{$static ? '' : CONFIG['CCDLFLAGS']}
 CFLAGS   = $(CCDLFLAGS) #$CFLAGS $(ARCH_FLAG)
 INCFLAGS = -I. #$INCFLAGS
Actions #2

Updated by ngoto (Naohisa Goto) almost 6 years ago

  • Status changed from Open to Closed

Applied in changeset trunk|r63398.


mkmf.rb: set cppflags

  • ext/mkmf.rb (configuration): set the default cppflags, which is
    referred from the default CPPFLAGS, for extension libraries.
    This fixes build failure of ext/zlib on Solaris 10.
    [Bug #14746] [ruby-dev:50539]
Actions

Also available in: Atom PDF

Like0
Like0Like0