Post date: 2017/03/08 15:36:15
qtbindings-4.8.6.3だと、以下のようなエラーになる
CMake Error at smoke/qtcore/QtGuess.txt:134 (if):
if given arguments:
"EQUAL" "0"
Unknown arguments specified
Call Stack (most recent call first):
smoke/qtcore/CMakeLists.txt:14 (include)
(追記)2017/4/7
CentOS6のgcc 4.4.7では、以下のエラーがでる
/usr/bin/c++ -std=c++03 -o CMakeFiles/cmTryCompileExec55290558.dir/CheckSymbolExists.cxx.o -c /usr/local/anagix_tools/lib/ruby/gems/2.1.0/gems/qtbindings-4.8.6.3/ext/build/CMakeFiles/CMakeTmp/CheckSymbolExists.cxx
cc1plus: error: unrecognized command line option "-std=c++03"
以下のようにdevtools-2を入れれば OK
参考: http://transparent-to-radiation.blogspot.jp/2016/07/centos6gcc-48.html
# wget http://people.centos.org/tru/devtools-2/devtools-2.repo -O /etc/yum.repos.d/devtools-2.repo # yum install devtoolset-2-gcc devtoolset-2-binutils devtoolset-2-gcc-c++
注意: scl enable devtoolset-2 bash は、python2ベース
4.8.6.2だと成功する
qtは、qt-4.8.5 (qtbindings 4.8.6.3のREADMEにqt-4.8.7とqt-5はサポートしてないとかかれている)
gcc -v = 4.4.7
(2017-6-23追記)ruby 2.3.4では、qtbindingsのインストールは成功するものの、以下のエラーがでる:
/opt/rubies/2.3.4/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': incompatible library version - /home/anagix/.gem/ruby/2.3.4/gems/qtbindings-4.8.6.2/lib/2.3/qtruby4.so (LoadError)
from /opt/rubies/2.3.4/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /home/anagix/.gem/ruby/2.3.4/gems/qtbindings-4.8.6.2/lib/Qt4.rb:17:in `<top (required)>'
from /opt/rubies/2.3.4/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:127:in `require'
from /opt/rubies/2.3.4/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:127:in `rescue in require'
from /opt/rubies/2.3.4/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:40:in `require'
from alta.rb:33:in `<main>'
(2018-4-6追記)
ruby 2.3.4でbundle installするとqtbindingsでエラー。最初 export QTDIR=/usr/local/anagix_tools/qt-4.8.5にしたらqtbindingsのインストールはできたが、ruby alta.rbすると、
/home/moriyama/.gem/ruby/2.3.4/gems/qtbindings-4.8.6.2/lib/Qt4.rb:17:in `require': incompatible library version - /home/moriyama/.gem/ruby/2.3.4/gems/qtbindings-4.8.6.2/lib/2.3/qtruby4.so (LoadError)
というエラー。
/usr/local/anagix_tools/qt-4を使うのは止めにし、QTDIRをunsetした。
yum install qt4-devel し、bundle installすると、以下のようなエラー:
/lib64/libc.so.6: version `GLIBC_2.15' not found (required by /usr/local/anagix_tools/qt-4/lib/libQtCore.so.4)
LD_LIBRARY_PATHから、/usr/local/anagix_tools/qt-4/libを外すとこのエラーはなくなった。libQtCore.so.4などは多分ubuntuで作ったため、GLIBC_2.15が
使われているが、centosのglibcは2.12と古い(ldd --versionで確認できる。)
結局、すなおに以下のようにすればqtbindingsはインストールできる。
1。yum install qt4-devel
2。QTDIR、LD_LIBRARY_PATHが設定されてないことを確認し、
3。bundle install
これで解決かと思いきや、(2017ー6ー23)と同じエラーで失敗!
ruby alta.rb
/opt/rubies/2.3.4/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': incompatible library version - /home/moriyama/.gem/ruby/2.3.4/gems/qtbindings-4.8.6.2/lib/2.3/qtruby4.so (LoadError)
from /opt/rubies/2.3.4/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /home/moriyama/.gem/ruby/2.3.4/gems/qtbindings-4.8.6.2/lib/Qt4.rb:17:in `<top (required)>'
from /opt/rubies/2.3.4/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:127:in `require'
from /opt/rubies/2.3.4/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:127:in `rescue in require'
from /opt/rubies/2.3.4/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:40:in `require'
from alta.rb:33:in `<main>'
--------------------------
centos6.8で、/usr/local/anagix_tools/qt-4は使わず(2018/9/14追記)、
ruby 2.5.1でgcc 4.8.2 (devtool-2)、gem install qtbindings -v=4.8.6.4は成功するが、以下のincompatible library versionエラーが発生する。
ruby alta.rb
.[1mTraceback.[m (most recent call last):
6: from alta.rb:33:in `<main>'
5: from /opt/rubies/2.5.1/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:39:in `require'
4: from /opt/rubies/2.5.1/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:135:in `rescue in require'
3: from /opt/rubies/2.5.1/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:135:in `require'
2: from /home/moriyama/.gem/ruby/2.5.1/gems/qtbindings-4.8.6.4/lib/Qt4.rb:25:in `<top (required)>'
1: from /opt/rubies/2.5.1/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
/opt/rubies/2.5.1/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require': .[1mincompatible library version - /home/moriyama/.gem/ruby/2.5.1/gems/qtbindings-4.8.6.4/lib/2.5/qtruby4.so (.[1;4mLoadError.[gm.[1m)
qtbindingsのバージョンを4.8.6.2に落としたが、同じようにincompatible library versionエラーがでる。
rpm -qa|grep qt-4 でqtのバージョンが以下のようにが表示されるので、てっきり4862に落とせばよいのかと思った(がっくり)。
qt-4.6.2-28.el6_5.i686
qt-4.6.2-28.el6_5.x86_64
ちなみに、CentOS7では、qt-4.8.7-2.el7.x86_64 だった。何かおかしい。。。。ruby2.51はまだサポートされてないとか???
上記imcompatible library version問題解決、原因は以下のつまらんことだった!
klayout(klayout.x86_64 0:0.24.10-3.1 )のインストールのためだったのか、いつかのタイミングで、ruby-libs.x86_64 0:1.8.7.374-4.el6_6
がインストールされていた。(ruby-devel.x86_64 0:1.8.7.374-4.el6_6も入っていてあやしいがとりあえず無視。)
qtruby4.soに、古いバージョンの/usr/lib64/libruby.so.1.8がリンクされた。
---- 注意: 以下のリンクエラーは、2018-9-20の解決編で書いたように、すべてRubyがshared_enabledになっていなかったことが原因!
bundle installしなおすと、qtbindings 4.8.6.2では以下のエラーとなった(gcc -v=4.8.2-15)
[ 84%] Building CXX object ruby/qtruby/src/CMakeFiles/qtruby4shared.dir/marshall_types.o
Linking CXX shared library libqtruby4shared.so
/opt/rubies/2.5.1/lib/libruby-static.a(sprintf.o): In function `rb_str_catf':
/tmp/ruby-build.20180406155226.32192/ruby-2.5.1/sprintf.c:1493: multiple definition of
`rb_str_catf'
CMakeFiles/qtruby4shared.dir/Qt.o:Qt.cpp:(.text+0x151b): first defined here
/opt/rh/devtoolset-2/root/usr/libexec/gcc/x86_64-redhat-linux/4.8.2/ld:
/opt/rubies/2.5.1/lib/libruby-static.a(array.o): relocation R_X86_64_PC32 against symbol
`rb_ary_replace' can not be used when making a shared object; recompile with -fPIC
/opt/rh/devtoolset-2/root/usr/libexec/gcc/x86_64-redhat-linux/4.8.2/ld: final link failed: Bad
value
collect2: error: ld returned 1 exit status
make[3]: *** [ruby/qtruby/src/libqtruby4shared.so.2.0.0] Error 1
make[3]: Leaving directory `/home/anagix/.gem/ruby/2.5.1/gems/qtbindings-4.8.6.2/ext/build'
make[2]: *** [ruby/qtruby/src/CMakeFiles/qtruby4shared.dir/all] Error 2
make[2]: Leaving directory `/home/anagix/.gem/ruby/2.5.1/gems/qtbindings-4.8.6.2/ext/build'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/anagix/.gem/ruby/2.5.1/gems/qtbindings-4.8.6.2/ext/build'
make: *** [build] Error 2
4.8.6.4では、以下のエラーだった。(同じに見える)
[ 84%] Building CXX object ruby/qtruby/src/CMakeFiles/qtruby4shared.dir/marshall_types.o
Linking CXX shared library libqtruby4shared.so
/opt/rh/devtoolset-2/root/usr/libexec/gcc/x86_64-redhat-linux/4.8.2/ld:
/opt/rubies/2.5.1/lib/libruby-static.a(array.o): relocation R_X86_64_PC32 against symbol
`rb_ary_replace' can not be used when making a shared object; recompile with -fPIC
/opt/rh/devtoolset-2/root/usr/libexec/gcc/x86_64-redhat-linux/4.8.2/ld: final link failed: Bad
value
collect2: error: ld returned 1 exit status
make[3]: *** [ruby/qtruby/src/libqtruby4shared.so.2.0.0] Error 1
make[3]: Leaving directory `/home/anagix/.gem/ruby/2.5.1/gems/qtbindings-4.8.6.4/ext/build'
make[2]: *** [ruby/qtruby/src/CMakeFiles/qtruby4shared.dir/all] Error 2
make[2]: Leaving directory `/home/anagix/.gem/ruby/2.5.1/gems/qtbindings-4.8.6.4/ext/build'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/anagix/.gem/ruby/2.5.1/gems/qtbindings-4.8.6.4/ext/build'
make: *** [build] Error 2
devtools-2をやめて、gcc-4.4.7にして、qtbindings 4.8.6.2でbundle installしても以下のエラーになる。cmakeは
version 2.8.12.2なので問題なさげ。
[ 84%] Building CXX object ruby/qtruby/src/CMakeFiles/qtruby4shared.dir/marshall_types.o
Linking CXX shared library libqtruby4shared.so
/opt/rubies/2.5.1/lib/libruby-static.a(sprintf.o): In function `rb_str_catf':
/tmp/ruby-build.20180406155226.32192/ruby-2.5.1/sprintf.c:1493: multiple definition of
`rb_str_catf'
CMakeFiles/qtruby4shared.dir/Qt.o:Qt.cpp:(.text+0x1639): first defined here
/usr/bin/ld: /opt/rubies/2.5.1/lib/libruby-static.a(array.o): relocation R_X86_64_PC32 against
symbol `rb_ary_replace' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value
collect2: ld returned 1 exit status
make[3]: *** [ruby/qtruby/src/libqtruby4shared.so.2.0.0] Error 1
make[3]: Leaving directory `/home/anagix/.gem/ruby/2.5.1/gems/qtbindings-4.8.6.2/ext/build'
make[2]: *** [ruby/qtruby/src/CMakeFiles/qtruby4shared.dir/all] Error 2
make[2]: Leaving directory `/home/anagix/.gem/ruby/2.5.1/gems/qtbindings-4.8.6.2/ext/build'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/anagix/.gem/ruby/2.5.1/gems/qtbindings-4.8.6.2/ext/build'
make: *** [build] Error 2
なんか、変。/usr/local/anagix_tools/qt-4.8.5を使えばよいのか???
でやってみたが、
export QTDIR=/usr/local/anagix_tools/qt-4.8.5
[anagix@alb_server alta]$ export LD_LIBRARY_PATH=/usr/local/anagix_tools/lib:/usr/local/anagix_t\
ools/qt-4.8.5/lib
[anagix@alb_server alta]$ bundle install
同じく以下のエラー。これはおかしい。
[ 82%] Building CXX object ruby/qtruby/src/CMakeFiles/qtruby4shared.dir/marshall_types.o
Linking CXX shared library libqtruby4shared.so
/opt/rubies/2.5.1/lib/libruby-static.a(sprintf.o): In function `rb_str_catf':
/tmp/ruby-build.20180406155226.32192/ruby-2.5.1/sprintf.c:1493: multiple definition of
`rb_str_catf'
CMakeFiles/qtruby4shared.dir/Qt.o:Qt.cpp:(.text+0x1639): first defined here
/usr/bin/ld: /opt/rubies/2.5.1/lib/libruby-static.a(array.o): relocation R_X86_64_PC32 against
symbol `rb_ary_replace' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value
collect2: ld returned 1 exit status
make[3]: *** [ruby/qtruby/src/libqtruby4shared.so.2.0.0] Error 1
make[3]: Leaving directory `/home/anagix/.gem/ruby/2.5.1/gems/qtbindings-4.8.6.2/ext/build'
make[2]: *** [ruby/qtruby/src/CMakeFiles/qtruby4shared.dir/all] Error 2
make[2]: Leaving directory `/home/anagix/.gem/ruby/2.5.1/gems/qtbindings-4.8.6.2/ext/build'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/anagix/.gem/ruby/2.5.1/gems/qtbindings-4.8.6.2/ext/build'
make: *** [build] Error 2
which rubyしてみると、このrubyが--enable-sharedされてない疑惑がわいてきた。
/opt/rubies/2.5.1/bin/ruby
/opt/rubies/を調べてみると、/opt/rubies/2.2.4/lib/libruby.soはあるが、/opt/rubies/2.3.4と2.5.1にはない!!!
2018-9-20追記 【解決編】
Linkで失敗するのは、Rubyが --enable-shared で作られていなかったことが原因!
qtbindingsについては、4.8.6.2は、gcc -v4.4.7のままでコンパイルOK。4.8.6.4は、以下のようなエラーが出る
CMake Error at smoke/qtcore/QtGuess.txt:134 (if):
if given arguments:
"EQUAL" "0"
scl enable devtoolset-2 bash すれば、gcc version 4.8.2となり、問題なくインストールできる。以上!