From owner-freebsd-questions@FreeBSD.ORG Fri Aug 13 16:23:04 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 C64BF1065674 for ; Fri, 13 Aug 2010 16:23:04 +0000 (UTC) (envelope-from swell.k@gmail.com) Received: from mail-vw0-f54.google.com (mail-vw0-f54.google.com [209.85.212.54]) by mx1.freebsd.org (Postfix) with ESMTP id 767108FC18 for ; Fri, 13 Aug 2010 16:23:04 +0000 (UTC) Received: by vws7 with SMTP id 7so1513070vws.13 for ; Fri, 13 Aug 2010 09:23:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:references :date:in-reply-to:message-id:user-agent:mime-version:content-type; bh=2XrNBB5OwkcaVxZ0FUSXhSJbti+GodO3JMLAe7+78Oo=; b=bHFXaG4yxA/JuI3drB2TapSAnKy/SUfSn5Ge/GaLR/JKMnee+RfYPGUMzjsALdrNuW 3H5UbCH8UxvoBIinPTSKOXiDjtUnmq1+gebW/N9GwVCdvBWh80u+N/dE5OjmCVDZak9X pxEdSvHLrKTH3etXSQt6hwBPbKJX7U9MDLBpQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; b=wdBqODyE2az/6mMKWIuQ1ICpMIZjWbtuvgY90bQbg5DVS+0SxT2B/vpG87SPhm5HLU OAopoyxD1V7QJuGIx7ukjosbvUk005MbOJEI+nfuMsywX1YuYV5nPqOXY5CRDwdMbWUY DYGpSo2TJ3QcpYBY5d8JmmPlzfXA6MZcp3SpA= Received: by 10.220.121.202 with SMTP id i10mr930458vcr.227.1281716583559; Fri, 13 Aug 2010 09:23:03 -0700 (PDT) Received: from localhost (tor-exit-proxy8-readme.formlessnetworking.net [208.53.142.44]) by mx.google.com with ESMTPS id w1sm1760336vbl.18.2010.08.13.09.23.02 (version=SSLv3 cipher=RC4-MD5); Fri, 13 Aug 2010 09:23:03 -0700 (PDT) From: Anonymous To: Yuri References: <4C656E8F.8090105@rawbw.com> Date: Fri, 13 Aug 2010 20:22:58 +0400 In-Reply-To: <4C656E8F.8090105@rawbw.com> (yuri@rawbw.com's message of "Fri, 13 Aug 2010 09:10:55 -0700") Message-ID: <86sk2iwkgt.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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:23:04 -0000 Yuri writes: > 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. > This was already discussed several times. I only remember recent threads[1][2]. I've built a few ports with not many dependencies but stumbled on unrelated issues before ever trying smth like emulators/wine. [1] http://docs.freebsd.org/cgi/mid.cgi?201007291718.12687.tijl [2] http://docs.freebsd.org/cgi/mid.cgi?86tyobk6bu.fsf ftp://ftp.lissyara.su/users/Guest/cc32wrapper (improved wrapper) > Is there a documentation how to cross compile 32 bit apps on 64 bit > platform? The only documented way is by using 32bit chroot.