Qt-interest Archive, June 2007
RE: Compile to a 32bits machine on a 64bits machine
Message 1 in thread
Hello Josinei,
Your problem got me thinking. And I don't see why, technically, one could
not compile for a 64 bits binary on a 32 bits machine with the same OS. I
think I am going to try and research this a little...
The following
http://www.cyberciti.biz/tips/compile-32bit-application-using-gcc-64-bit-linux.html
suggest that you can pass -m32 and -m64 to the gcc compiler regardless of
its environment. Maybe you can add this to the Makefile generated from your
pro file. In any event, let me research this.
Christopher
>>From: Josinei Silva <josinei_listas@xxxxxxxxxxxx>
>>To: Qt Interest <qt-interest@xxxxxxxxxxxxx>
>>Subject: Compile to a 32bits machine on a 64bits machine
>>Date: Thu, 31 May 2007 17:07:37 -0300
>>
>>Hi,
>>
>>I'm using a Turion X2 machine with openSuse 10.2 64 to develop an
>>aplication
>>that will run on some machines with openSuse 10.2 for 32 bits. Both
>>machines
>>are running Qt version that comes with orignal CDs from openSuse ( Qt
>>4.2.1 ).
>>
>>I tried to use "CONFIG += x86 on .pro but it didn't work.
>>
>>There's how to compile an application on my 64bits machine to run on
>>32bits
>>machines? How?,( if there's a way to do it )
>>
>>Thanks
>>
>>Josinei
>>
>>--
>>To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
>>"unsubscribe" in the subject or the body.
>>List archive and information: http://lists.trolltech.com/qt-interest/
>>
>
>_________________________________________________________________
>Avec Windows Live Hotmail, vous disposez du contrôle requis pour vous aider
>à assurer la confidentialité et la sécurité de votre courriel. Découvrez le
>nouveau Hotmail! www.nouveauhotmail.ca?icid=WLHMFRCA120
>
>--
>To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
>"unsubscribe" in the subject or the body.
>List archive and information: http://lists.trolltech.com/qt-interest/
>
_________________________________________________________________
Obtenez rapidement un aperçu de vos messages grâce au volet de lecture.
Passez d?un message à l?autre sans avoir à réafficher la page chaque fois.
www.nouveauhotmail.ca?icid=WLHMFRCA125
--
[ signature omitted ]
Message 2 in thread
> And I don't see why, technically, one could not compile for a 64 bits binary
on a 32 bits machine with the same OS.
Subject says: the other way. Compile 32 bit on a 64 machine.
--
[ signature omitted ]
Message 3 in thread
On Thursday 31 May 2007 22:07, Josinei Silva wrote:
> I'm using a Turion X2 machine with openSuse 10.2 64 to develop an
> aplication that will run on some machines with openSuse 10.2 for 32 bits.
> Both machines are running Qt version that comes with orignal CDs from
> openSuse ( Qt 4.2.1 ).
>
> I tried to use "CONFIG += x86 on .pro but it didn't work.
>
> There's how to compile an application on my 64bits machine to run on 32bits
> machines? How?,( if there's a way to do it )
There are several ways:
1. The most elegant (IMHO) is a bias env: for each lib you have a 32 bit and a
64 bit version, both sharing a common header. The libs are usually located
in /lib and /usr/lib for the 32 bit versions and in /lib64 and /usr/lib64 for
the 64 bit version. The ld.so is aware of this config. The shared headers are
a problem for not so well written apps...
Have a look at the -m32 -m64 flags for the gcc.
2. chroot: thats the easiest solution (IMHO): just create a 32 bit system
somewhere inside your 64 bit env, chroot for compilation into this system.
See mount --bind which will help you sharing some common dirs. I'm using 64
bit suse for my "host" and /suse32 is my 32 bit chroot, in /etc/fstab I have
entries like:
/home /suse32/home none bind 0 0
/tmp /suse32/tmp none bind 0 0
/proc /suse32/proc none bind 0 0
/dev /suse32/dev none bind 0 0
/etc/resolv.conf /suse32/etc/resolv.conf none bind 0 0
/usr/share/fonts /suse32/usr/share/fonts none bind 0 0
As you see with mount --bind its possible to "link" single files too,
resolv.conf is shared because I'm getting my net-config by dhcp.
3. vmware/xen and friends. Thats obvious...
HTH
Mathias
--
[ signature omitted ]
Message 4 in thread
On Thursday 31 May 2007 22:07:37 Josinei Silva wrote:
> Hi,
>
> I'm using a Turion X2 machine with openSuse 10.2 64 to develop an
> aplication that will run on some machines with openSuse 10.2 for 32 bits.
> Both machines are running Qt version that comes with orignal CDs from
> openSuse ( Qt 4.2.1 ).
>
> I tried to use "CONFIG += x86 on .pro but it didn't work.
>
> There's how to compile an application on my 64bits machine to run on 32bits
> machines? How?,( if there's a way to do it )
If your compiler supports it, you can use the linux-g++-32 mkspec, something
like:
qmake -spec linux-g++-32
which will add the -m32 command line option to gcc
--
[ signature omitted ]
Message 5 in thread
> If your compiler supports it, you can use the linux-g++-32 mkspec,
Well, ok. But normally, you have a complete tree of projects, every single
project with its own pro-file. In principle, you have to call "make" twice,
one with "linux-g++" and one with "linux-g++-32". And then there is the
problem that the resulting executables have the same name/destination path
and so on...
--
[ signature omitted ]
Message 6 in thread
> Well, ok. But normally, you have a complete tree of projects, every
single
> project with its own pro-file. In principle, you have to call "make"
twice,
> one with "linux-g++" and one with "linux-g++-32". And then there is the
> problem that the resulting executables have the same name/destination
path
> and so on...
Maybe you could set different names/destinations with
contains(QMAKESPEC, linux-g++-32) {
DESTDIR=xyz
TARGET=abc32
} else {
DESTDIR=uvw
TARGET=abc64
}
I didn't try the above - but it should work I guess ;-)
Regards,
Malte
--
[ signature omitted ]
Message 7 in thread
> contains(QMAKESPEC, linux-g++-32) {
> DESTDIR=xyz
> TARGET=abc32
> } else {
> DESTDIR=uvw
> TARGET=abc64
> }
setting DESTDIR should be enough. But how to call make twice automatically for
both with the same pro file?
--
[ signature omitted ]
Message 8 in thread
Hi,
First, thanks to everybody that helps me. this weekend i'll try to use
"qmake -spec linux-g++-32"
Right now, i'm out of office and i can't try it now. but i hope
it will work.
Excuse me for this html e-mail, but the network that i'm
connected doesn't allow to use kmail to download and awser
may e-mails, so, i'm using yahoo webmail and i didn't see
where to awser in plain text :(
Just to explain what i want:
I develop this application with a 64bits machine, but it will run on some 32bits machines.
So, i don't need a 64bits executable ( unless my own machine couldn't run my
application ). But, as a 64bits machine should be able to run a 32bits application,
i can have only a 32bits executable with no problem.
If i'll need to run qmake and make twice, it won't be a big problem becouse i'll
only need a 32btis executabe ( and a 32bits lib ) when i'll copy the application
and the library file that i use with this application to theses 32bits machine. And i
do it a few times. It will be better if i don't have to recompile everything when i'll do it.
but it's possible if necessary.
Thanks
Josinei
---------------------------------
Novo Yahoo! Cadê? - Experimente uma nova busca.