Saturday, March 21, 2009

Build QtRuby with Ruby 1.9.1 and Qt 4.5 #2

(continued from phosphorescence: Build QtRuby with Ruby 1.9.1 and Qt 4.5 #1)

First, cmake finds default Ruby.
-- Ruby found: /usr/lib64/libruby.so

I certainly set -DRUBY_EXECUTABLE=/opt/ruby-1.9.1/bin/ruby and -DRUBY_INCLUDE_PATH=/opt/ruby-1.9.1/include/ruby-1.9.1. What do I lack? I seek the file related to cmake's ruby options, then it's found: cmake/modules/FindRUBY.cmake. At line 80~82 in this file, notable block is found.
IF(NOT RUBY_FIND_QUIETLY)
  MESSAGE(STATUS "Ruby found: ${RUBY_LIBRARY}")
ENDIF(NOT RUBY_FIND_QUIETLY)

I guess cmake requires -DRUBY_LIBRARY, so I should set path to ruby 1.9.1's shared library.

I mentioned in phosphorescence: Install Ruby 1.9.1, I forgot --enable-shared option. So I again build ruby 1.9.1 with --enable-shared option, then shared library was created.

Second, cmake finds default Qt.
-- Found Qt-Version 4.4.3 (using /usr/bin/qmake)

I remember not to set cmake's Qt options, so I seek related file, then it's found: cmake/modules/FindQt4.cmake. At line 1423~1425 in this file, notable block is found.
IF( NOT Qt4_FIND_QUIETLY)
  MESSAGE(STATUS "Found Qt-Version ${QTVERSION} (using ${QT_QMAKE_EXECUTABLE})")
ENDIF( NOT Qt4_FIND_QUIETLY)

I guess cmake requires -DQT_QMAKE_EXECUTABLE, so I should set Qt 4.5's qmake path.

Clean and retry building QtRuby.
test -r Makefile && make clean
rm CMakeCache.txt CMakeFiles/*log

>cmake \
>-DCMAKE_INSTALL_PREFIX=/opt/ruby-1.9.1 \
>-DRUBY_EXECUTABLE=/opt/ruby-1.9.1/bin/ruby \
>-DRUBY_INCLUDE_PATH=/opt/ruby-1.9.1/include/ruby-1.9.1 \
>-DRUBY_LIBRARY=/opt/ruby-1.9.1/lib/libruby.so.1.9.1 \
>-DQT_QMAKE_EXECUTABLE=/opt/qtsdk-2009.01/qt/bin/qmake \
>...

Check the appropriate output.
-- Found Qt-Version 4.5.0 (using /opt/qtsdk-2009.01/qt/bin/qmake)
-- Ruby found: /opt/ruby-1.9.1/lib/libruby.so.1.9.1

That's OK. Rest instruction goes. It takes a few minutes.
make
sudo make install

CMMI instructions succeed at this time. Result is shown on standard output and install_manifest.txt file in current directory.

So let's begin happy QtRuby computing. Launch irb.
>/opt/ruby-1.9.1/bin/irb
irb(main):001:0> require 'Qt'
LoadError: /opt/ruby-1.9.1/lib/ruby/site_ruby/1.9.1/x86_64-linux/qtruby4.so: undefined symbol: IdToClassNameMap - /opt/ruby-1.9.1/lib/ruby/site_ruby/1.9.1/x86_64-linux/qtruby4.so
from /opt/ruby-1.9.1/lib/ruby/site_ruby/1.9.1/Qt.rb:1:in `require'
from /opt/ruby-1.9.1/lib/ruby/site_ruby/1.9.1/Qt.rb:1:in `'
from (irb):1:in `require'
from (irb):1
from /opt/ruby-1.9.1/bin/irb:12:in `
'

Well, It's still unhappy. to be continued...

No comments:

Post a Comment