Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 2 Nov 2012 15:26:28 +1100
From:      "Michael Vale" <masked@internode.on.net>
To:        "Garrett Cooper" <yanegomi@gmail.com>, <freebsd-current@freebsd.org>
Cc:        Baptiste Daroussin <bapt@freebsd.org>
Subject:   Re: Cross Architecture Compiling
Message-ID:  <69B6751E5B51467EBF7F25735C497912@forexamplePC>
In-Reply-To: <CAGH67wTauT7srMtCJrPnwpqiL0-RfPoQcfkRRMDeyJWXQPBb1w@mail.gmail.com>
References:  <98E79AD90A1B4A2581C12BD73FEDEDC3@forexamplePC> <CAGH67wTauT7srMtCJrPnwpqiL0-RfPoQcfkRRMDeyJWXQPBb1w@mail.gmail.com>

index | next in thread | previous in thread | raw e-mail



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 <masked@internode.on.net> 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!
From owner-freebsd-current@FreeBSD.ORG  Fri Nov  2 04:59:23 2012
Return-Path: <owner-freebsd-current@FreeBSD.ORG>
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 63D08F78;
 Fri,  2 Nov 2012 04:59:23 +0000 (UTC)
 (envelope-from sgk@troutmask.apl.washington.edu)
Received: from troutmask.apl.washington.edu (troutmask.apl.washington.edu
 [128.95.76.21])
 by mx1.freebsd.org (Postfix) with ESMTP id 3A0BA8FC0C;
 Fri,  2 Nov 2012 04:59:23 +0000 (UTC)
Received: from troutmask.apl.washington.edu (localhost.apl.washington.edu
 [127.0.0.1])
 by troutmask.apl.washington.edu (8.14.5/8.14.5) with ESMTP id qA24xHYr077253;
 Thu, 1 Nov 2012 21:59:17 -0700 (PDT)
 (envelope-from sgk@troutmask.apl.washington.edu)
Received: (from sgk@localhost)
 by troutmask.apl.washington.edu (8.14.5/8.14.5/Submit) id qA24xH0T077252;
 Thu, 1 Nov 2012 21:59:17 -0700 (PDT) (envelope-from sgk)
Date: Thu, 1 Nov 2012 21:59:17 -0700
From: Steve Kargl <sgk@troutmask.apl.washington.edu>
To: Brooks Davis <brooks@freebsd.org>
Subject: Re: November 5th is Clang-Day
Message-ID: <20121102045917.GA77204@troutmask.apl.washington.edu>
References: <20121102032945.GF65074@lor.one-eyed-alien.net>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20121102032945.GF65074@lor.one-eyed-alien.net>
User-Agent: Mutt/1.5.21 (2010-09-15)
Cc: freebsd-current@freebsd.org
X-BeenThere: freebsd-current@freebsd.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Discussions about the use of FreeBSD-current
 <freebsd-current.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/options/freebsd-current>,
 <mailto:freebsd-current-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/freebsd-current>;
List-Post: <mailto:freebsd-current@freebsd.org>
List-Help: <mailto:freebsd-current-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-current>,
 <mailto:freebsd-current-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 02 Nov 2012 04:59:23 -0000

On Thu, Nov 01, 2012 at 10:29:45PM -0500, Brooks Davis wrote:
>  - Not all libm tests pass.  More work by subject matter experts is
>    required to create tests cases for LLVM developers.  Most problems are
>    not expected to be major in practice given that LLVM is being used for
>    scientific computing in a number of products including Cray's FORTRAN
>    compiler, most OpenCL compilers, and the Julia language.

Is there a knob to continue to use GCC as the default compiler?

The above statement is somewhat troubling to those of us
who use FreeBSD as computational nodes.

BTW, the name of the language is "Fortran".  It's been "Fortran"
for the last 30-something years.

--
Steve


help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69B6751E5B51467EBF7F25735C497912>