From owner-freebsd-toolchain@freebsd.org Wed Oct 10 22:13:49 2018 Return-Path: Delivered-To: freebsd-toolchain@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5B5A910BE215; Wed, 10 Oct 2018 22:13:49 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 014FD743EC; Wed, 10 Oct 2018 22:13:48 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro-2.local (ralph.baldwin.cx [66.234.199.215]) by mail.baldwin.cx (Postfix) with ESMTPSA id 182F510A87D; Wed, 10 Oct 2018 18:13:46 -0400 (EDT) Subject: Re: base/binutils vs. /usr/local/lib references and also: undefined reference to `pthread_create' (powerpc64 targeting example) To: Mark Millard , FreeBSD Toolchain , FreeBSD PowerPC ML References: <4C338B84-1179-4569-A964-CA18A22AF1D7@yahoo.com> From: John Baldwin Message-ID: <3c10995e-2c84-a140-ed4d-449ce61d3d05@FreeBSD.org> Date: Wed, 10 Oct 2018 15:13:44 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Wed, 10 Oct 2018 18:13:48 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: freebsd-toolchain@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: Maintenance of FreeBSD's integrated toolchain List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Oct 2018 22:13:49 -0000 On 10/6/18 12:22 PM, Mark Millard via freebsd-toolchain wrote: > [Actually devel/gettext-tools is a build time dependency: it should not be using > libtool: link: /usr/local/bin/powerpc64-unknown-freebsd12.0-gcc --sysroot=. . . > It looks like the /usr/local/lib references are correct but the wrong linker was > being used. About 5 other ports have a similar status for making base/binutils > as a cross build.] base/binutils should not be pulling in any other ports at all. Everytime I've built it it has had no other dependencies beyond pkg. As far as I'm aware, the only ports which work with CROSS_TOOLCHAIN and CROSS_SYSROOT are ports-mgmt/pkg, base/gcc, and base/binutils. > On 2018-Oct-5, at 11:00 PM, Mark Millard wrote: > >> In trying to follow the base/binutils part of https://wiki.freebsd.org/ExternalGCC >> (or /usr/ports/base/README) for targeting powerpc64 I got: >> >> ( My /etc/make.conf has: WRKDIRPREFIX?=/wrkdirs .) >> >> # cd ../../base/binutils/ >> # make CROSS_TOOLCHAIN=powerpc64-gcc CROSS_SYSROOT=/usr/obj/DESTDIRs/xtcgcc-powerpc64-installworld package >> . . . > > Note: This should involve building devel/gettext-tools targetting amd64 > (the host environment in this example) because devel/gettext-tools is > a build-time dependency, not to be run on the target system. Maybe install gettext on your system first before doing the build. Probably the CROSS_* aren't stripped from the environment when building dependencies. > May be if devel/gettext-tools had been pre-built and installed > before trying the CROSS_TOOLCHAIN=powerpc64-gcc > CROSS_SYSROOT=/usr/obj/DESTDIRs/xtcgcc-powerpc64-installworld > based build activity it would have been okay? > > [I try such later below and report on the results.] > > There are no words on https://wiki.freebsd.org/ExternalGCC or > in /usr/ports/base/README for such special build-sequence > instructions. You're maybe the 3rd person trying it. :-/ >> (It is also unclear how the process involving base/* mixes with doing >> later FreeBSD updates from source --including any use of a delete-old >> step if WITHOUT_BINUTILS= is used at the time. For the cross buildworld >> itself it is not clear what options are intended.) So I plan on having a freebsd-gcc.mk (or freebsd-cc.mk) toolchain file that base/gcc will install that will set WITHOUT_BINUTILS and some other things. I have manually done that for now when building world inside a MIPS qemu instance using base/binutils and base/gcc as the native toolchain. Once I have a build that actually finishes I plan to add the toolchain to the port and then have Makefile.inc1 automatically include the file it is present. >> Notes about some typos on: https://wiki.freebsd.org/ExternalGCC >> >> /usr/ports/devel/ports-mgmt/pkg should be: >> /usr/ports/ports-mgmt/pkg >> >> 3 examples of CROSS_TOOCLAHIN should be: >> CROSS_TOOLCHAIN Fixed. >> Notes about the /usr/ports/base/README : >> >> No mention is made of the pkg build so that it can be >> set up on the target. Only https://wiki.freebsd.org/ExternalGCC >> has that information. /usr/ports/base/README does not >> reference https://wiki.freebsd.org/ExternalGCC either. The README predates the wiki page by a fair bit. The current known issue I need to get back to with base/gcc is that it improperly looks for libraries in /usr/lib when --sysroot is used. I need to get that fixed so that a buildworld via base/gcc works correctly and then I will probably get back to working on more of the todo items on the wiki page. -- John Baldwin