From owner-freebsd-amd64@FreeBSD.ORG Sun Mar 21 20:13:16 2004 Return-Path: Delivered-To: freebsd-amd64@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7BA1A16A4CE for ; Sun, 21 Mar 2004 20:13:16 -0800 (PST) Received: from canning.wemm.org (canning.wemm.org [192.203.228.65]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4CB5F43D2D for ; Sun, 21 Mar 2004 20:13:16 -0800 (PST) (envelope-from peter@evilpete.dyndns.org) Received: from fw.wemm.org (canning.wemm.org [192.203.228.65]) by canning.wemm.org (Postfix) with ESMTP id E4DEB2A8E3 for ; Sun, 21 Mar 2004 20:13:15 -0800 (PST) (envelope-from peter@overcee.wemm.org) Received: from overcee.wemm.org (overcee.wemm.org [10.0.0.3]) by fw.wemm.org (Postfix) with ESMTP id DB42FE259 for ; Sun, 21 Mar 2004 20:13:15 -0800 (PST) (envelope-from peter@overcee.wemm.org) Received: from overcee.wemm.org (localhost [127.0.0.1]) by overcee.wemm.org (8.12.11/8.12.11) with ESMTP id i2M4CTAv073201 for ; Sun, 21 Mar 2004 20:12:29 -0800 (PST) (envelope-from peter@overcee.wemm.org) Received: from localhost (localhost [[UNIX: localhost]]) by overcee.wemm.org (8.12.11/8.12.11/Submit) id i2M4CTiP073200 for amd64@freebsd.org; Sun, 21 Mar 2004 20:12:29 -0800 (PST) (envelope-from peter) From: Peter Wemm To: amd64@freebsd.org Date: Sun, 21 Mar 2004 20:12:29 -0800 User-Agent: KMail/1.6.1 MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Message-Id: <200403212012.29053.peter@wemm.org> Subject: 32 bit libraries - build hack X-BeenThere: freebsd-amd64@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Porting FreeBSD to the AMD64 platform List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Mar 2004 04:13:16 -0000 http://people.freebsd.org/~peter/build32.sh This builds a working set of libraries and rtld to match. Some caveats.. - It must be run AFTER a FULL world build and install. - You MUST be running -current after of yesterday afternoon. Sorry, no 5.2-R/5.2.1-R support here. - c++ doesn't seem to like the -m32 switch, so you'll still need to supply your own libstdc++.so.4. - ldconfig has an undocumented -32 switch for setting the search path for ld-elf32.so.1. You'll need to do this for local and X11R6 libraries. - Yes, you could conceivably use a pure 32 bit /usr/X11R6 and /usr/local. But I haven't tried it and I'm not planning to. You'll need to hack your rc scripts to not add /usr/local/lib to your 64 bit library search paths etc. - no, there is no /compat subtree for this stuff. I'm not aware of anything that needs it. All the files in /etc and /var are shareable because we have explicitly sized types in our definitions for them. This isn't well tested, its a hack. I tried it on a previously unmolested machine (sledge.freebsd.org) before posting this. Ideally this should be better integrated with world at some point, but I'll personally shoot anybody who makes this something that happens unconditionally with every buildworld. #! /bin/sh # $P4: //depot/projects/hammer/build32.sh#5 $ # # This script is for running on a self-hosted amd64 machine, with an up-to-date # world and toolchain etc. ie: the installed world is assumed to match the sources. # It is rude, crude and brutal. But its the only option for now. # # Its purpose is to build a 32 bit library set and a ld-elf32.so.1. # XXX beware.. some of the library targets have no way to disable # XXX installation of includes. ie: it will re-install some files in # XXX /usr/include for you. mkdir /lib32 mkdir /usr/lib32 mkdir /usr/local/lib32 mkdir /usr/X11R6/lib32 # Set up an obj tree chflags -R noschg /tmp/i386 rm -rf /tmp/i386 # and a place to put the alternate include tree into. mkdir -p /tmp/i386/root make MAKEOBJDIRPREFIX=/tmp/i386 DESTDIR=/tmp/i386/root MACHINE_ARCH=i386 hierarchy # Now build includes make MAKEOBJDIRPREFIX=/tmp/i386 DESTDIR=/tmp/i386/root MACHINE_ARCH=i386 obj make MAKEOBJDIRPREFIX=/tmp/i386 DESTDIR=/tmp/i386/root MACHINE_ARCH=i386 includes # libncurses needs a build-tools pass first. I wish build-tools was a recursive target. (cd lib/libncurses; make MAKEOBJDIRPREFIX=/tmp/i386 build-tools) # Now the libraries. This doesn't work for bind, gnuregex and stdc++ yet. hence -k make -DNOMAN -DNODOC -DNOINFO MAKEOBJDIRPREFIX=/tmp/i386 LIBDIR=/usr/lib32 SHLIBDIR=/usr/lib32 MACHINE_ARCH=i386 CC="cc -m32 -I/tmp/i386/root/usr/include -L/usr/lib32 -B/usr/lib32" CXX="c++ -m32 -I/tmp/i386/root/usr/include/c++/3.3 -L/usr/lib32 -B/usr/lib32" LD="ld -m elf_i386_fbsd -Y P,/usr/lib32" -k libraries # bind isn't a problem, its an internal no-install lib, so let it fail. # libstdc++ is a curious one. it looks like "c++ -m32" doesn't work. # Hack to fix gnuregex which does evil hacks to the -I paths. (cd gnu/lib/libregex; make -DNOMAN -DNODOC -DNOINFO MAKEOBJDIRPREFIX=/tmp/i386 LIBDIR=/usr/lib32 SHLIBDIR=/usr/lib32 MACHINE_ARCH=i386 CC="cc -m32 -I/tmp/i386/root/usr/include/gnu -I/tmp/i386/root/usr/include -L/usr/lib32 -B/usr/lib32" CXX="c++ -m32 -I/tmp/i386/root/usr/include/c++/3.3 -L/usr/lib32 -B/usr/lib32" LD="ld -m elf_i386_fbsd -Y P,/usr/lib32" all install) # and now that we have enough libraries, build ld-elf32.so.1 cd libexec/rtld-elf make -DNOMAN -DNODOC -DNOINFO PROG=ld-elf32.so.1 MAKEOBJDIRPREFIX=/tmp/i386 LIBDIR=/usr/lib32 SHLIBDIR=/usr/lib32 MACHINE_ARCH=i386 CC="cc -m32 -I/tmp/i386/root/usr/include -L/usr/lib32 -B/usr/lib32 -DCOMPAT_32BIT" LD="ld -m elf_i386_fbsd -Y P,/usr/lib32" obj make -DNOMAN -DNODOC -DNOINFO PROG=ld-elf32.so.1 MAKEOBJDIRPREFIX=/tmp/i386 LIBDIR=/usr/lib32 SHLIBDIR=/usr/lib32 MACHINE_ARCH=i386 CC="cc -m32 -I/tmp/i386/root/usr/include -L/usr/lib32 -B/usr/lib32 -DCOMPAT_32BIT" LD="ld -m elf_i386_fbsd -Y P,/usr/lib32" depend make -DNOMAN -DNODOC -DNOINFO PROG=ld-elf32.so.1 MAKEOBJDIRPREFIX=/tmp/i386 LIBDIR=/usr/lib32 SHLIBDIR=/usr/lib32 MACHINE_ARCH=i386 CC="cc -m32 -I/tmp/i386/root/usr/include -L/usr/lib32 -B/usr/lib32 -DCOMPAT_32BIT" LD="ld -m elf_i386_fbsd -Y P,/usr/lib32" make -DNOMAN -DNODOC -DNOINFO PROG=ld-elf32.so.1 MAKEOBJDIRPREFIX=/tmp/i386 LIBDIR=/usr/lib32 SHLIBDIR=/usr/lib32 MACHINE_ARCH=i386 CC="cc -m32 -I/tmp/i386/root/usr/include -L/usr/lib32 -B/usr/lib32 -DCOMPAT_32BIT" LD="ld -m elf_i386_fbsd -Y P,/usr/lib32" install -- Peter Wemm - peter@wemm.org; peter@FreeBSD.org; peter@yahoo-inc.com "All of this is for nothing if we don't go to the stars" - JMS/B5