QtRuby OS X Tiger

H

Hans Fugal

QtRuby is neat, and pleasantly easy to get working on Debian, which
makes it my first choice of late. (Although FxRuby is also easy to get
working on Debian, although not _as_ easy. But then there's Qt
Designer)

Unfortunately, QtRuby on OS X Tiger is not for the faint-of-heart. In
fact, it looks like it's not for anyone shy of a Qt or KDE developer,
at the rate I'm going. After 2 weekends I FINALLY got the thing to
compile and install, which I thought was my final triumph. Only to find
when I run anything (e.g. the Hello World in the QtRuby Friday), the
QtRuby window is behind the controlling terminal, with no way to bring
it to the foreground and apparently no way to give it focus (it always
maintains the out-of-focus look). I can drag it around, and bring it in
front of other windows, but not the terminal window. And I can't resize
it either. The same goes for a program I have written that runs fine on
linux.

Have I taken a wrong turn somewhere? Anyone on Tiger have different
experience? I have QtRuby 1.0.9, qt-mac-free-3.3.5 straight from
trolltech, and have followed the instructions faithfully. Even then I
had enourmous difficulty, but basically only two changes were needed,
that I can remember off the top of my head: x_7.cpp in the smoke build
has a compile-time bug that I just "fixed" (it may not work right, but
at least it compiles now), and libsmoke is not being found in /usr/lib
for some reason by require 'Qt', so I did

ln -s /usr/lib/libsmoke* /Developer/qt/lib

Am I going crazy, or are others having similar problems?
 
C

Caleb Tennis

Have I taken a wrong turn somewhere? Anyone on Tiger have different
experience? I have QtRuby 1.0.9, qt-mac-free-3.3.5 straight from
trolltech, and have followed the instructions faithfully. Even then I
had enourmous difficulty, but basically only two changes were needed,
that I can remember off the top of my head: x_7.cpp in the smoke build
has a compile-time bug that I just "fixed" (it may not work right, but

Yeah, this is a bug that didn't make it into the book (because I fixed it
locally, but forgot to address it). It's been fixed in the qtruby sources,
so the next release should take care of it. Any fix should work (I just
changed the line to ... = 0), because that function should never be called
from within QtRuby anyway.
at least it compiles now), and libsmoke is not being found in /usr/lib
for some reason by require 'Qt', so I did

ln -s /usr/lib/libsmoke* /Developer/qt/lib

This sounds like the dynamic linker just needs a refresh. I don't have my Mac
in front of me right now, but I'll play with it a little later and see if I
can't reproduce the issue.
Am I going crazy, or are others having similar problems?

I hope you're not going crazy! There's an errata page
( http://books.pragprog.com/titles/ctrubyqt/errata ) that you can also use to
check on issues/post new ones that may be helpful to others who are
experiencing the same issues.

Caleb
 
H

Hans Fugal

Any fix should work (I just
changed the line to ... = 0), because that function should never be called
from within QtRuby anyway.

Ok, good to know I didn't break anything.
This sounds like the dynamic linker just needs a refresh. I don't have my Mac
in front of me right now, but I'll play with it a little later and see if I
can't reproduce the issue.

Hmm, maybe. How do I refresh it?

Don't forget to see if you get the weird behavior, since that is what
is currently not working for me. Thanks!
 
H

Hans Fugal

at least it compiles now), and libsmoke is not being found in /usr/lib
This sounds like the dynamic linker just needs a refresh. I don't have my Mac
in front of me right now, but I'll play with it a little later and see if I
can't reproduce the issue.

I figured this one out. Somehow My DYLD_FALLBACK_LIBRARY_PATH got set
to ":". Setting it to its nominal default (according to [1])
"$HOME/lib:/usr/local/lib:/usr/lib" made it work without the symlinks.

1.
http://developer.apple.com/documentation/DeveloperTools/Conceptual/DynamicLibraries/index.html
 
H

Hans Fugal

at least it compiles now), and libsmoke is not being found in /usr/lib
This sounds like the dynamic linker just needs a refresh. I don't have my Mac
in front of me right now, but I'll play with it a little later and see if I
can't reproduce the issue.

I figured this one out. Somehow My DYLD_FALLBACK_LIBRARY_PATH got set
to ":". Setting it to its nominal default (according to [1])
"$HOME/lib:/usr/local/lib:/usr/lib" made it work without the symlinks.

