On 01/09/2018 04:47, O. Hartmann wrote:
> On Mon, 8 Jan 2018 20:14:16 +0000 (UTC)
> Conrad Meyer <c...@freebsd.org> wrote:
> 
>> Author: cem
>> Date: Mon Jan  8 20:14:16 2018
>> New Revision: 327706
>> URL: https://svnweb.freebsd.org/changeset/base/327706
>>
>> Log:
>>   Integrate zstd into the kernel
>>   
>>   Mock userspace headers and include mocked headers first in compilation
>>   command to inject kernel headers and override e.g., malloc(3) with
>>   malloc(9).
>>   
>>   Submitted by:      allanjude
>>   Reviewed by:       imp (earlier version), bapt (earlier version)
>>   Differential Revision:     https://reviews.freebsd.org/D10407
>>
>> Added:
>>   head/sys/contrib/zstd/lib/freebsd/
>>   head/sys/contrib/zstd/lib/freebsd/stddef.h   (contents, props changed)
>>   head/sys/contrib/zstd/lib/freebsd/stdint.h   (contents, props changed)
>>   head/sys/contrib/zstd/lib/freebsd/stdio.h   (contents, props changed)
>>   head/sys/contrib/zstd/lib/freebsd/stdlib.h   (contents, props changed)
>>   head/sys/contrib/zstd/lib/freebsd/string.h   (contents, props changed)
>>   head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.h   (contents, props
>> changed) head/sys/contrib/zstd/lib/freebsd/zstd_kmalloc.c   (contents, props
>> changed) Modified:
>>   head/sys/conf/files
>>   head/sys/conf/kern.pre.mk

...

> It seems that CURRENT is unwilling to build due to the error shown below:
> 
> [...]
> --- fse_decompress.o ---
> In file included from 
> /usr/src/sys/contrib/zstd/lib/common/fse_decompress.c:41:
> /usr/src/sys/contrib/zstd/lib/common/bitstream.h:71:12: fatal error:
> 'immintrin.h' file not found #  include <immintrin.h>   /* support for bextr
> (experimental) */ ^~~~~~~~~~~~~
> --- modules-all ---

I reported the same problem yesterday but I didn't get any reply yet.
Basically, if CPUTYPE is set in /etc/make.conf and the CPU supports BMI
instructions, it breaks.  You can use the attached patch as a stopgap.
Please note the patch was updated after r327715.

Jung-uk Kim
Index: sys/conf/kern.pre.mk
===================================================================
--- sys/conf/kern.pre.mk	(revision 327736)
+++ sys/conf/kern.pre.mk	(working copy)
@@ -133,7 +133,7 @@ NORMAL_FWO= ${LD} -b binary --no-warn-mismatch -d
 	-m ${LD_EMULATION} -o ${.TARGET} ${.ALLSRC:M*.fw}
 
 # for ZSTD in the kernel (include zstd/lib/freebsd before other CFLAGS)
-ZSTD_C= ${CC} -c -DZSTD_HEAPMODE=1 -I$S/contrib/zstd/lib/freebsd ${CFLAGS} -I$S/contrib/zstd/lib -I$S/contrib/zstd/lib/common ${WERROR} -Wno-inline -Wno-missing-prototypes ${PROF} ${.IMPSRC}
+ZSTD_C= ${CC} -c -DZSTD_HEAPMODE=1 -U__BMI__ -I$S/contrib/zstd/lib/freebsd ${CFLAGS} -I$S/contrib/zstd/lib -I$S/contrib/zstd/lib/common ${WERROR} -Wno-inline -Wno-missing-prototypes ${PROF} ${.IMPSRC}
 
 # Common for dtrace / zfs
 CDDL_CFLAGS=	-DFREEBSD_NAMECACHE -nostdinc -I$S/cddl/compat/opensolaris -I$S/cddl/contrib/opensolaris/uts/common -I$S -I$S/cddl/contrib/opensolaris/common ${CFLAGS} -Wno-unknown-pragmas -Wno-missing-prototypes -Wno-undef -Wno-strict-prototypes -Wno-cast-qual -Wno-parentheses -Wno-redundant-decls -Wno-missing-braces -Wno-uninitialized -Wno-unused -Wno-inline -Wno-switch -Wno-pointer-arith -Wno-unknown-pragmas

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to