LoadError occurs when required libraries (shared libraries or gems, etc.) are not found. Default libraries are that of ruby 1.8.7 and of Qt 4.4; these are on the load path. But my target libraries are not.
I should set load path, by using $LD_LIBRARY_PATH. Ruby 1.9.1's library path is /opt/ruby-1.9.1/lib and Qt 4.5's library path is /opt/qtsdk-2009.01/qt/lib. Setting in bash is below:
if [ -d '/opt/ruby-1.9.1/lib' ] ; then
export LD_LIBRARY_PATH='/opt/ruby-1.9.1/lib':$LD_LIBRARY_PATH
fi
if [ -d '/opt/qtsdk-2009.01/qt/lib' ] ; then
export LD_LIBRARY_PATH='/opt/qtsdk-2009.01/qt/lib':$LD_LIBRARY_PATH
fi
For KDE user, above shell script can't set /etc/bashrc, /etc/profile, .bashrc, .profile, and so on. Because default KDE is built with default Qt, and KDE will be confused if non-default Qt is loaded. So above shell script should be hand-operated.
Then check $LD_LIBRARY_PATH.
>echo $LD_LIBRARY_PATH
/opt/ruby-1.9.1/lib:/opt/qtsdk-2009.01/qt/lib:/usr/lib64/mpi/gcc/openmpi/lib64
Retry irb.
>/opt/ruby-1.9.1/bin/irb
irb(main):001:0> require 'Qt'
=> true
Let's check executable files of QtRuby.
>/opt/ruby-1.9.1/bin/rbrcc -version
Ruby Resource Compiler for Qt version 4.5.0
>/opt/ruby-1.9.1/bin/rbuic4 -v
Qt User Interface Compiler version 4.5.0
>/opt/ruby-1.9.1/bin/rbqtapi -v
/usr/lib64/ruby/site_ruby/1.8/x86_64-linux/qtruby4.so: /usr/lib64/ruby/site_ruby/1.8/x86_64-linux/qtruby4.so: undefined symbol: classname - /usr/lib64/ruby/site_ruby/1.8/x86_64-linux/qtruby4.so (LoadError)
from /usr/lib64/ruby/site_ruby/1.8/Qt4.rb:5
from /opt/ruby-1.9.1/bin/rbqtapi:6:in `require'
from /opt/ruby-1.9.1/bin/rbqtapi:6
What happen in rbqtapi. show this file until line 6.
#!/usr/bin/env ruby
# Note: this program is part of qtruby and makes use of its internal functions.
# You should not rely on those in your own programs.
require 'Qt4'
Line 1, shebang indicates ruby on the $PATH. Normally, ruby 1.9.1 executable should be added to $PATH, but I planned to rewrite shebang locally.
#!/opt/ruby-1.9.1/bin/ruby
Retry rbqtapi.
>/opt/ruby-1.9.1/bin/rbqtapi -v
QtRuby 2.0.2 using Qt-4.5.0
Finally, Build succeeds!
No comments:
Post a Comment