1.
http://developer.apple.com/documentation/DeveloperTools/Conceptual/DynamicLibraries/index.html
 
H

Hans Fugal

Ok, I figured out the strange behavior and QtRuby is finally working
perfectly for me.

The only thing I was missing was the blurb at the end of the INSTALL
file about making rubyw. This escaped me for a long time because I
could swear I did this my first time through the INSTALL file mantra,
and I figured that didn't need to be done again.

So in summary, here is what _I_ had to do to get QtRuby working on my
Tiger system. First I built Qt (qt-mac-free-3.3.5) according to the
instructions from Trolltech in its INSTALL file, including setting
QTDIR, DYLD_LIBRARY_PATH, and PATH. Then I downloaded and untarred
qtruby-1.0.9, and changed into that directory. Then this:

make -f Makefile.cvs
../configure --enable-mac
cd smoke/qt
perl generate.pl
qmake -makefile
sed -i '' '1360d' x_7.cpp
make
# This is because /sw/bin/init.sh (fink) sets
# DYLD_FALLBACK_LIBRARY_PATH=:
sudo ln -s /usr/lib/libsmoke* /Developer/qt/lib
cd ../../qtruby/rubylib/qtruby
ruby extconf.rb --with-qt-dir=$QTDIR --with-smoke-dir=/usr \
--with-smoke-include=../../../smoke
make
sudo make install
cd ../designer/rbuic
qmake -makefile
sudo make
cd ../uilib
ruby extconf.rb --with-qt-dir=$QTDIR --with-qtruby-include=../../qtruby
make
sudo make install
ruby=`which ruby`
rubyw=${ruby}w
sudo cp $ruby $rubyw
sudo /Developer/Tools/Rez -t APPL Carbon.r -o $rubyw


By the way, is it really necessary to make a new rubyw? Is there
anything wrong with running that Rez command on your only ruby
executable? It looks like the ruby on my path is the darwinports one, I
wonder if the OS X native one doesn't need the Rez command (but I'm
sick of recompiling qtruby so I'll leave that as an exercise to the
avid reader)
 
T

travis laduke

Ok, I figured out the strange behavior and QtRuby is finally working
perfectly for me.

The only thing I was missing was the blurb at the end of the INSTALL
file about making rubyw. This escaped me for a long time because I
could swear I did this my first time through the INSTALL file mantra,
and I figured that didn't need to be done again.

So in summary, here is what _I_ had to do to get QtRuby working on my
Tiger system. First I built Qt (qt-mac-free-3.3.5) according to the
instructions from Trolltech in its INSTALL file, including setting
QTDIR, DYLD_LIBRARY_PATH, and PATH. Then I downloaded and untarred
qtruby-1.0.9, and changed into that directory. Then this:

make -f Makefile.cvs
../configure --enable-mac
cd smoke/qt
perl generate.pl
qmake -makefile
sed -i '' '1360d' x_7.cpp
make
# This is because /sw/bin/init.sh (fink) sets
# DYLD_FALLBACK_LIBRARY_PATH=:
sudo ln -s /usr/lib/libsmoke* /Developer/qt/lib
cd ../../qtruby/rubylib/qtruby
ruby extconf.rb --with-qt-dir=$QTDIR --with-smoke-dir=/usr \
--with-smoke-include=../../../smoke
make
sudo make install
cd ../designer/rbuic
qmake -makefile
sudo make
cd ../uilib
ruby extconf.rb --with-qt-dir=$QTDIR --with-qtruby-include=../../
qtruby
make
sudo make install
ruby=`which ruby`
rubyw=${ruby}w
sudo cp $ruby $rubyw
sudo /Developer/Tools/Rez -t APPL Carbon.r -o $rubyw


By the way, is it really necessary to make a new rubyw? Is there
anything wrong with running that Rez command on your only ruby
executable? It looks like the ruby on my path is the darwinports
one, I
wonder if the OS X native one doesn't need the Rez command (but I'm
sick of recompiling qtruby so I'll leave that as an exercise to the
avid reader)

this is impossible. i tried to get qtruby working a couple weekends,
tried quite a few times and couldn't get it to work. i gave up and
thought i'd come back to it later.
now i found this thread and i'm trying again. anyways, here's where i
get stuck now (doing make in smoke/qt):
i get a bunch of errors like this right before it fails if anyone
wants to take a stab at it:

