Web Images Videos Maps News Shopping Gmail more »
Recently Visited Groups | Help | Sign in
Google Groups Home
compiling for 32 bit x86 machines on a x86-64 box
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  8 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Charles T Smith  
View profile  
 More options Mar 26 2008, 6:27 am
Newsgroups: gnu.gcc.help
From: Charles T Smith <cts.priv...@yahoo.com>
Date: Wed, 26 Mar 2008 10:27:09 +0000 (UTC)
Local: Wed, Mar 26 2008 6:27 am
Subject: compiling for 32 bit x86 machines on a x86-64 box
Hi.

In reading the gcc man page, and information from, say, AMD, I get
the impression that gcc can generate executables on an x86-64 box
that will run on a 32 bit machine.  But I can't make it work.

I'm using SuSE 10.3 on a "Intel(R) Core(TM)2 CPU          4400  @ 2.00GHz
stepping 02".

The gcc man page says:

-march=cpu-type
   Generate instructions for the machine type cpu-type.  The choices for
cpu-
   type are the same as for -mtune.  Moreover, specifying -march=cpu-type
   implies -mtune=cpu-type.

Trying -march=i386 gives:

  cc -g -I/home/mellman/src/ulib -o cross.o -march=i386 cross.c
  cross.c:1: error: CPU you selected does not support x86-64 instruction
set
  cross.c:1: error: CPU you selected does not support x86-64 instruction
set

Right.  That's the point...

And -march=i686 gives:

  cc -g -I/home/mellman/src/ulib -o cross.o -march=i686 cross.c
  cross.c:1: error: CPU you selected does not support x86-64 instruction
set

(just once this time)

On a lark (because I don't find an explanation in the man page of what
the difference with -march is), I tried -m32:

Here I get:

  cc -g -I/home/mellman/src/ulib -o cross.o -m32 cross.c
  In file included from /usr/include/features.h:345,
                   from /usr/include/stdio.h:28,
                   from cross.c:1:
  /usr/include/gnu/stubs.h:7:27: error: gnu/stubs-32.h: No such file or
directory

stubs-32.h is not on my system, and I can't find it on SuSE's site
either.

I find almost nothing about this when googling.  WRT stubs-32.h, the
only thing I can find says to use different libraries (!).  The response
is always that that didn't help.

It would seem that this is a pretty common requirement - I have a 64 bit
box at home and want to distribute my programs generally (like to my
virtual server, which only has 32 bits).  The lack of general interest
here must indicate that I'm completely on the wrong track somehow...

Any ideas are appreciated...


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
FÖLDY Lajos  
View profile  
 More options Mar 26 2008, 10:07 am
Newsgroups: gnu.gcc.help
From: FÖLDY Lajos <fo...@rmki.kfki.hu>
Date: Wed, 26 Mar 2008 15:07:45 +0100
Local: Wed, Mar 26 2008 10:07 am
Subject: Re: compiling for 32 bit x86 machines on a x86-64 box

install glibc-devel-32bit

regards,
lajos


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Charles T Smith  
View profile  
 More options Mar 26 2008, 10:45 am
Newsgroups: gnu.gcc.help
From: Charles T Smith <cts.priv...@yahoo.com>
Date: Wed, 26 Mar 2008 14:45:02 +0000 (UTC)
Local: Wed, Mar 26 2008 10:45 am
Subject: Re: compiling for 32 bit x86 machines on a x86-64 box

Thank you.  That worked.  Actually, I got lost in the whirl of glibc-
devel and glibc-32bit and missed that there was also a glibc-devel-32bit.

Note for others: you will then have to install

gcc42-32bit-4.2.1_20070724-17.x86_64.rpm
libgomp (for 32 bits)
libmudflap (for 32 bits)

Now, is there an equally easy way to do the same thing for sparc?
The last time I delved into that, it seemed like I'd have to build a
special version of gcc ...


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Charles T Smith  
View profile  
 More options Mar 26 2008, 1:32 pm
Newsgroups: gnu.gcc.help
From: Charles T Smith <cts.priv...@yahoo.com>
Date: Wed, 26 Mar 2008 17:32:58 +0000 (UTC)
Local: Wed, Mar 26 2008 1:32 pm
Subject: Re: compiling for 32 bit x86 machines on a x86-64 box

