We develop software and are beginning a slow transition from 32 bit applications to their 64 bit equivalents. During this period it will be necessary to build programs targeted for both environments using the x86-64 machines for development.
here is a simple/small "application", sizes.c:
#include <stdio.h> #include <stdlib.h>
int main(int argc, char **argv) { printf("Various sizes:\n"); printf(" short = %d\n", sizeof(short)); printf(" int = %d\n", sizeof(int)); printf(" long = %d\n", sizeof(long)); printf(" float = %d\n", sizeof(float)); printf(" double = %d\n", sizeof(double)); return 0; }
if I build it using:
gcc -m32 -Wall -osizes sizes.c
there are no warnings or complaints and a functioning 32 bit program runs, giving the size of a long as 4 bytes. (Of course without the m32 flag the size of long is 8 bytes.)
if I try to do the equivalent in two steps:
gcc -c -m32 -Wall sizes.c gcc -osizes -Wl,-m,elf_i386 sizes.o
the result is: /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-redhat-linux/4.1.2/libgcc.a when searching for -lgcc /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-redhat-linux/4.1.2/libgcc.a when searching for -lgcc /usr/bin/ld: cannot find -lgcc collect2: ld returned 1 exit status
there is some confusion in the man pages as to whether the correct 32 bit emulation is elf_i386 or i386linux so:
gcc -osizes -Wl,-m,i386linux sizes.o gives result: /usr/bin/ld: unrecognized option '--eh-frame-hdr' /usr/bin/ld: use the --help option for usage information collect2: ld returned 1 exit status
since the single line command works it seems that there must be a way to get the job done. This becomes important when there are many source files and use of a traditional makefile is involved where compiling and linking are separate steps.
Thanks in advance for reading this, roger wells
perhaps linux32 helps you out
man linux32
greetings
Juergen
Roger K. Wells wrote:
We develop software and are beginning a slow transition from 32 bit applications to their 64 bit equivalents. During this period it will be necessary to build programs targeted for both environments using the x86-64 machines for development.
here is a simple/small "application", sizes.c:
#include <stdio.h> #include <stdlib.h>
int main(int argc, char **argv) { printf("Various sizes:\n"); printf(" short = %d\n", sizeof(short)); printf(" int = %d\n", sizeof(int)); printf(" long = %d\n", sizeof(long)); printf(" float = %d\n", sizeof(float)); printf(" double = %d\n", sizeof(double)); return 0; }
if I build it using:
gcc -m32 -Wall -osizes sizes.c
there are no warnings or complaints and a functioning 32 bit program runs, giving the size of a long as 4 bytes. (Of course without the m32 flag the size of long is 8 bytes.)
if I try to do the equivalent in two steps:
gcc -c -m32 -Wall sizes.c gcc -osizes -Wl,-m,elf_i386 sizes.o
the result is: /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-redhat-linux/4.1.2/libgcc.a when searching for -lgcc /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-redhat-linux/4.1.2/libgcc.a when searching for -lgcc /usr/bin/ld: cannot find -lgcc collect2: ld returned 1 exit status
there is some confusion in the man pages as to whether the correct 32 bit emulation is elf_i386 or i386linux so:
gcc -osizes -Wl,-m,i386linux sizes.o gives result: /usr/bin/ld: unrecognized option '--eh-frame-hdr' /usr/bin/ld: use the --help option for usage information collect2: ld returned 1 exit status
since the single line command works it seems that there must be a way to get the job done. This becomes important when there are many source files and use of a traditional makefile is involved where compiling and linking are separate steps.
Thanks in advance for reading this, roger wells
Juergen Gotteswinter wrote:
perhaps linux32 helps you out
man linux32
thanks Juergen. that seems to set the environment for the program that is to be run, e.g. make, gcc, ld, etc. Not so much the environment where the target will run. roger wells
greetings
Juergen
Roger K. Wells wrote:
We develop software and are beginning a slow transition from 32 bit applications to their 64 bit equivalents. During this period it will be necessary to build programs targeted for both environments using the x86-64 machines for development.
here is a simple/small "application", sizes.c:
#include <stdio.h> #include <stdlib.h>
int main(int argc, char **argv) { printf("Various sizes:\n"); printf(" short = %d\n", sizeof(short)); printf(" int = %d\n", sizeof(int)); printf(" long = %d\n", sizeof(long)); printf(" float = %d\n", sizeof(float)); printf(" double = %d\n", sizeof(double)); return 0; }
if I build it using:
gcc -m32 -Wall -osizes sizes.c
there are no warnings or complaints and a functioning 32 bit program runs, giving the size of a long as 4 bytes. (Of course without the m32 flag the size of long is 8 bytes.)
if I try to do the equivalent in two steps:
gcc -c -m32 -Wall sizes.c gcc -osizes -Wl,-m,elf_i386 sizes.o
the result is: /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-redhat-linux/4.1.2/libgcc.a when searching for -lgcc /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-redhat-linux/4.1.2/libgcc.a when searching for -lgcc /usr/bin/ld: cannot find -lgcc collect2: ld returned 1 exit status
there is some confusion in the man pages as to whether the correct 32 bit emulation is elf_i386 or i386linux so:
gcc -osizes -Wl,-m,i386linux sizes.o gives result: /usr/bin/ld: unrecognized option '--eh-frame-hdr' /usr/bin/ld: use the --help option for usage information collect2: ld returned 1 exit status
since the single line command works it seems that there must be a way to get the job done. This becomes important when there are many source files and use of a traditional makefile is involved where compiling and linking are separate steps.
Thanks in advance for reading this, roger wells
CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
Roger K. Wells wrote:
Juergen Gotteswinter wrote:
perhaps linux32 helps you out
man linux32
thanks Juergen. that seems to set the environment for the program that is to be run, e.g. make, gcc, ld, etc. Not so much the environment where the target will run.
You can always run VMware server or virtualbox and install a complete 32 bit system on the same host for a real build/test environment.
You can always run VMware server or virtualbox and install a complete 32 bit system on the same host for a real build/test environment.
Don't forget about KVM. It just a yum install.
Neil
-- Neil Aggarwal, (281)846-8957, http://JAMMConsulting.com CentOS 5.4 VPS with unmetered bandwidth only $25/month! 7 day no risk trial! http://UnmeteredVPS.net for details.
On Wed, Nov 11, 2009 at 2:47 PM, Neil Aggarwal neil@jammconsulting.com wrote:
You can always run VMware server or virtualbox and install a complete 32 bit system on the same host for a real build/test environment.
Don't forget about KVM. It just a yum install.
Neil
-- Neil Aggarwal, (281)846-8957, http://JAMMConsulting.com CentOS 5.4 VPS with unmetered bandwidth only $25/month! 7 day no risk trial! http://UnmeteredVPS.net for details.
CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
Why overdo it?
http://cormander.com/blog/2009/06/installing-a-32bit-build-chroot/
Les Mikesell wrote:
Roger K. Wells wrote:
Juergen Gotteswinter wrote:
perhaps linux32 helps you out
man linux32
thanks Juergen. that seems to set the environment for the program that is to be run, e.g. make, gcc, ld, etc. Not so much the environment where the target will run.
You can always run VMware server or virtualbox and install a complete 32 bit system on the same host for a real build/test environment.
Thanks for the reply. That shouldn't be necessary since I can build 32 bit applications that work, just not with separate invocations of the compiler and linker. I think I must be missing appropriate flags to the linker, I just don't know what they are. roger wells
Roger K. Wells wrote:
Juergen Gotteswinter wrote:
perhaps linux32 helps you out
man linux32
thanks Juergen. that seems to set the environment for the program that is to be run, e.g. make, gcc, ld, etc. Not so much the environment where the target will run.
My first thought would be to set -L to 64-bit or 32-bit libraries.
Oh, one more thing: is performance a Big Thing? If that isn't priority #1, you might turn off optimization 3? 4? which unrolls loops, etc.
mark