LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This 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


Reply
  Search this Thread
Old 01-09-2008, 06:38 AM   #1
Leo Park
LQ Newbie
 
Registered: Jan 2008
Posts: 3

Rep: Reputation: 0
Question How to compile 32bit .c .cc On 64bit x86_64 systems?


Hello, guys.

I want to compile 32bit *.c and *.cc files On 64bit x86_64 systems.

But, it is not work.

---------------------------------------------------------------------------------------------------------------

bmk_mgr@ikdp101[20]: gcc --version
gcc (GCC) 3.4.3 20041212 (Red Hat 3.4.3-9.EL4)
Copyright (C) 2004 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.

bmk_mgr@ikdp101[21]: uname -a
Linux ikdp101 2.6.9-5.ELsmp #1 SMP Wed Jan 5 19:29:47 EST 2005 x86_64 x86_64 x86_64 GNU/Linux

----------------------------------------------------------------------------------------------------------------

It just work -m64 not -m32......

bmk_mgr@ikdp101[79]: gcc -m64 -o test32 test.c
bmk_mgr@ikdp101[80]: gcc -m32 -o test32 test.c
/usr/bin/ld: crt1.o: No such file: そのようなファイルやディレクトリはありません
collect2: ld はステータス 1 で終了しました
bmk_mgr@ikdp101[198]: gcc -m32 -march=i686 -o test test.c
/usr/bin/ld: crt1.o: No such file: そのようなファイルやディレクトリはありません
collect2: ld はステータス 1 で終了しました
bmk_mgr@ikdp101[199]: gcc -m32 -march=i586 -o test test.c
/usr/bin/ld: crt1.o: No such file: そのようなファイルやディレクトリはありません
collect2: ld はステータス 1 で終了しました
bmk_mgr@ikdp101[200]: gcc -m32 -march=i486 -o test test.c
/usr/bin/ld: crt1.o: No such file: そのようなファイルやディレクトリはありません
collect2: ld はステータス 1 で終了しました
bmk_mgr@ikdp101[201]: gcc -m32 -march=i386 -o test test.c
/usr/bin/ld: crt1.o: No such file: そのようなファイルやディレクトリはありません
collect2: ld はステータス 1 で終了しました
----------------------------------------------------------------------------------------------------------------

How can I do to compile 32bit binary on 64bit OS systems?

Please help me......


Thanks and Regards,
Leo Park
 
Old 01-09-2008, 07:44 AM   #2
weibullguy
ReliaFree Maintainer
 
Registered: Aug 2004
Location: Kalamazoo, Michigan
Distribution: Slackware 14.2
Posts: 2,815
Blog Entries: 1

Rep: Reputation: 261Reputation: 261Reputation: 261
Your toolchain has to be built for multilib support. Execute the following and see what you get
Code:
/lib/libc.so.6
/lib64/libc.so.6
If either one fails (I suspect the first might), then you don't have multilib support on your system.
 
Old 01-09-2008, 06:32 PM   #3
Leo Park
LQ Newbie
 
Registered: Jan 2008
Posts: 3

Original Poster
Rep: Reputation: 0
Exclamation

Quote:
Originally Posted by weibullguy View Post
Your toolchain has to be built for multilib support. Execute the following and see what you get
Code:
/lib/libc.so.6
/lib64/libc.so.6
If either one fails (I suspect the first might), then you don't have multilib support on your system.
Thanks Weibullguy!
I checked and excuted codes what you said "/lib/libc.so.6 and /lib64/libc.so.6".
I think it's no problem.

