Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 6 Oct 2018 12:22:12 -0700
From:      Mark Millard <marklmi@yahoo.com>
To:        FreeBSD Toolchain <freebsd-toolchain@freebsd.org>, FreeBSD PowerPC ML <freebsd-ppc@freebsd.org>
Subject:   Re: base/binutils vs. /usr/local/lib references and also: undefined reference to `pthread_create' (powerpc64 targeting example)
Message-ID:  <F71D7FCC-801E-498C-8B68-2D25FA55A36A@yahoo.com>
In-Reply-To: <4C338B84-1179-4569-A964-CA18A22AF1D7@yahoo.com>
References:  <4C338B84-1179-4569-A964-CA18A22AF1D7@yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
[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=3D. . .
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.]

On 2018-Oct-5, at 11:00 PM, Mark Millard <marklmi at yahoo.com> 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:
>=20
> ( My /etc/make.conf has: WRKDIRPREFIX?=3D/wrkdirs .)
>=20
> # cd ../../base/binutils/
> # make CROSS_TOOLCHAIN=3Dpowerpc64-gcc =
CROSS_SYSROOT=3D/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.

> --- recode-sr-latin ---
> /bin/sh ../libtool  --tag=3DCC    --mode=3Dlink =
/usr/local/bin/powerpc64-unknown-freebsd12.0-gcc =
--sysroot=3D/usr/obj/DESTDIRs/xtcgcc-powerpc64-installworld   -O2 -pipe  =
-DLIBICONV_PLUG -g -fno-strict-aliasing    -o recode-sr-latin =
recode_sr_latin-recode-sr-latin.o  recode_sr_latin-filter-sr-latin.o =
../gnulib-lib/libgettextlib.la  ../intl/libintl.la    -L/usr/local/lib

So the following is wrong:

--mode=3Dlink /usr/local/bin/powerpc64-unknown-freebsd12.0-gcc =
--sysroot=3D/usr/obj/DESTDIRs/xtcgcc-powerpc64-installworld

here and analogous points are later.

> --- cldr_plurals-cldr-plural.o ---
> . . .
> --- recode-sr-latin ---
> libtool: link: /usr/local/bin/powerpc64-unknown-freebsd12.0-gcc =
--sysroot=3D/usr/obj/DESTDIRs/xtcgcc-powerpc64-installworld -O2 -pipe =
-DLIBICONV_PLUG -g -fno-strict-aliasing -o .libs/recode-sr-latin =
recode_sr_latin-recode-sr-latin.o recode_sr_latin-filter-sr-latin.o  =
../gnulib-lib/.libs/libgettextlib.so =
/wrkdirs/usr/ports/devel/gettext-tools/work/gettext-0.19.8.1/gettext-tools=
/intl/.libs/libintl.so -L/usr/local/lib ../intl/.libs/libintl.so -lm =
-lncurses -Wl,-rpath -Wl,/usr/local/lib
> --- hostname ---
> . . .
> --- recode-sr-latin ---
> =
/wrkdirs/usr/ports/devel/gettext-tools/work/gettext-0.19.8.1/gettext-tools=
/intl/.libs/libintl.so: undefined reference to `pthread_create'

devel/gettext-tools has an option to enable/disable building for thread
use, with a default of enabled.

> collect2: error: ld returned 1 exit status
> *** [recode-sr-latin] Error code 1
>=20
> make[16]: stopped in =
/wrkdirs/usr/ports/devel/gettext-tools/work/gettext-0.19.8.1/gettext-tools=
/src
>=20
>=20
> The use of -L/usr/local/lib and -Wl,-rpath -Wl,/usr/local/lib look
> suspect for such cross builds:
>=20
> # ls /usr/obj/DESTDIRs/xtcgcc-powerpc64-installworld/usr/local/lib/
> ls: /usr/obj/DESTDIRs/xtcgcc-powerpc64-installworld/usr/local/lib/: No =
such file or directory

I went the wrong direction with this: it should not be a powerpc64
targeted operation and so /usr/local/lib appears to be a correct
aspect.

> Then there is also: undefined reference to `pthread_create'. Is there
> a missing -pthread or some such? (Or is the /usr/local/lib reference
> a cause?) [FYI: The earlier pkg build seem to have worked.]

This sort of aspect might still apply.

> Looks like this way of getting to 12 or later for powerpc64 without
> use of gcc 4.2.1 is currently blocked. (The issue may not be limited
> to powerpc64.)

May be if devel/gettext-tools had been pre-built and installed
before trying the CROSS_TOOLCHAIN=3Dpowerpc64-gcc
CROSS_SYSROOT=3D/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.

> (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=3D is used at the time. For the cross =
buildworld
> itself it is not clear what options are intended.)
>=20
>=20
>=20
> Notes about some typos on: https://wiki.freebsd.org/ExternalGCC
>=20
> /usr/ports/devel/ports-mgmt/pkg should be:
> /usr/ports/ports-mgmt/pkg
>=20
> 3 examples of CROSS_TOOCLAHIN should be:
> CROSS_TOOLCHAIN
>=20
>=20
> Notes about the /usr/ports/base/README :
>=20
> 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.

There may be more material needed on one or both of
https://wiki.freebsd.org/ExternalGCC and/or
/usr/ports/base/README for the likes of how/when
things like devel/gettext-tools should be built
vs. when CROSS_TOOLCHAIN=3D. . . CROSS_SYSROOT=3D . . .
builds build steps should be done.

There may be more material needed about the build
options to use for various steps, such as if
devel/gettext-tools should have threading enabled
vs. disabled.

The following seem to have a similar status to
devel/gettext-tools:

math/gmp
math/mpfr
devel/bison
devel/m4 (indirectly via devel/bison)
devel/gmake
devel/gettext-tools (just for list completeness)=20

in that each is a build dependency for
devel/binutils variants, such as base/binutils .

With those 6 ports pre-installed as host
non-cross-build material (amd64 here) the cross
build/package of base/binutils worked, given that
it was not already installed as host material.

[In thinking about it I think I made similar notes
and sent them out on the lists long ago. base/*
have improved much since then: I reported a
lot more then as well that does not apply now.]

=3D=3D=3D
Mark Millard
marklmi at yahoo.com
( dsl-only.net went
away in early 2018-Mar)




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?F71D7FCC-801E-498C-8B68-2D25FA55A36A>