ruby-dev (Japanese) list archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-dev:50539] [Ruby trunk Bug#14746] $cppflags が ext/zlib/Makefile に反映されないため(?) Solaris 10 にて ext/zlib のmakeに失敗する
       [not found] <redmine.issue-14746.20180509134252@ruby-lang.org>
@ 2018-05-09 13:42 ` ngotogenome
  2018-05-11 15:32 ` [ruby-dev:50540] " ngotogenome
  1 sibling, 0 replies; 2+ messages in thread
From: ngotogenome @ 2018-05-09 13:42 UTC (permalink / raw)
  To: ruby-dev

Issue #14746 has been reported by ngoto (Naohisa Goto).

----------------------------------------
Bug #14746: $cppflags が ext/zlib/Makefile に反映されないため(?) Solaris 10 にて ext/zlib のmakeに失敗する
https://bugs.ruby-lang.org/issues/14746

* Author: ngoto (Naohisa Goto)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: 
* Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN
----------------------------------------
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-make.log (182 KB)
0000-ext.zlib.Makefile (8.62 KB)
0000-mkmf.log (15.5 KB)


-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [ruby-dev:50540] [Ruby trunk Bug#14746] $cppflags が ext/zlib/Makefile に反映されないため(?) Solaris 10 にて ext/zlib のmakeに失敗する
       [not found] <redmine.issue-14746.20180509134252@ruby-lang.org>
  2018-05-09 13:42 ` [ruby-dev:50539] [Ruby trunk Bug#14746] $cppflags が ext/zlib/Makefile に反映されないため(?) Solaris 10 にて ext/zlib のmakeに失敗する ngotogenome
@ 2018-05-11 15:32 ` ngotogenome
  1 sibling, 0 replies; 2+ messages in thread
From: ngotogenome @ 2018-05-11 15:32 UTC (permalink / raw)
  To: ruby-dev

Issue #14746 has been updated by ngoto (Naohisa Goto).


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
~~~


----------------------------------------
Bug #14746: $cppflags が ext/zlib/Makefile に反映されないため(?) Solaris 10 にて ext/zlib のmakeに失敗する
https://bugs.ruby-lang.org/issues/14746#change-71965

* Author: ngoto (Naohisa Goto)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: 
* Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN
----------------------------------------
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-make.log (182 KB)
0000-ext.zlib.Makefile (8.62 KB)
0000-mkmf.log (15.5 KB)


-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-05-11 15:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <redmine.issue-14746.20180509134252@ruby-lang.org>
2018-05-09 13:42 ` [ruby-dev:50539] [Ruby trunk Bug#14746] $cppflags が ext/zlib/Makefile に反映されないため(?) Solaris 10 にて ext/zlib のmakeに失敗する ngotogenome
2018-05-11 15:32 ` [ruby-dev:50540] " ngotogenome

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).