LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 12-19-2004, 04:20 AM   #1
overbored
Member
 
Registered: Jun 2003
Posts: 58

Rep: Reputation: 15
How to compile for any i386?


hi all, if i'd like to compile a simple program (eg GNU netcat) as a binary that can run on any i386, how might i do that? i tried setting CFLAGS='-march=i386 -static -static-libgcc', '-march=i386', and '-march=i386 -static'. but when i run it on another box, it gives me errors like "Bus error" or "./netcat: /lib/libc.so.6: version `GLIBC_2.3' not found (required by ./netcat)"
 
Old 12-19-2004, 10:48 AM   #2
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Virginia, USA
Distribution: Debian 12
Posts: 8,337

Rep: Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548
"if i'd like to compile a simple program (eg GNU netcat) as a binary that can run on any i386, how might i do that?"

Setting -march=i386 produce a binary that will run on any i386.

"./netcat: /lib/libc.so.6: version `GLIBC_2.3' not found (required by ./netcat)"

A program compiled under gcc is Glibc dependent. There is a correspondence between Glibc versions and gcc versions. It is common for programs to fail when they are run against a Glibc which does not correspond to the gcc version used to compile them.

----------------------
Steve Stites
 
Old 12-19-2004, 12:22 PM   #3
overbored
Member
 
Registered: Jun 2003
Posts: 58

Original Poster
Rep: Reputation: 15
so s it possible for me to statically link glibc into the binary, such that it is always available to the app? that's what i thought -static or -static-libgcc does.
 
Old 12-19-2004, 03:41 PM   #4
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Virginia, USA
Distribution: Debian 12
Posts: 8,337

Rep: Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548
"so s it possible for me to statically link glibc into the binary, such that it is always available to the app? that's what i thought -static or -static-libgcc does."

Yes. That should work.

-----------------------
Steve Stites
 
Old 12-19-2004, 03:50 PM   #5
overbored
Member
 
Registered: Jun 2003
Posts: 58

Original Poster
Rep: Reputation: 15
But when I include those two options to the compiler, I get a "Bus error" when running it on the target platform. It is difficult for me to debug it because the platform is pebble and is running on a device (not a full blown PC) with no space for gdb.
 
Old 12-19-2004, 04:47 PM   #6
daihard
Member
 
Registered: Jul 2003
Location: Seattle, WA
Distribution: Kubuntu 14.04 LTS
Posts: 915

Rep: Reputation: 34
Quote:
Originally posted by overbored
But when I include those two options to the compiler, I get a "Bus error" when running it on the target platform. It is difficult for me to debug it because the platform is pebble and is running on a device (not a full blown PC) with no space for gdb.
Just curious, what exact CPU does that device have?
 
Old 12-19-2004, 05:07 PM   #7
overbored
Member
 
Registered: Jun 2003
Posts: 58

Original Poster
Rep: Reputation: 15
They are 486 processors (http://www.soekris.com/)
 
Old 01-20-2005, 12:26 AM   #8
overbored
Member
 
Registered: Jun 2003
Posts: 58

Original Poster
Rep: Reputation: 15
*Bump*

Anybody?
 
  


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
kernel cross-compile(i386 to sparc) jiyun0121 Debian 1 10-20-2005 07:00 AM
i386 Ammad Linux - Hardware 1 08-05-2005 01:26 PM
i386 compile with fedora-core3 x86_64? markelo Programming 7 04-15-2005 11:59 AM
What does i386 mean? Echo Kilo Linux - General 6 01-07-2005 02:35 PM
I386 Manny88 Linux - General 2 09-21-2003 10:33 PM

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

All times are GMT -5. The time now is 02:37 AM.

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