base/binutils vs. /usr/local/lib references and also: undefined reference to `pthread_create' (powerpc64 targeting example)

Mark Millard marklmi at yahoo.com
Sat Oct 6 06:10:38 UTC 2018


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
. . .
--- recode-sr-latin ---
/bin/sh ../libtool  --tag=CC    --mode=link /usr/local/bin/powerpc64-unknown-freebsd12.0-gcc --sysroot=/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
--- cldr_plurals-cldr-plural.o ---
. . .
--- recode-sr-latin ---
libtool: link: /usr/local/bin/powerpc64-unknown-freebsd12.0-gcc --sysroot=/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'
collect2: error: ld returned 1 exit status
*** [recode-sr-latin] Error code 1

make[16]: stopped in /wrkdirs/usr/ports/devel/gettext-tools/work/gettext-0.19.8.1/gettext-tools/src


The use of -L/usr/local/lib and -Wl,-rpath -Wl,/usr/local/lib look
suspect for such cross builds:

# 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

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.]

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.)

(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.)



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


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.


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



More information about the freebsd-ppc mailing list