I'm developing a qt-based application and i would like to develop both 32 and 64bit version of the application on the same machine, sharing the same sources, scripts, etc.. The machine is an Ubuntu Jaunty 64bit, Intel Core i7, 8gb ram. I'm aware that by running VMWare or VirtualBox could get things working, however it doesn't seem to be a good solution since i want to use the processor (i7) at its fullness. I read about a chrooted environment and it seems to me it could be the setup i was looking for: i need the development machine also to be able to run the executables just built.
Have you any experience on that? Did you setup such a 32bit chrooted env on a 64bit host? Does it work well? How to correctly setup it?
I've been in a similar, but not exact, situation. I was developing Qt4 applications for 32 bit Windows while running on 64 bit Jaunty. A chroot'd environment will give you what you want, with the minor annoyance of having to chroot over to it to compile your 32 bit application.
What I did to compile for Windows was to set up a cross compiler specifically for that purpose. You probably won't have to do that. You can probably get away with g++ -m32 compiling to 32 bits. To avoid having to edit makefiles and such a zillion times, you can create/modify/use the specfiles that come with Qt, such that you can do "qmake -project && qmake -makefile spec blablabla" (If I remember the syntax of the command properly).
I'm also in a similar situation, and here's how I work:
I use a custom built version of Qt. I build Qt twice, with the same configure options, except for the -platform parameter, which I set to linux-g++-64 for the first build and linux-g++-32 for the second build. I also use a different -prefix to install both versions in separate directories.
I use QtCreator to build my apps. I have added both Qt versions in the Options --> Qt4 --> Qt versions dialog. I then set up two different build configurations for my projects, with the same build options, but with one using the 32 bits Qt dir, and one using the 64 bits Qt dir. QtCreator then takes care of all the magic, and I simply need to alternate between the build configurations to have both a 32-bits and a 64-bits Qt app. No chroot, no VM, no nothing, just a simple build.
There is one caveat though. Building Qt for 32-bits obviously requires 32-bits versions of most development libraries (X libs, stdlibs, etc.), which are easily obtainable on Ubuntu Jaunty with ia32-libs and lib32stdc++6. The only libs I haven't managed to find for 32-bits development on 64-bits architecture are the gstreamer libs, meaning that Phonon might not work. I needed Phonon, so I worked aroud that by building Qt in a VM, then copying the Qt's installed directory back on my dev machine.
Good luck.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With