typeinfo for QDomNodereferenced from libsmokeqt expected to be
defined in libqt.3.dylib

i'm pretty sure this is because i have libqt-mt.3.dylib, but i have
no idea how to tell it to look for that instead?

last time i tried to do this, qtruby kept complaining about me not
compiling qt with threads, so i went back and recompiled.

if there's no way to help me from the fragments i've just given, what
do i need to delete before i start over again? if i start compiling
qt and then qtruby again, will it just write over everything, or do i
have to remove it first?

ps i'm using qtruby-1.0.9 and qt-mac-free-3.3.5

waiting to read his qtruby pdf tutorial thing,
--travis
 
H

Hans Fugal

typeinfo for QDomNodereferenced from libsmokeqt expected to be defined in libqt.3.dylib

Hmm, not sure. I didn't get these errors. You are following the
instructions in the INSTALL very carefully, right?

Let's work through this.

If you want to, (and it might be a good idea), you should be able to
rebuild qt without any ill effects. If you followed the directions in
the qt INSTALL file, you should just be able to go to /Developer/Qt and
follow the INSTALL instructions again. You're gonna want -thread, but I
don't think anything else should matter much. I used these flags,
mostly because that's (almost?) exactly what the qtruby INSTALL file
said to do and by now I was paranoid about things like configure flags,
but I think it should work just just about any reasonable flags. (oh
and btw I used qt-mac-free-3.3.5 as well)

-system-zlib -qt-gif -plugin -imgfmt-mng -thread -no-stl -no-exceptions
-fast

If I were you I'd delete your qtruby tree and unpack it fresh, then
read and run this script: http://hans.fugal.net/src/qtruby-tiger.sh
 
T

travis laduke

Hmm, not sure. I didn't get these errors. You are following the
instructions in the INSTALL very carefully, right?

Let's work through this.

If you want to, (and it might be a good idea), you should be able to
rebuild qt without any ill effects. If you followed the directions in
the qt INSTALL file, you should just be able to go to /Developer/Qt
and
follow the INSTALL instructions again. You're gonna want -thread,
but I
don't think anything else should matter much. I used these flags,
mostly because that's (almost?) exactly what the qtruby INSTALL file
said to do and by now I was paranoid about things like configure
flags,
but I think it should work just just about any reasonable flags. (oh
and btw I used qt-mac-free-3.3.5 as well)

-system-zlib -qt-gif -plugin -imgfmt-mng -thread -no-stl -no-
exceptions
-fast

If I were you I'd delete your qtruby tree and unpack it fresh, then
read and run this script: http://hans.fugal.net/src/qtruby-tiger.sh

thanks for the help. still can't get it though. i wonder what i'm
missing. if it means, anything all the qt example programs work.

here's how it dies:

make: *** [qui.bundle] Error 1
cc -dynamic -bundle -undefined suppress -flat_namespace -L/opt/local/
lib -L"/Developer/qt/lib" -L"/opt/local/lib" -o qui.bundle qui.o -
bundle_loader ../../qtruby/qtruby.bundle -lsmokeqt -lqui -lqt-mt -
lstdc++ -lruby -ldl -lobjc
/usr/bin/ld: can't open: ../../qtruby/qtruby.bundle (No such file or
directory, errno = 2)
collect2: ld returned 1 exit status
make: *** [qui.bundle] Error 1

i think it actually does that, or something similar, a couple times
and tries a few times before it gives up.

there's a ton of warnings and errors before that. lots of these:
typeinfo for QDockWindowreferenced from libsmokeqt expected to be
defined in libqt.3.dylib

i guess every single one of those things fails.

hrm?
 
H

Hans Fugal

make: *** [qui.bundle] Error 1
cc -dynamic -bundle -undefined suppress -flat_namespace -L/opt/local/
lib -L"/Developer/qt/lib" -L"/opt/local/lib" -o qui.bundle qui.o -
bundle_loader ../../qtruby/qtruby.bundle -lsmokeqt -lqui -lqt-mt -
lstdc++ -lruby -ldl -lobjc
/usr/bin/ld: can't open: ../../qtruby/qtruby.bundle (No such file or
directory, errno = 2)
collect2: ld returned 1 exit status
make: *** [qui.bundle] Error 1


Hmm, you've stumped me here. Have you checked that the file in question
actually exists? (../../qtruby/qtruby.bundle). Is there an error
building in that subdir?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top