compiling 32 bit application on 64 bit linux(x86_64)
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
If you have a toolchain that supports multilib, then you would pass the -m32 flag to the compiler to generate 32-bit, i386 compatible code. If you don't have a toolchain with multilib support, you can't create 32-bit apps or libs on an x86_64 system.
hi weibullguy,
im getting following errors while linking(using gcc)
/usr/bin/ld: warning: i386 architecture of input file `global.o' is incompatible with i386 output
/usr/bin/ld: warning: i386 architecture of input file `Logger.o' is incompatible with i386 output
/usr/bin/ld: warning: i386 architecture of input file `tap311.o' is incompatible with i386 output
when i used ld with -m elf_i386 (as suggest by osor) i got follwing errors but executable is created
ld: warning: cannot find entry symbol _start; defaulting to 0000000008048a80
and executable is throwing this error
-bash: ./myapp: /usr/lib/libc.so.1: bad ELF interpreter: No such file or directory
hi all,
created object files and i am able to link them using -m32....now i have a 32bit executable on x86_64 machine...but when i tried to execute i am getting segmentation fault error.
(i copied 32bit executable from i386 machine to x86_64 machine and it s working fine. both i386 and x86_64 machines have same version of gcc and glibc)
When I compile this on my 32bit machine, the executable run on both machine.
When I compile this on my 64bit machine with the option -m32:
Quote:
gcc -m32 main.c
It run only on the 64bit machine. On the other on, I got this error :
Quote:
$ ./a.out
Floating exception
With google, it seems that am the only human with this problem (X_X)
Here my gcc version :
64bit :
Quote:
$ gcc --version
gcc (GCC) 4.1.2 20070925 (Red Hat 4.1.2-33)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
32bit :
Quote:
$ gcc --version
gcc (GCC) 4.1.0 20060304 (Red Hat 4.1.0-3)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
When I compile this on my 32bit machine, the executable run on both machine.
When I compile this on my 64bit machine with the option -m32:
It run only on the 64bit machine. On the other on, I got this error :
With google, it seems that am the only human with this problem (X_X)
Have you considered that the architecture is being used during compilation and/or linking? I.e., there may be architecture-specific optimizations available to your Xeon over your 32-bit machine apart from its 64-bittedness.
I tried the option -march=i686 : nothing changed ... (I tried also i386 i586)
Quote:
Have you considered that the architecture is being used during compilation and/or linking? I.e., there may be architecture-specific optimizations available to your Xeon over your 32-bit machine apart from its 64-bittedness.
hi all,
created object files and i am able to link them using -m32....now i have a 32bit executable on x86_64 machine...but when i tried to execute i am getting segmentation fault error.
(i copied 32bit executable from i386 machine to x86_64 machine and it s working fine. both i386 and x86_64 machines have same version of gcc and glibc)
Thanks and Regards,
uttam hoode
YOU CANT RUN A 32 BIT EXE ON A 64BIT MACHINE!!! WHAT KIND OF PERSON KNOWS THE TERMS "32-BIT", "64-BIT", PROGRAMS, BUT DOESNT KNOW THAT??!!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.