Unfortunately, linking failed.  For example, here I successfully compiled
the .c file to a .o and then put the .o on my i686 machine and tried to
link it:

$ cc -g -I/home/mellman/src/ulib -o cross.o -march=i386 -m32 cross.c
$ file cross.o
cross.o: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for
GNU/Linux 2.6.4, dynamically linked (uses shared libs), not stripped

[ scp and switch to remote ]

$ cc -o cross cross.o
cross.o(.text+0x0): In function `_start':
: multiple definition of `_start'
/usr/lib/gcc-lib/i586-suse-linux/3.3.5/../../../crt1.o(.text+0x0):../
sysdeps/i386/elf/start.S:65: first defined here
cross.o(.rodata+0x0): multiple definition of `_fp_hw'
/usr/lib/gcc-lib/i586-suse-linux/3.3.5/../../../crt1.o(.rodata+0x0):../
sysdeps/i386/elf/start.S:65: first defined here
cross.o(.fini+0x0): In function `_fini':
/usr/src/packages/BUILD/glibc-2.6.1/cc-nptl/csu/crti.S:41: multiple
definition of `_fini'
/usr/lib/gcc-lib/i586-suse-linux/3.3.5/../../../crti.o(.fini+0x0):/usr/
src/packages/BUILD/glibc-2.3/cc/csu/crti.S:12: first defined here
cross.o(.rodata+0x4): multiple definition of `_IO_stdin_used'
/usr/lib/gcc-lib/i586-suse-linux/3.3.5/../../../crt1.o(.rodata+0x4):../
sysdeps/i386/elf/start.S:71: first defined here
cross.o(.data+0x0): In function `__data_start':
: multiple definition of `__data_start'
/usr/lib/gcc-lib/i586-suse-linux/3.3.5/../../../crt1.o(.data+0x0):../
sysdeps/i386/elf/start.S:65: first defined here
cross.o(.data+0x4): In function `__data_start':
: multiple definition of `__dso_handle'
/usr/lib/gcc-lib/i586-suse-linux/3.3.5/crtbegin.o(.data+0x0): first
defined here
cross.o(.init+0x0): In function `_init':
/usr/src/packages/BUILD/glibc-2.6.1/cc-nptl/csu/crti.S:15: multiple
definition of `_init'
/usr/lib/gcc-lib/i586-suse-linux/3.3.5/../../../crti.o(.init+0x0):/usr/
src/packages/BUILD/glibc-2.3/cc/csu/crti.S: first defined here
collect2: ld returned 1 exit status

Here's trying to link it on the 64bit box:

cc -g -I/home/mellman/src/ulib -o cross -march=i686 -m32 cross.o
cross.o: In function `_start':
(.text+0x0): multiple definition of `_start'
/usr/lib64/gcc/x86_64-suse-linux/4.2.1/../../../../lib/crt1.o:(.text
+0x0): first defined here
cross.o:(.rodata+0x0): multiple definition of `_fp_hw'
/usr/lib64/gcc/x86_64-suse-linux/4.2.1/../../../../lib/crt1.o:(.rodata
+0x0): first defined here
cross.o: In function `_fini':
/usr/src/packages/BUILD/glibc-2.6.1/cc-nptl/csu/crti.S:41: multiple
definition of `_fini'
/usr/lib64/gcc/x86_64-suse-linux/4.2.1/../../../../lib/crti.o:/usr/src/
packages/BUILD/glibc-2.6.1/cc-nptl/csu/crti.S:41: first defined here
cross.o:(.rodata+0x4): multiple definition of `_IO_stdin_used'
/usr/lib64/gcc/x86_64-suse-linux/4.2.1/../../../../lib/crt1.o:
(.rodata.cst4+0x0): first defined here
cross.o: In function `__data_start':
(.data+0x0): multiple definition of `__data_start'
/usr/lib64/gcc/x86_64-suse-linux/4.2.1/../../../../lib/crt1.o:(.data
+0x0): first defined here
cross.o: In function `__data_start':
(.data+0x4): multiple definition of `__dso_handle'
/usr/lib64/gcc/x86_64-suse-linux/4.2.1/32/crtbegin.o:(.data+0x0): first
defined here
cross.o: In function `_init':
/usr/src/packages/BUILD/glibc-2.6.1/cc-nptl/csu/crti.S:15: multiple
definition of `_init'
/usr/lib64/gcc/x86_64-suse-linux/4.2.1/../../../../lib/crti.o:/usr/src/
packages/BUILD/glibc-2.6.1/cc-nptl/csu/crti.S:15: first defined here
collect2: ld returned 1 exit status
make: *** [cross] Error 1


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Charles T Smith  
View profile  
 More options Mar 26 2008, 2:57 pm
