port building on small, single-board computers or cross building ports: for lld I'd like to use -Wl,--no-threads

Mark Millard marklmi at yahoo.com
Sat Nov 10 06:48:07 UTC 2018


On 2018-Nov-9, at 21:38, Mark Millard <marklmi at yahoo.com> wrote:

> On 2018-Nov-9, at 14:34, Mark Millard <marklmi at yahoo.com> wrote:
> 
>> On 2018-Nov-9, at 12:48, Jan Beich <jbeich at FreeBSD.org> wrote:
>> 
>>> Mark Millard via freebsd-ports <freebsd-ports at freebsd.org> writes:
>>> 
>>>> For lld I'd like to use -Wl,--no-threads during poudriere-devel use.
>>>> 
>>>> ld.bfd and such reject --no-threads .
>>>> 
>>>> It appears that for ports there is no analogous support
>>>> of something like what buildworld has as notation for
>>>> specifying such:
>>>> 
>>>> LDFLAGS.lld+= -Wl,--no-threads
>>>> 
>>>> Any recommendation on an appropriate way to have use of
>>>> lld in ports also use --no-threads in its link commands
>>>> --but other linkers not do so?
>>> 
>>> Can you try the following?
>>> 
>>> .if ${LDFLAGS:M-fuse-ld=*lld*} || ${/usr/bin/ld:L:tA} == /usr/bin/ld.lld
>>> LDFLAGS+=	-Wl,--no-threads
>>> .endif
>> 
>> I added that to /usr/local/etc/poudriere.d/make.conf . The
>> cross build via poudriere did not hang (so far). lang/gcc8
>> (full bootstrap) takes a long time so I'll not be able to
>> declare the test done for some time. (There are other
>> things to build as well.)
>> 
>> However, if a port uses devel/binutils or devel/*-binutils
>> or such would not LDFLAGS still end up with the addition,
>> which the gcc(?) ld would then reject? The notation:
>> 
>> ${/usr/bin/ld:L:tA} == /usr/bin/ld.lld
>> 
>> does not appear to depend on which linker is in actual use
>> for the specific port generally --or what config scripting
>> might do before picking how later stages will work.
> 
> For what I've cross-built so far, I've had no such examples
> as below, so for now it is working for me for that context.
> Thanks!
> 
> But the notation issue is confirmed (non-cross build
> example). . .
> 
> I updated what ports vintage my amd64 context was based on
> ( -r48-0180 to -r484565 ) and tried a poudriere bulk with
> your 3 lines in poudriere.d/make.conf . The result for
> security/nss was:
> 
> [00:12:03] [23] [00:04:06] Saved security/nss | nss-3.40 wrkdir to: /usr/local/poudriere/data/wrkdirs/FBSDFSSDjail-default/default/nss-3.40.tbz
> [00:12:04] [23] [00:04:07] Finished security/nss | nss-3.40: Failed: build
> 
> because of:
> 
> cc -B/usr/local/bin -o FreeBSD13.0_OPT.OBJ/nsinstall -O2 -pipe  -I/usr/local/include/nspr -g -fstack-protector -fno-strict-aliasing   -fPIC -Wall -Wno-switch -DFREEBSD -DHAVE_STRERROR -DHAVE_BSD_FLOCK -Wall -Wshadow -Qunused-arguments -Wno-parentheses-equality -Wno-array-bounds -Wno-unevaluated-expression -Werror -DXP_UNIX -UDEBUG -DNDEBUG -D_THREAD_SAFE -D_REENTRANT -DNSS_NO_INIT_SUPPORT -DUSE_UTIL_DIRECTLY -DNO_NSPR_10_SUPPORT -DSSL_DISABLE_DEPRECATED_CIPHER_SUITE_NAMES -I./../dist/FreeBSD13.0_OPT.OBJ/include -I./../dist/public/ -I./../dist/private/   -fPIC -Wall -Wno-switch -DFREEBSD -DHAVE_STRERROR -DHAVE_BSD_FLOCK -Wall -Wshadow -Qunused-arguments -Wno-parentheses-equality -Wno-array-bounds -Wno-unevaluated-expression -Werror -DXP_UNIX -UDEBUG -DNDEBUG -D_THREAD_SAFE -D_REENTRANT -DNSS_NO_INIT_SUPPORT -DUSE_UTIL_DIRECTLY -DNO_NSPR_10_SUPPORT -DSSL_DISABLE_DEPRECATED_CIPHER_SUITE_NAMES -I../../dist/FreeBSD13.0_OPT.OBJ/include -I../../dist/public/coreconf -I../../dist/private/coreconf   -fPIC -Wall -Wno-switch -DFREEBSD -DHAVE_STRERROR -DHAVE_BSD_FLOCK -Wall -Wshadow -Qunused-arguments -Wno-parentheses-equality -Wno-array-bounds -Wno-unevaluated-expression -Werror -DXP_UNIX -UDEBUG -DNDEBUG -D_THREAD_SAFE -D_REENTRANT -DNSS_NO_INIT_SUPPORT -DUSE_UTIL_DIRECTLY -DNO_NSPR_10_SUPPORT -DSSL_DISABLE_DEPRECATED_CIPHER_SUITE_NAMES -I../../../dist/FreeBSD13.0_OPT.OBJ/include -I../../../dist/public/coreconf -I../../../dist/private/coreconf  FreeBSD13.0_OPT.OBJ/nsinstall.o FreeBSD13.0_OPT.OBJ/pathsub.o  -Wl,--no-threads -fstack-protector    -pthread
> /usr/local/bin/ld: unrecognized option '--no-threads'
> /usr/local/bin/ld: use the --help option for usage information
> cc: error: linker command failed with exit code 1 (use -v to see invocation)
> gmake[3]: *** [../../coreconf/rules.mk:243: FreeBSD13.0_OPT.OBJ/nsinstall] Error 1
> gmake[3]: Leaving directory '/wrkdirs/usr/ports/security/nss/work/nss-3.40/nss/coreconf/nsinstall'
> 
> 
> So, a mix of cc (system clang) and /usr/local/bin/ld in use together.
> It ended up with -Wl,--no-threads used and passing /usr/local/bin/ld
> --no-threads .

Just an FYI: gcc8 (set as the default) was given the
-Wl,--no-threads by devel/kBuild :

cd /wrkdirs/usr/ports/devel/kBuild/work/kBuild-0.1.9998 && /usr/bin/env AUTORECONF=/usr/local/bin/autoreconf  AUTOPOINT=true  CC="gcc8" CFLAGS="-O2 -pipe  -g -fstack-protector -Wl,-rpath=/usr/local/li
b/gcc8 -fno-strict-aliasing " CPPFLAGS=""  LDFLAGS=" -Wl,--no-threads -fstack-protector -Wl,-rpath=/usr/local/lib/gcc8 -L/usr/local/lib/gcc8 " MAKE="gmake" ./kBuild/env.sh --full gmake -f bootstrap.gm

So the examples are not limited to clang/binutil mixes.

I'll not list any more examples that may show up.

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



More information about the freebsd-ports mailing list