From owner-freebsd-questions@FreeBSD.ORG Fri Aug 13 16:24:31 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 8E1A510656A3 for ; Fri, 13 Aug 2010 16:24:31 +0000 (UTC) (envelope-from dan@dan.emsphone.com) Received: from email1.allantgroup.com (email1.emsphone.com [199.67.51.115]) by mx1.freebsd.org (Postfix) with ESMTP id 532588FC19 for ; Fri, 13 Aug 2010 16:24:30 +0000 (UTC) Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by email1.allantgroup.com (8.14.0/8.14.0) with ESMTP id o7DGOUhi089116 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 13 Aug 2010 11:24:30 -0500 (CDT) (envelope-from dan@dan.emsphone.com) Received: from dan.emsphone.com (smmsp@localhost [127.0.0.1]) by dan.emsphone.com (8.14.4/8.14.4) with ESMTP id o7DGOUSj063327 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 13 Aug 2010 11:24:30 -0500 (CDT) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.14.4/8.14.3/Submit) id o7DGOUVM063250; Fri, 13 Aug 2010 11:24:30 -0500 (CDT) (envelope-from dan) Date: Fri, 13 Aug 2010 11:24:30 -0500 From: Dan Nelson To: Yuri Message-ID: <20100813162429.GE18896@dan.emsphone.com> References: <4C656E8F.8090105@rawbw.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4C656E8F.8090105@rawbw.com> X-OS: FreeBSD 8.1-PRERELEASE User-Agent: Mutt/1.5.20 (2009-06-14) X-Virus-Scanned: clamav-milter 0.96 at email1.allantgroup.com X-Virus-Status: Clean X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.0.2 (email1.allantgroup.com [199.67.51.78]); Fri, 13 Aug 2010 11:24:30 -0500 (CDT) Cc: freebsd-questions@freebsd.org Subject: Re: 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:24:31 -0000 In the last episode (Aug 13), Yuri said: > 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? Try adding -B/usr/lib32 to your first gcc line. The specs file should be modified to add this automatically when you pass -m32, imho. -- Dan Nelson dnelson@allantgroup.com