From owner-freebsd-questions@FreeBSD.ORG Fri Aug 13 16:11:18 2010 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7208F1065697 for ; Fri, 13 Aug 2010 16:11:18 +0000 (UTC) (envelope-from yuri@rawbw.com) Received: from shell0.rawbw.com (shell0.rawbw.com [198.144.192.45]) by mx1.freebsd.org (Postfix) with ESMTP id 5FA318FC08 for ; Fri, 13 Aug 2010 16:11:18 +0000 (UTC) Received: from eagle.syrec.org (stunnel@localhost [127.0.0.1]) (authenticated bits=0) by shell0.rawbw.com (8.14.4/8.14.4) with ESMTP id o7DGAwkN049520 for ; Fri, 13 Aug 2010 09:11:08 -0700 (PDT) (envelope-from yuri@rawbw.com) Message-ID: <4C656E8F.8090105@rawbw.com> Date: Fri, 13 Aug 2010 09:10:55 -0700 From: Yuri User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.1.10) Gecko/20100630 Thunderbird/3.0.5 MIME-Version: 1.0 To: freebsd-questions@freebsd.org Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Documentation on how to build 32bit applications on amd64? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Aug 2010 16:11:18 -0000 I need to build 32 bit apps the same way as they would be built on i386. When I run 64-bit gcc I get this: gcc -m32 -o m m.c /usr/bin/ld: skipping incompatible /usr/lib/libgcc.a when searching for -lgcc /usr/bin/ld: skipping incompatible /usr/lib/libgcc.a when searching for -lgcc /usr/bin/ld: cannot find -lgcc When I run 32bit gcc I get this: /gcc-4.5.0-32/bin/gcc -m32 -o m m.c /var/tmp//ccif89DB.s: Assembler messages: /var/tmp//ccif89DB.s:11: Error: suffix or operands invalid for `push' /var/tmp//ccif89DB.s:14: Error: `-12(%ebp)' is not a valid 64 bit base/index expression In first case libgcc.so isn't found, and specifying -L/usr/lib32 doesn't help. In the second case 32bit compiler runs 64-bit assembler which is wrong. Is there a documentation how to cross compile 32 bit apps on 64 bit platform? Yuri