Newsgroups: gnu.gcc.help
From: Charles T Smith <cts.priv...@yahoo.com>
Date: Wed, 26 Mar 2008 18:57:08 +0000 (UTC)
Local: Wed, Mar 26 2008 2:57 pm
Subject: Re: compiling for 32 bit x86 machines on a x86-64 box

On Wed, 26 Mar 2008 17:32:58 +0000, Charles T Smith wrote:
> On Wed, 26 Mar 2008 14:45:02 +0000, Charles T Smith wrote:

>> On Wed, 26 Mar 2008 15:07:45 +0100, FÖLDY Lajos wrote:

>>> On Wed, 26 Mar 2008, Charles T Smith wrote:
> make: *** [cross] Error 1

Okay, silly me.  I left out the -c on the initial compile.

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Paul Pluzhnikov  
View profile  
 More options Mar 27 2008, 12:17 am
Newsgroups: gnu.gcc.help
From: Paul Pluzhnikov <ppluzhnikov-...@gmail.com>
Date: Wed, 26 Mar 2008 21:17:28 -0700
Local: Thurs, Mar 27 2008 12:17 am
Subject: Re: compiling for 32 bit x86 machines on a x86-64 box
Charles T Smith <cts.priv...@yahoo.com> writes:

> Now, is there an equally easy way to do the same thing for sparc?

All recent versions of gcc, when configured and built on 64-bit
Solaris/SPARC, support '-m32' (default) and '-m64' out of the box.

Or is your question about Linux/SPARC?

Cheers,
--
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
cocobear  
View profile  
 More options May 22 2008, 5:01 am
Newsgroups: gnu.gcc.help
From: cocobear <cocobear...@gmail.com>
Date: Thu, 22 May 2008 02:01:00 -0700 (PDT)
Subject: Re: compiling for 32 bit x86 machines on a x86-64 box
On 3月27日, 下午12时17分, Paul Pluzhnikov <ppluzhnikov-...@gmail.com> wrote:

> Charles T Smith <cts.priv...@yahoo.com> writes:

> > Now, is there an equally easy way to do the same thing for sparc?

> All recent versions of gcc, when configured and built on 64-bit
> Solaris/SPARC, support '-m32' (default) and '-m64' out of the box.

> Or is your question about Linux/SPARC?

> Cheers,
> --
> In order to understand recursion you must first understand recursion.
> Remove /-nsp/ for email.

Where can I find glibc-devel-32bit-2.8, I can only find glibc-
devel-32bit-2.5, but my glibc-devel is 2.8 :glibc-devel-2.8-3.x86_64
.

I use fedora 9


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Discussion subject changed to "Where to find glibc-devel-32bit-2.8-3?" by Paul Pluzhnikov
Paul Pluzhnikov  
View profile  
 More options May 22 2008, 11:23 am
Newsgroups: gnu.gcc.help
From: Paul Pluzhnikov <ppluzhnikov-...@gmail.com>
Date: Thu, 22 May 2008 08:23:03 -0700
Local: Thurs, May 22 2008 11:23 am
Subject: Where to find glibc-devel-32bit-2.8-3?

cocobear <cocobear...@gmail.com> writes:

Please don't follow-up to a completely unrelated message.
Start a new thread, with a new subject instead.

You are also completely off-topic in this group. Next time please
use one of the *linux* groups for linux-specific questions.

> Where can I find glibc-devel-32bit-2.8, I can only find glibc-
> devel-32bit-2.5, but my glibc-devel is 2.8 :glibc-devel-2.8-3.x86_64

Go to http://rpm.pbone.net/, type glibc-devel-2.8-3.i386 into the search box.

Cheers,
--
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google