----------------------------------------------------
bmk_mgr@ikdp101[21]: pwd
/lib
bmk_mgr@ikdp101[22]: ls libc.so.6
libc.so.6@
bmk_mgr@ikdp101[23]: libc.so.6
GNU C Library stable release version 2.3.4, by Roland McGrath et al.
Copyright (C) 2004 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.
Compiled by GNU CC version 3.4.3 20041212 (Red Hat 3.4.3-9.EL4).
Compiled on a Linux 2.4.20 system on 2004-12-20.
Available extensions:
GNU libio by Per Bothner
crypt add-on version 2.1 by Michael Glad and others
linuxthreads-0.10 by Xavier Leroy
The C stubs add-on version 2.1.2.
BIND-8.2.3-T5B
NIS(YP)/NIS+ NSS modules 0.19 by Thorsten Kukuk
Glibc-2.0 compatibility add-on by Cristian Gafton
GNU Libidn by Simon Josefsson
libthread_db work sponsored by Alpha Processor Inc
Thread-local storage support included.
For bug reporting instructions, please see:
<http://www.gnu.org/software/libc/bugs.html>.
bmk_mgr@ikdp101[24]: cd /lib64
bmk_mgr@ikdp101[25]: pwd
/lib64
bmk_mgr@ikdp101[26]: libc.so.6
GNU C Library stable release version 2.3.4, by Roland McGrath et al.
Copyright (C) 2004 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.
Compiled by GNU CC version 3.4.3 20041212 (Red Hat 3.4.3-9.EL4).
Compiled on a Linux 2.4.20 system on 2004-12-20.
Available extensions:
GNU libio by Per Bothner
crypt add-on version 2.1 by Michael Glad and others
linuxthreads-0.10 by Xavier Leroy
The C stubs add-on version 2.1.2.
GNU Libidn by Simon Josefsson
BIND-8.2.3-T5B
libthread_db work sponsored by Alpha Processor Inc
NIS(YP)/NIS+ NSS modules 0.19 by Thorsten Kukuk
Thread-local storage support included.
For bug reporting instructions, please see:
<http://www.gnu.org/software/libc/bugs.html>.
bmk_mgr@ikdp101[27]:
----------------------------------------------------

I am sorry, this time is my first time on Linux system.
I have to work to compile 32bit c and cc files on 64bit Linux OS.
Please...Help me!!
Thanks and rigards....

Last edited by Leo Park; 01-09-2008 at 07:12 PM.
 
Old 01-09-2008, 10:27 PM   #4
weibullguy
ReliaFree Maintainer
 
Registered: Aug 2004
Location: Kalamazoo, Michigan
Distribution: Slackware 14.2
Posts: 2,815
Blog Entries: 1

Rep: Reputation: 261Reputation: 261Reputation: 261
Do you have the glibc development files installed? The package would be named something like libc-dev or libc6-dev. There may be two, one with -i386 or something to differentiate it as the 32-bit version.
 
Old 01-09-2008, 10:57 PM   #5
Leo Park
LQ Newbie
 
Registered: Jan 2008
Posts: 3

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by weibullguy View Post
Do you have the glibc development files installed? The package would be named something like libc-dev or libc6-dev. There may be two, one with -i386 or something to differentiate it as the 32-bit version.
Thanks weibullguy,

--------------------------------------------------------
bmk_mgr@ikdp101[186]: rpm -qa | grep ncurses
ncurses-devel-5.4-13
ncurses-5.4-13
ncurses-5.4-13
bmk_mgr@ikdp101[187]: rpm -qa | grep glibc
glibc-devel-2.3.4-2
glibc-2.3.4-2
glibc-kernheaders-2.4-9.1.87
glibc-2.3.4-2
glibc-headers-2.3.4-2
glibc-common-2.3.4-2

--------------------------------------------------------

It is installed on my OS.
How do you think that this problem is OS's problem or gcc's problem?
What can I do for compile 32bit c files on 64bit OS?

Thanks and Regard....
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to compile source code as 32bit under 64bit OS. Brian1 Linux - Software 2 12-15-2007 02:35 PM
32bit(i386) or 64bit(amd64) on an amd 64bit cpu (amd 6000+)? d-_-b Debian 7 10-28-2007 07:48 PM
Replace 64bit X with 32bit X on FC4 x86_64 rosholm Fedora 1 10-20-2005 07:01 PM
can 64bit processor run both 64bit and 32bit computers? DJOtaku Linux - General 4 09-08-2005 08:14 PM
32bit on 64bit paralysis Linux From Scratch 2 06-02-2005 03:19 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:06 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration