From owner-freebsd-questions@FreeBSD.ORG Sun Feb 7 02:55:03 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 F1F8A10656C4 for ; Sun, 7 Feb 2010 02:55:02 +0000 (UTC) (envelope-from psteele@maxiscale.com) Received: from server505.appriver.com (server505a.appriver.com [98.129.35.4]) by mx1.freebsd.org (Postfix) with ESMTP id B9E328FC0A for ; Sun, 7 Feb 2010 02:55:02 +0000 (UTC) X-Policy: GLOBAL - maxiscale.com X-Policy: GLOBAL - maxiscale.com X-Primary: psteele@maxiscale.com X-Note: This Email was scanned by AppRiver SecureTide X-ALLOW: psteele@maxiscale.com ALLOWED X-Virus-Scan: V- X-Note: Spam Tests Failed: X-Country-Path: UNITED STATES->UNITED STATES->UNITED STATES X-Note-Sending-IP: 98.129.23.14 X-Note-Reverse-DNS: ht01.exg5.exghost.com X-Note-WHTLIST: psteele@maxiscale.com X-Note: User Rule Hits: X-Note: Global Rule Hits: G173 G174 G175 G176 G180 G181 G192 G279 X-Note: Encrypt Rule Hits: X-Note: Mail Class: ALLOWEDSENDER X-Note: Headers Injected Received: from [98.129.23.14] (HELO ht01.exg5.exghost.com) by server505.appriver.com (CommuniGate Pro SMTP 5.3.2) with ESMTPS id 26548363; Sat, 06 Feb 2010 20:54:59 -0600 Received: from mbx03.exg5.exghost.com ([169.254.1.200]) by ht01.exg5.exghost.com ([98.129.23.14]) with mapi; Sat, 6 Feb 2010 20:55:01 -0600 From: Peter Steele To: Pieter de Goeje , "freebsd-questions@freebsd.org" Date: Sat, 6 Feb 2010 20:54:59 -0600 Thread-Topic: What is easiest way to build a BSD 8 binary on a BSD 7 box? Thread-Index: AcqnlMllVthFcU6xTR+spCSJ9MZBIAAC/B6g Message-ID: <7B9397B189EB6E46A5EE7B4C8A4BB7CB383B2501@MBX03.exg5.exghost.com> References: <7B9397B189EB6E46A5EE7B4C8A4BB7CB383B24D6@MBX03.exg5.exghost.com> <201002070227.48003.pieter@degoeje.nl> In-Reply-To: <201002070227.48003.pieter@degoeje.nl> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Cc: Subject: RE: What is easiest way to build a BSD 8 binary on a BSD 7 box? 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: Sun, 07 Feb 2010 02:55:03 -0000 Okay, that looks doable. I'll see how this works out. Thanks very much for = the info! -----Original Message----- From: Pieter de Goeje [mailto:pieter@degoeje.nl]=20 Sent: Saturday, February 06, 2010 5:28 PM To: freebsd-questions@freebsd.org Cc: Peter Steele Subject: Re: What is easiest way to build a BSD 8 binary on a BSD 7 box? On Saturday 06 February 2010 20:22:13 Peter Steele wrote: > I have a BSD 7 system with the full BSD 8 sources loaded on it, and we=20 > use this box to build our custom BSD 8 kernel and tools. We do not=20 > install the custom code on the BSD 7 box but simply collect the=20 > artifacts as a basis for our custom BSD 8 image. I have a standalone=20 > tool that has previously been built on this same BSD 7 system, but it=20 > just uses gcc and links against the normal BSD 7 libraries that are locat= ed on this box. > > When we run this tool on a BSD 7 box it works fine. However, we've=20 > discovered one function it performs doesn't work properly. It uses=20 > kvm_read to collect network statistics and apparently applications=20 > that use this function have to be linked against the libraries of the act= ual target OS. > One easy solution of course is to build our tool on a BSD 8 box, and=20 > in the long run we'll likely go that route as we move away from BSD 7.=20 > Right now though our build server is BSD 7 and we need to build this=20 > tool against BSD > 8 libraries. This obviously can be done since "make world" does=20 > exactly that-it builds everything against 8.0 objects even if the=20 > build is done on a BSD 7 box. > > Without dissecting the magic going on in "make world", can any explain=20 > how I could do the same thing with my standalone tool? Specifically,=20 > build it on a BSD 7 box but link it against BSD 8 libraries. The easiest way would probably be the following. # SOMEDIR=3D/path/to/fbsd8buildenv # mkdir -p ${SOMEDIR} # cd /path/to/FreeBSD-8.0/src # make buildworld # make installworld DESTDIR=3D${SOMEDIR} Then adding --sysroot=3D${SOMEDIR} to all invocations of gcc/ld and/or libe= ral use of -I and -L gcc options should do the trick. For example: # export CFLAGS=3D"-I${SOMEDIR}/usr/include -L${SOMEDIR}/lib -L${SOMEDIR}/u= sr/lib # make Regards, Pieter de Goeje