🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: alt.os.linux.ubuntu
2 messages
2 total messages Started by Ignoramus11000 Thu, 30 Oct 2008 17:41
Cannot cross compile ONE LINE PROGRAM, 64 to 32 bit
#125
Author: Ignoramus11000
Date: Thu, 30 Oct 2008 17:41
27 lines
2315 bytes
Here's a program that I am trying to cross compile (obviously I am
working on a larger program, but this is a very simple illustration):

        int main( int args, char **argv ) { return 0; }

Here's how I do it:

       gcc -o exe -m32 q.c

Here's what I get:

~/tmp==>gcc -o exe -m32 q.c
/usr/bin/ld: skipping incompatible /lib/libc.so.6 when searching for /lib/libc.so.6
/usr/bin/ld: cannot find /lib/libc.so.6
collect2: ld returned 1 exit status

This is a Ubuntu Hardy machine, 64 bit, trying to cross compile for 32
bit. I installed a bunch of 32 bit libraries, but it does not
help. (ia32-libs gcc-4.2-multilib)

-- 
   Due to extreme spam originating from Google Groups, and their inattention 
      to spammers, I and many others block all articles originating 
       from Google Groups. If you want your postings to be seen by 
         more readers you will need to find a different means of 
                       posting on Usenet.
                   http://improve-usenet.org/
Re: Cannot cross compile ONE LINE PROGRAM, 64 to 32 bit
#126
Author: Robert Heller
Date: Fri, 31 Oct 2008 15:18
46 lines
3503 bytes
At Thu, 30 Oct 2008 12:41:47 -0500 Ignoramus11000 <ignoramus11000@NOSPAM.11000.invalid> wrote:

> 
> Here's a program that I am trying to cross compile (obviously I am
> working on a larger program, but this is a very simple illustration):
> 
>         int main( int args, char **argv ) { return 0; }
> 
> Here's how I do it:
> 
>        gcc -o exe -m32 q.c
> 
> Here's what I get:
> 
> ~/tmp==>gcc -o exe -m32 q.c
> /usr/bin/ld: skipping incompatible /lib/libc.so.6 when searching for /lib/libc.so.6
> /usr/bin/ld: cannot find /lib/libc.so.6
> collect2: ld returned 1 exit status
> 
> This is a Ubuntu Hardy machine, 64 bit, trying to cross compile for 32
> bit. I installed a bunch of 32 bit libraries, but it does not
> help. (ia32-libs gcc-4.2-multilib)

You really can't use the 64-bit targeted compiler to compile for 32-bit.
You need to create the 32-bit targeted compiler as a cross-compiler. And
no, you really, really DON'T want to install the compiler from a 32-bit
distro on your 64-bit install.

The "ia32-libs gcc-4.2-multilib" is likely just the run-time to let you
run 32-bit apps on your 64-bit machine.  And no, you really, really
DON'T want to install the 32-bit dev packages on your 64-bit system either.

It might just be easier to install vmware server and install a 32-bit
Ubuntu Hardy in a virtual machine.  I've built cross-gcc compilers --
it is a bear -- not hard really, just a bear -- many tedious bits and
pieces -- of course this was a mess-windows targeted build tool set,
which only adds more 'fun' to the process.

> 

-- 
Robert Heller             -- Get the Deepwoods Software FireFox Toolbar!
Deepwoods Software        -- Linux Installation and Administration
http://www.deepsoft.com/  -- Web Hosting, with CGI and Database
heller@deepsoft.com       -- Contract Programming: C/C++, Tcl/Tk
                                                                                                     
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads