Subject: bug#78562: Coreutils-9.7 do not build on macOS High Sierra, Version 10.13.6, because src/cksum.c: uses invalid cpu feature string for builtin

From: Peter Dyballa <[email-masked]>
Date: Thu, 29 May 2025 10:12:15 +0200

First try with coreutils-9.7.39-c8d75 and Apple LLVM version 10.0.0 (clang-1000.11.45.5) AND without Pádraig's patch from a few days ago. I have to change 1.18 to 1.17 in aclocal.m4 and configure (for which I prepared patches to automate this). At the end of configure step I get:

	Warning: Configuration logfiles contain indications of -Wimplicit-function-declaration; check that features were not accidentally disabled:
	  alignof: found in coreutils-9.7.39-c8d75/config.log
	  __GNUC_PREREQ: found in coreutils-9.7.39-c8d75/config.log
	  unreachable: found in coreutils-9.7.39-c8d75/config.log
	  MIN: found in coreutils-9.7.39-c8d75/config.log
	  __fpending: found in coreutils-9.7.39-c8d75/config.log
	  re_set_syntax: found in coreutils-9.7.39-c8d75/config.log
	  re_compile_pattern: found in coreutils-9.7.39-c8d75/config.log
	  re_search: found in coreutils-9.7.39-c8d75/config.log
	  re_match: found in coreutils-9.7.39-c8d75/config.log
	  free: found in coreutils-9.7.39-c8d75/config.log
	Warning: Configuration logfiles contain indications of -Wimplicit-int; check that features were not accidentally disabled:
	  found in coreutils-9.7.39-c8d75/config.log

When starting to build I get:

	make: Entering directory `/opt/local/var/macports/build/_opt_mports_macports-ports_sysutils_coreutils-devel/coreutils-devel/work/coreutils-9.7.39-c8d75'
	 cd . && /bin/sh /opt/local/var/macports/build/_opt_mports_macports-ports_sysutils_coreutils-devel/coreutils-devel/work/coreutils-9.7.39-c8d75/build-aux/missing automake-1.17 --gnu
	aclocal.m4:17: warning: this file was generated for autoconf 2.72.84-63ffa.
	You have another version of autoconf.  It may work, but is not guaranteed to.
	If you have problems, you may need to regenerate the build system entirely.
	To do so, use the procedure documented by the package, typically 'autoreconf'.
	 cd . && /bin/sh ./config.status Makefile depfiles
	config.status: creating Makefile
	config.status: executing depfiles commands

It comes to a well-known error:

	mv -f src/.deps/cksum-digest.Tpo src/.deps/cksum-digest.Po
	/usr/bin/clang  -I. -I./lib  -DHASH_ALGO_CKSUM=1 -DHAVE_CONFIG_H -Ilib -I./lib -Isrc -I./src -I/opt/local/include   -pipe -Os -arch x86_64 -MT src/blake2/cksum-blake2b-ref.o -MD -MP -MF src/blake2/.deps/cksum-blake2b-ref.Tpo -c -o src/blake2/cksum-blake2b-ref.o `test -f 'src/blake2/blake2b-ref.c' || echo './'`src/blake2/blake2b-ref.c
	mv -f src/blake2/.deps/cksum-blake2b-ref.Tpo src/blake2/.deps/cksum-blake2b-ref.Po
	/usr/bin/clang  -I. -I./lib  -DHASH_ALGO_CKSUM=1 -DHAVE_CONFIG_H -Ilib -I./lib -Isrc -I./src -I/opt/local/include   -pipe -Os -arch x86_64 -MT src/blake2/cksum-b2sum.o -MD -MP -MF src/blake2/.deps/cksum-b2sum.Tpo -c -o src/blake2/cksum-b2sum.o `test -f 'src/blake2/b2sum.c' || echo './'`src/blake2/b2sum.c
	mv -f src/blake2/.deps/cksum-b2sum.Tpo src/blake2/.deps/cksum-b2sum.Po
	/usr/bin/clang  -I. -I./lib  -DHASH_ALGO_CKSUM=1 -DHAVE_CONFIG_H -Ilib -I./lib -Isrc -I./src -I/opt/local/include  -Wno-format-extra-args -Wno-tautological-constant-out-of-range-compare -pipe -Os -arch x86_64 -MT src/cksum-sum.o -MD -MP -MF src/.deps/cksum-sum.Tpo -c -o src/cksum-sum.o `test -f 'src/sum.c' || echo './'`src/sum.c
	mv -f src/.deps/cksum-sum.Tpo src/.deps/cksum-sum.Po
	/usr/bin/clang  -I. -I./lib  -DHASH_ALGO_CKSUM=1 -DHAVE_CONFIG_H -Ilib -I./lib -Isrc -I./src -I/opt/local/include  -Wno-format-extra-args -Wno-tautological-constant-out-of-range-compare -pipe -Os -arch x86_64 -MT src/cksum-cksum.o -MD -MP -MF src/.deps/cksum-cksum.Tpo -c -o src/cksum-cksum.o `test -f 'src/cksum.c' || echo './'`src/cksum.c
	src/cksum.c:189:30: error: invalid cpu feature string for builtin
	  bool avx512_enabled = (0 < __builtin_cpu_supports ("vpclmulqdq")
	                             ^                       ~~~~~~~~~~~~
	1 error generated.
	make[2]: *** [src/cksum-cksum.o] Error 1

The build step was *not* a parallel one. cpuid tells me (excerpts):

	CPU vendor string: 'GenuineIntel'
	
	Signature:  0x000206a7
	  Family:   0x06 (6)
	  Model:    0x2a (42)
	  Stepping: 0x07 (7)
	
	  MMX instruction set (Intel, AMD)
	  FXSAVE/FXRSTOR instructions (Intel, AMD)
	  SSE instructions (Intel, AMD)
	  SSE2 instructions (Intel, AMD)
	
	Base features, ecx:
	  SSE3 instructions (Intel, AMD)
	...
	  SSSE3 instructions (Intel, AMD)
	...
	  SSE4.1 instructions (Intel, AMD)
	  SSE4.2 instructions (Intel, AMD)
	...
	  AVX instructions (Intel, AMD)
	
	Extended State Enumeration
	  Valid bit fields for lower 32 bits of XCR0:
	    0 - Legacy x87
	    1 - 128-bit SSE
	    2 - 256-bit AVX YMM_Hi128
	
	  Extended state for 256-bit AVX YMM_Hi128 requires 256 bytes, offset 576
	
	Processor Name: Intel(R) Core(TM) i7-2860QM CPU @ 2.50GHz

The latter corresponds with documentation: Intel Core i7 (2760QM, 2860QM) ("Sandy Bridge").

Configuring to use GCC 14.2 brings a warning:

	Warning: Configuration logfiles contain indications of -Wimplicit-function-declaration; check that features were not accidentally disabled:
	  alignof: found in coreutils-9.7.39-c8d75/config.log
	  __GNUC_PREREQ: found in coreutils-9.7.39-c8d75/config.log
	  MIN: found in coreutils-9.7.39-c8d75/config.log
	  __fpending: found in coreutils-9.7.39-c8d75/config.log
	  re_set_syntax: found in coreutils-9.7.39-c8d75/config.log
	  re_compile_pattern: found in coreutils-9.7.39-c8d75/config.log
	  re_search: found in coreutils-9.7.39-c8d75/config.log
	  re_match: found in coreutils-9.7.39-c8d75/config.log
	  free: found in coreutils-9.7.39-c8d75/config.log

The build step starts with

	aclocal.m4:17: warning: this file was generated for autoconf 2.72.84-63ffa.
	You have another version of autoconf.  It may work, but is not guaranteed to.
	If you have problems, you may need to regenerate the build system entirely.
	To do so, use the procedure documented by the package, typically 'autoreconf'.
	 cd . && /bin/sh ./config.status Makefile depfiles

Now the error is more explicit:

	mv -f src/.deps/cksum-cksum.Tpo src/.deps/cksum-cksum.Po
	/opt/local/bin/gcc-mp-14 -std=gnu23  -I. -I./lib  -DHASH_ALGO_CKSUM=1 -DHAVE_CONFIG_H -Ilib -I./lib -Isrc -I./src -I/opt/local/include   -pipe -Os -arch x86_64 -MT src/cksum-crctab.o -MD -MP -MF src/.deps/cksum-crctab.Tpo -c -o src/cksum-crctab.o `test -f 'src/crctab.c' || echo './'`src/crctab.c
	mv -f src/.deps/cksum-crctab.Tpo src/.deps/cksum-crctab.Po
	/opt/local/bin/gcc-mp-14 -std=gnu23  -I. -I./lib  -Ilib -I./lib -Isrc -I./src -I/opt/local/include -mavx512bw -mavx512f -mvpclmulqdq   -pipe -Os -arch x86_64 -MT src/libcksum_avx512_a-cksum_avx512.o -MD -MP -MF src/.deps/libcksum_avx512_a-cksum_avx512.Tpo -c -o src/libcksum_avx512_a-cksum_avx512.o `test -f 'src/cksum_avx512.c' || echo './'`src/cksum_avx512.c
	<stdin>:59:2: error: instruction requires: AVX-512 ISA
	        vmovdqa64       lC0(%rip), %zmm0
	        ^
	<stdin>:62:2: error: instruction requires: AVX-512 ISA
	        vmovdqa64       lC2(%rip), %zmm7
	        ^
	<stdin>:63:2: error: instruction requires: AVX-512 ISA
	        vmovdqa64       lC1(%rip), %zmm2
	        ^
	<stdin>:78:2: error: instruction requires: AVX-512 ISA
	        vmovdqa64       64(%rsp), %zmm3
	        ^
	<stdin>:82:2: error: instruction requires: AVX-512 ISA
	        vmovdqa64       128(%rsp), %zmm10
	        ^
	<stdin>:85:2: error: instruction requires: AVX-512 BW ISA
	        vpshufb %zmm0, %zmm3, %zmm3
	        ^
	<stdin>:86:2: error: instruction requires: AVX-512 ISA
	        vmovdqa64       192(%rsp), %zmm9
	        ^
	<stdin>:87:2: error: instruction requires: AVX-512 ISA
	        vpxord  %zmm3, %zmm1, %zmm1
	        ^
	<stdin>:88:2: error: instruction requires: AVX-512 BW ISA
	        vpshufb %zmm0, %zmm10, %zmm10
	        ^
	<stdin>:89:2: error: instruction requires: AVX-512 ISA
	        vmovdqa64       256(%rsp), %zmm8
	        ^
	<stdin>:90:2: error: instruction requires: AVX-512 BW ISA
	        vpshufb %zmm0, %zmm9, %zmm9
	        ^
	<stdin>:91:2: error: instruction requires: AVX-512 BW ISA
	        vpshufb %zmm0, %zmm8, %zmm8
	        ^
	<stdin>:93:2: error: instruction requires: AVX-512 ISA
	        vpclmulqdq      $0, %zmm2, %zmm1, %zmm5
	        ^
	<stdin>:95:2: error: instruction requires: AVX-512 ISA
	        vmovdqa64       256(%rdi), %zmm6
	        ^
	<stdin>:97:2: error: instruction requires: AVX-512 ISA
	        vpclmulqdq      $17, %zmm2, %zmm1, %zmm1
	        ^
	<stdin>:99:2: error: instruction requires: AVX-512 ISA
	        vpclmulqdq      $0, %zmm2, %zmm10, %zmm4
	        ^
	<stdin>:100:2: error: instruction requires: AVX-512 BW ISA
	        vpshufb %zmm0, %zmm6, %zmm6
	        ^
	<stdin>:101:2: error: instruction requires: AVX-512 ISA
	        vpclmulqdq      $17, %zmm2, %zmm10, %zmm10
	        ^
	<stdin>:102:2: error: instruction requires: AVX-512 ISA
	        vpclmulqdq      $0, %zmm2, %zmm9, %zmm3
	        ^
	<stdin>:103:2: error: instruction requires: AVX-512 ISA
	        vpclmulqdq      $17, %zmm2, %zmm9, %zmm9
	        ^
	<stdin>:104:2: error: instruction requires: AVX-512 ISA
	        vpclmulqdq      $0, %zmm2, %zmm8, %zmm11
	        ^
	<stdin>:105:2: error: instruction requires: AVX-512 ISA
	        vpternlogd      $150, %zmm1, %zmm5, %zmm6
	        ^
	<stdin>:106:2: error: instruction requires: AVX-512 ISA
	        vpclmulqdq      $17, %zmm2, %zmm8, %zmm8
	        ^
	<stdin>:107:2: error: instruction requires: AVX-512 ISA
	        vmovdqa64       64(%rdi), %zmm5
	        ^
	<stdin>:108:2: error: instruction requires: AVX-512 ISA
	        vmovdqa64       %zmm6, %zmm1
	        ^
	<stdin>:109:2: error: instruction requires: AVX-512 BW ISA
	        vpshufb %zmm0, %zmm5, %zmm5
	        ^
	<stdin>:110:2: error: instruction requires: AVX-512 ISA
	        vpternlogd      $150, %zmm10, %zmm4, %zmm5
	        ^
	<stdin>:111:2: error: instruction requires: AVX-512 ISA
	        vmovdqa64       128(%rdi), %zmm4
	        ^
	<stdin>:112:2: error: instruction requires: AVX-512 ISA
	        vmovdqa64       %zmm5, %zmm10
	        ^
	<stdin>:113:2: error: instruction requires: AVX-512 BW ISA
	        vpshufb %zmm0, %zmm4, %zmm4
	        ^
	<stdin>:114:2: error: instruction requires: AVX-512 ISA
	        vpternlogd      $150, %zmm9, %zmm3, %zmm4
	        ^
	<stdin>:115:2: error: instruction requires: AVX-512 ISA
	        vmovdqa64       192(%rdi), %zmm3
	        ^
	<stdin>:116:2: error: instruction requires: AVX-512 ISA
	        vmovdqa64       %zmm4, %zmm9
	        ^
	<stdin>:117:2: error: instruction requires: AVX-512 BW ISA
	        vpshufb %zmm0, %zmm3, %zmm3
	        ^
	<stdin>:118:2: error: instruction requires: AVX-512 ISA
	        vpternlogd      $150, %zmm11, %zmm8, %zmm3
	        ^
	<stdin>:119:2: error: instruction requires: AVX-512 ISA
	        vmovdqa64       %zmm3, %zmm8
	        ^
	<stdin>:122:2: error: instruction requires: AVX-512 BW ISA
	        vpshufb %zmm0, %zmm6, %zmm6
	        ^
	<stdin>:124:2: error: instruction requires: AVX-512 BW ISA
	        vpshufb %zmm0, %zmm5, %zmm5
	        ^
	<stdin>:126:2: error: instruction requires: AVX-512 BW ISA
	        vpshufb %zmm0, %zmm4, %zmm4
	        ^
	<stdin>:127:2: error: instruction requires: AVX-512 BW ISA
	        vpshufb %zmm0, %zmm3, %zmm3
	        ^
	<stdin>:132:2: error: instruction requires: AVX-512 ISA
	        vmovdqa64       %zmm6, (%rax)
	        ^
	<stdin>:133:2: error: instruction requires: AVX-512 ISA
	        vmovdqa64       %zmm5, 64(%rax)
	        ^
	<stdin>:134:2: error: instruction requires: AVX-512 ISA
	        vmovdqa64       %zmm4, 128(%rax)
	        ^
	<stdin>:135:2: error: instruction requires: AVX-512 ISA
	        vmovdqa64       %zmm3, 192(%rax)
	        ^
	<stdin>:137:2: error: instruction requires: AVX-512 ISA
	        vmovdqa64       (%rax), %zmm3
	        ^
	<stdin>:143:2: error: instruction requires: AVX-512 BW ISA
	        vpshufb %zmm0, %zmm3, %zmm3
	        ^
	<stdin>:144:2: error: instruction requires: AVX-512 ISA
	        vpxord  %zmm3, %zmm1, %zmm1
	        ^
	<stdin>:146:2: error: instruction requires: AVX-512 ISA
	        vpclmulqdq      $0, %zmm7, %zmm1, %zmm4
	        ^
	<stdin>:147:2: error: instruction requires: AVX-512 ISA
	        vmovdqa64       64(%rax,%rsi), %zmm3
	        ^
	<stdin>:150:2: error: instruction requires: AVX-512 ISA
	        vpclmulqdq      $17, %zmm7, %zmm1, %zmm1
	        ^
	<stdin>:153:2: error: instruction requires: AVX-512 BW ISA
	        vpshufb %zmm0, %zmm3, %zmm3
	        ^
	<stdin>:154:2: error: instruction requires: AVX-512 ISA
	        vpternlogd      $150, %zmm1, %zmm4, %zmm3
	        ^
	<stdin>:155:2: error: instruction requires: AVX-512 ISA
	        vmovdqa64       %zmm3, %zmm1
	        ^
	<stdin>:159:2: error: instruction requires: AVX-512 BW ISA
	        vpshufb %zmm0, %zmm3, %zmm3
	        ^
	<stdin>:166:2: error: instruction requires: AVX-512 ISA
	        vmovdqa64       %zmm3, (%rax)
	        ^
	make[2]: *** [src/libcksum_avx512_a-cksum_avx512.o] Error 1

I do not know how to handle the warnings at the end of configure step. The warning when build starts should be resolved by performing what it tells, which can easily be performed in GNU Emacs.

In MacPorts I am able to perform single steps: extract, patch, configure, then build, test, install. After the configure step, which inherently performs extract and patch, I invoked in GNU Emacs "/bin/sh ./config.status Makefile depfiles" in the dired buffer that displayed coreutils-9.7.39-c8d75. But the build warning about the aclocal.m4 mismatch was shown again when building started.

--
Greetings

  Pete

A blizzard is when it snows sideways.