From owner-freebsd-current@FreeBSD.ORG Fri Nov 2 06:39:12 2012 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E0C35B6D; Fri, 2 Nov 2012 06:39:12 +0000 (UTC) (envelope-from masked@internode.on.net) Received: from ipmail06.adl2.internode.on.net (ipmail06.adl2.internode.on.net [IPv6:2001:44b8:8060:ff02:300:1:2:6]) by mx1.freebsd.org (Postfix) with ESMTP id B773A8FC08; Fri, 2 Nov 2012 06:39:11 +0000 (UTC) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AhQKAHppk1CWZd2M/2dsb2JhbABEhhe8DwKCE4IeAQEBBAEBAQUbDwEFFiAWAQQFAwMRAQMBAQMCJgICJwEJGAYIBgEHBwQBBwkMBIdkDKpAkmKBIIpbGoEtVYMMMmEDjXGEVYEFg0iPKIMDgVA Received: from ppp221-140.static.internode.on.net (HELO forexamplePC) ([150.101.221.140]) by ipmail06.adl2.internode.on.net with SMTP; 02 Nov 2012 17:09:10 +1030 Message-ID: <89726A5A924F4EA0B92603A3836E9C2F@forexamplePC> From: "Michael Vale" To: , "Adrian Chadd" References: <98E79AD90A1B4A2581C12BD73FEDEDC3@forexamplePC> <69B6751E5B51467EBF7F25735C497912@forexamplePC> In-Reply-To: <69B6751E5B51467EBF7F25735C497912@forexamplePC> Subject: Re: Cross Architecture Compiling Date: Fri, 2 Nov 2012 17:39:08 +1100 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="utf-8"; reply-type=original Content-Transfer-Encoding: 8bit X-Priority: 3 X-MSMail-Priority: Normal Importance: Normal X-Mailer: Microsoft Windows Live Mail 16.4.3505.912 X-MimeOLE: Produced By Microsoft MimeOLE V16.4.3505.912 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Nov 2012 06:39:13 -0000 just for what it’s worth. busybox and some other gmake ports don’t have configure but do have cross-compiling support in the gMakefile. make install -C /usr/ports/sysutils/busybox CROSS_COMPILE=mips-freebsd- DESTDIR=/tmp CHROOTED=no PREFIX=/tmp this actually doesn’t install with the default install program but the singular required binary does retain itself in /usr/ports/sysutils/busybox/work/busybox/busybox. change ‘mips-freebsd-‘ to the xdev compiler of your choice. -----Original Message----- From: Michael Vale Sent: Friday, November 02, 2012 3:26 PM To: Garrett Cooper ; freebsd-current@freebsd.org Cc: Baptiste Daroussin Subject: Re: Cross Architecture Compiling From: Garrett Cooper Sent: Friday, November 02, 2012 3:05 PM To: Michael Vale Cc: Baptiste Daroussin Subject: Re: Cross Architecture Compiling On Thu, Nov 1, 2012 at 8:05 PM, Michael Vale wrote: Forwarding my latest zrouter redmine submission, where I have been working on updating zRouter's ports cross-arch-compilation automation system. -------- Adding: CONFIGURE_HOST?= ${TARGET_ARCH}-portbld-freebsd${OSREL} CONFIGURE_HOST:= ${CONFIGURE_HOST:S/^/--host=/} to /usr/ports/Mk/bsd.port.mk allows many ports to pickup a cross compiler simply by having the user pass TARGET_ARCH=${ARCH} at the command-line. I've been using XDEV (/usr/src# make xdev XDEV=${ARCH} XDEV_ARCH={$ARCH}) as my most current cross-compiler. CC can be overridden by specifying your CROSS_CC's PATH first in the PATH environment variable e.g. export PATH=/usr/mips-freebsd/usr/bin/:$PATH I AM NOT USING DESTDIR PORTS JAILS TO COMPLETE THESE TASKS, PLEASE MAKE GOOD NOTE AS THERE IS SOME GREAT DIFFERENCES AND MUCH WORK TO BE DONE IN THIS DEPARTMENT. Assuming above bsd.ports.mk patch one can cross compile many ports simply: TARGET=mips TARGET_ARCH=mips make -C install CHROOTED=no DESTDIR=/path/to/target/rootfs PREFIX=/ this will get you started. PREFIX MUST == / for correct pkgconfig entries and many much other things I do not wish to discuss in detail right now, please understand! CHROOTED=no is the IMPORTANT PART HERE! We cannot run a jail on a build machine with foreign binaries such as /bin/sh! THIS IS FUNDAMENTAL. I will continue to hack away at bsd.port.mk until my work is complete, I would appreciate any help as to prefixing DESTDIR transparently to PREFIX in order for proper installation of cross-compiled ports. I will submit any following patches in a more formal manner. I am open to questions and willing to expand muchly on the plethora of variables needed to be passed to build multiple ports with dependancies in more complicated scenarios. Some ports with GNU Makefiles have a different means of cross-compiling, e.g. busybox. I'll post those findings next. Regards, Michael Vale. surfnet.co -----Original Message----- From: redmine@zrouter.org Sent: Friday, November 02, 2012 1:42 PM Subject: [zrouter - Bug #37] bsd ports Issue #37 has been updated by Michael Vale. File zrouter.ports.mk.diff added you need to have xdev mips installed. /usr/src# make xdev XDEV=mips XDEV_ARCH=mips. you also need to add these two lines to bsd.ports.mk (I will submit this to the -current mailing list) CONFIGURE_HOST?= ${TARGET_ARCH}-portbld-freebsd${OSREL} CONFIGURE_HOST:= ${CONFIGURE_HOST:S/^/--host=/} between the CONFIGURE_TARGET:= ${CONFIGURE_TARGET:S/--build=//} and CONFIGURE_LOG lines. I did make other changes to bsd.ports.mk but i don't believe they are required here. Let me know if it seems there is something missing. ---------------------------------------- Bug #37: bsd ports http://redmine.zrouter.org/issues/37#change-41 Author: Michael Vale Status: New Priority: Normal Assignee: Michael Vale Category: Project Target version: fixed bsd ports make building and install this is my first attempt at any such contribution to any project. please find the attached patch for share/mk/zrouter.ports.mk. ALSO - zrouter/ports/www/zhttpd/distinfo was deleted due to an invalid SHA256 sum. Very cool. One thing that you'll run into soon that's a problem is that pkgng groks /bin/sh's ELF format in order to determine its architecture (which unfortunately makes things difficult when cross-compiling). I've CCed bapt@ so this item hopefully doesn't get lost. The way I was thinking of solving this was compiling host binaries, nullfs mounting them in a chroot, chrooting into it with the appropriate variables set, then dropping out of the chroot once the package is built, but this is another avenue for fixing the problem (just requires more work). Thanks! -Garrett Garrett, Yes I’ve already run into a fair bit of pkgng’s stubbornness as there is a few other issues with it too, again I will try and fix it myself but it would be great if bapt would chime in and we can bowl this one over! _______________________________________________ freebsd-current@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"