From owner-freebsd-questions@FreeBSD.ORG Fri Aug 13 22:58:02 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 647851065674 for ; Fri, 13 Aug 2010 22:58:02 +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 4F1C28FC0A for ; Fri, 13 Aug 2010 22:58:02 +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 o7DMvhj7031742; Fri, 13 Aug 2010 15:57:43 -0700 (PDT) (envelope-from yuri@rawbw.com) Message-ID: <4C65CDE7.5010001@rawbw.com> Date: Fri, 13 Aug 2010 15:57:43 -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: Dan Nelson References: <4C656E8F.8090105@rawbw.com> <20100813162429.GE18896@dan.emsphone.com> <4C65852B.807@rawbw.com> <20100813214457.GF18896@dan.emsphone.com> In-Reply-To: <20100813214457.GF18896@dan.emsphone.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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 22:58:02 -0000 On 08/13/2010 14:44, Dan Nelson wrote: > I think Anonymous is right, and that it's due to the /usr/include headers on > amd64 not being 32-bit-mode aware. So you end up with some structure > members being sized for 64-bit machines instead of 32-bit. I bet struct > regex_t on your cross-compiled program is the same size as your native > 64-bit program, where it should match your 32-bit program instead. I took > that "-B /usr/lib32" flag from /usr/src/Makefile.inc1 , where it builds the > lib32 compat libraries, and it looks like it also temporarily installs a > full 32-bit include directory and compiles against that with "-iprefix > ${LIB32TMP}/usr/" . You may have to install a full 32-bit tree somewhere > and chroot to it to build, or look more closely at how buildworld compiles > the lib32 stuff and mimic that, or submit patches to the base include files > that make them 32 and 64-bit compatible depending on compiler flags. > I think the best way is to modify headers to depend on compiler flags (__i386/__amd64). This makes such cross compile seamless for all future attempts to cross compile. The problem I see is that there are currently 83 includes of headers from outside the machine/ hierarchy. cd /usr/include && grep -r " #else #include #endif ... Or rather pointing to some location (if any) where 32 bit headers would normally reside on amd64 host. Do you think this is reasonable? Should I make a patch, or maybe further discuss on hackers@? Yuri