Bug 229702 - armv8crypto fails to build on 12-current
Summary: armv8crypto fails to build on 12-current
Status: Closed Not A Bug
Alias: None
Product: Base System
Classification: Unclassified
Component: arm (show other bugs)
Version: CURRENT
Hardware: arm64 Any
: --- Affects Many People
Assignee: freebsd-arm (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-07-11 14:20 UTC by tech-lists
Modified: 2018-07-13 11:38 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description tech-lists 2018-07-11 14:20:51 UTC
The following was on r336134 12-current snapshot, building from 336195 sources on a raspberry pi 3+. No src.conf or make.conf is present. 

RPI3 looks like this:

include GENERIC

ident   RPI3

nooptions       INVARIANTS
nooptions       INVARIANT_SUPPORT
nooptions       WITNESS
nooptions       WITNESS_SKIPSPIN
nooptions       DEADLKRES
nooptions       USB_DEBUG

make -j1 buildkernel KERNCONF=RPI3

===> armv8crypto (all)
[Creating objdir
/ext/obj/ext/src/arm64.aarch64/sys/RPI3/modules/ext/src/sys/modules/armv8crypto...]
machine -> /ext/src/sys/arm64/include
ln -sf /ext/obj/ext/src/arm64.aarch64/sys/RPI3/opt_bus.h opt_bus.h
awk -f /ext/src/sys/tools/makeobjops.awk /ext/src/sys/kern/device_if.m -h
awk -f /ext/src/sys/tools/makeobjops.awk /ext/src/sys/kern/bus_if.m -h
awk -f /ext/src/sys/tools/makeobjops.awk
/ext/src/sys/opencrypto/cryptodev_if.m -h
cc -target aarch64-unknown-freebsd12.0
--sysroot=/ext/obj/ext/src/arm64.aarch64/tmp
-B/ext/obj/ext/src/arm64.aarch64/tmp/usr/bin -c -O2 -pipe
-fno-strict-aliasing -Werror -D_KERNEL -DKLD_MODULE -DKLD_TIED
-nostdinc -DHAVE_KERNEL_OPTION_HEADERS -include
/ext/obj/ext/src/arm64.aarch64/sys/RPI3/opt_global.h -I.
-I/ext/src/sys -I/ext/src/sys/contrib/ck/include -g -fPIC
-I/ext/obj/ext/src/arm64.aarch64/sys/RPI3 -MD -MF.depend.genoffset.o
-MTgenoffset.o -mgeneral-regs-only -ffixed-x18 -ffreestanding -fwrapv
-fstack-protector -gdwarf-2 -Wall -Wredundant-decls -Wnested-externs
-Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wcast-qual
-Wundef -Wno-pointer-sign -D__printf__=__freebsd_kprintf__
-Wmissing-include-dirs -fdiagnostics-show-option -Wno-unknown-pragmas
-Wno-error-tautological-compare -Wno-error-empty-body
-Wno-error-parentheses-equality -Wno-error-unused-function
-Wno-error-pointer-sign -Wno-error-shift-negative-value
-Wno-address-of-packed-member -std=iso9899:1999
/ext/src/sys/kern/genoffset.c
sh /ext/src/sys/kern/genoffset.sh genoffset.o > offset.inc
cc -target aarch64-unknown-freebsd12.0
--sysroot=/ext/obj/ext/src/arm64.aarch64/tmp
-B/ext/obj/ext/src/arm64.aarch64/tmp/usr/bin  -O2 -pipe
-fno-strict-aliasing -Werror -D_KERNEL -DKLD_MODULE -DKLD_TIED
-nostdinc   -DHAVE_KERNEL_OPTION_HEADERS -include
/ext/obj/ext/src/arm64.aarch64/sys/RPI3/opt_global.h -I.
-I/ext/src/sys -I/ext/src/sys/contrib/ck/include -fno-common -g -fPIC
-I/ext/obj/ext/src/arm64.aarch64/sys/RPI3   -MD
-MF.depend.armv8_crypto.o -MTarmv8_crypto.o -mgeneral-regs-only
-ffixed-x18 -ffreestanding -fwrapv -fstack-protector -gdwarf-2 -Wall
-Wredundant-decls -Wnested-externs -Wstrict-prototypes
-Wmissing-prototypes -Wpointer-arith -Wcast-qual -Wundef
-Wno-pointer-sign -D__printf__=__freebsd_kprintf__
-Wmissing-include-dirs -fdiagnostics-show-option -Wno-unknown-pragmas
-Wno-error-tautological-compare -Wno-error-empty-body
-Wno-error-parentheses-equality -Wno-error-unused-function
-Wno-error-pointer-sign -Wno-error-shift-negative-value
-Wno-address-of-packed-member    -std=iso9899:1999 -c
/ext/src/sys/crypto/armv8/armv8_crypto.c -o armv8_crypto.o
ctfconvert -L VERSION -g armv8_crypto.o
cc -target aarch64-unknown-freebsd12.0
--sysroot=/ext/obj/ext/src/arm64.aarch64/tmp
-B/ext/obj/ext/src/arm64.aarch64/tmp/usr/bin -c -O3 -pipe
-fno-strict-aliasing -Werror -D_KERNEL -DKLD_MODULE -DKLD_TIED
-DHAVE_KERNEL_OPTION_HEADERS -include
/ext/obj/ext/src/arm64.aarch64/sys/RPI3/opt_global.h -I.
-I/ext/src/sys -I/ext/src/sys/contrib/ck/include -fno-common -g -fPIC
-I/ext/obj/ext/src/arm64.aarch64/sys/RPI3 -ffixed-x18 -ffreestanding
-fwrapv -fstack-protector -gdwarf-2 -Wall -Wredundant-decls
-Wnested-externs -Wstrict-prototypes -Wmissing-prototypes
-Wpointer-arith -Wcast-qual -Wundef -Wno-pointer-sign
-D__printf__=__freebsd_kprintf__ -Wmissing-include-dirs
-fdiagnostics-show-option -Wno-unknown-pragmas
-Wno-error-tautological-compare -Wno-error-empty-body
-Wno-error-parentheses-equality -Wno-error-unused-function
-Wno-error-pointer-sign -Wno-error-shift-negative-value
-Wno-address-of-packed-member -std=iso9899:1999  -Werror
-march=armv8-a+crypto /ext/src/sys/crypto/armv8/armv8_crypto_wrap.c
In file included from /ext/src/sys/crypto/armv8/armv8_crypto_wrap.c:46:
/usr/lib/clang/6.0.1/include/arm_neon.h:31:10: fatal error: 'stdint.h'
file not found
#include <stdint.h>
         ^~~~~~~~~~
1 error generated.
*** [armv8_crypto_wrap.o] Error code 1

make[4]: stopped in /ext/src/sys/modules/armv8crypto
1 error

make[4]: stopped in /ext/src/sys/modules/armv8crypto
*** [all_subdir_armv8crypto] Error code 2

make[3]: stopped in /ext/src/sys/modules
1 error

make[3]: stopped in /ext/src/sys/modules
*** [modules-all] Error code 2

make[2]: stopped in /ext/obj/ext/src/arm64.aarch64/sys/RPI3
1 error

make[2]: stopped in /ext/obj/ext/src/arm64.aarch64/sys/RPI3
*** [buildkernel] Error code 2

make[1]: stopped in /ext/src
1 error

make[1]: stopped in /ext/src
*** [buildkernel] Error code 2

make: stopped in /ext/src
1 error

make: stopped in /ext/src
Comment 1 Mark Millard 2018-07-11 15:51:14 UTC
This may be a duplicate of bugzilla 220125 that is still not
fixed.

Was this more like:

make buildworld buildkernel

or was it more like:

make kernel-toolchain buildkernel

?

If it was via kernel-toolchain, then it is a duplicate of bugzilla 220125.
(Bugzilla 223229 is another duplicate, but officially marked as such.)

If it was via buildworld, then it is new.

From 220125 the exact error report from the compiler was:

--- armv8_crypto_wrap.o ---
In file included from /usr/src/sys/crypto/armv8/armv8_crypto_wrap.c:46:
/usr/obj/cortexA53dbg_clang/arm64.aarch64/usr/src/tmp/usr/bin/../lib/clang/4.0.0/include/arm_neon.h:31:10: fatal error: 'stdint.h' file not found
#include <stdint.h>
         ^~~~~~~~~~
--- all_subdir_armv8crypto ---
*** [armv8_crypto_wrap.o] Error code 1

(See bugzilla 220125 for more.)
Comment 2 tech-lists 2018-07-12 11:24:45 UTC
It was neither, just download sources then make buildkernel.
Comment 3 Mark Millard 2018-07-12 13:29:30 UTC
(In reply to tech-lists from comment #2)

So this report is effectively a duplicate if using buildworld first
avoids the problem.

https://www.freebsd.org/cgi/man.cgi?build(7) is very explicit about what
is supposed to be the case relative to kernel-toolchain use:

     kernel-toolchain  Rebuild the tools needed	for kernel compilation.	 Use
		       this if you did not do a	buildworld first.

In other words: buildkernel is not intended to be self-contained/sufficient
according to the build documentation but buildworld should not be required.

Note the difference in the buildkernel and buildworld descriptions, given
the above:

     buildkernel       Rebuild the kernel and the kernel modules.  The object
		       directory can be	changed	from the default /usr/obj by
		       setting the MAKEOBJDIRPREFIX make(1) variable.

vs.

     buildworld	      Build everything but the kernel, configure files in etc,
		      and release.  The	object directory can be	changed	from
		      the default /usr/obj by setting the MAKEOBJDIRPREFIX
		      make(1) variable.	 The actual build location prefix used
		      is ${MAKEOBJDIRPREFIX}${.CURDIR} for native builds, and
		      ${MAKEOBJDIRPREFIX}/${TARGET}${.CURDIR} for cross	builds
		      and native builds	with variable CROSS_BUILD_TESTING set.

But, as you discovered, . . .

Currently, overall, FreeBSD does not meet its own criteria for aarch64 relative
to kernel-toolchain .

As far as I can tell the issue can be summarized relative to kernel-toolchain
by saying that kernel-toolchain does not currently establish a (full)
freestanding C99 environment (relative to the headers anyway) but building clang
requires (at least) one of the missing items ( stdint.h ) for aarch64
contexts.
Comment 4 Mark Millard 2018-07-12 20:11:19 UTC
(In reply to Mark Millard from comment #3)

I screwed up what has the stdint.h reference.

As was pointed out on the lists by Dimitry Andric, quoting . . .

No, it's because sys/crypto/armv8/armv8_crypto_wrap.c includes
<arm_neon.h>, an intrinsics header, which in turn requires <stdint.h>.

This was introduced in https://svnweb.freebsd.org/changeset/base/308921,
and at the time resulted in similar build failures, specifically when
one attempted to build a new kernel, without building world or a new
toolchain first.
Comment 5 tech-lists 2018-07-13 11:38:33 UTC
This succeeds with make buildworld done first, so closing this PR