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: Sat, 24 May 2025 13:00:51 +0200

> Am 24.05.2025 um 12:25 schrieb Pádraig Brady <[email-masked]>:
> 
> It seems like you may have a mismatch between compiler (flags)
> used at configure time and build time.  These must match
> so that code upsupported by your build is not enabled.

This could happen, it even happens often with some open software: It checks whether the compiler understands a few dozens exotic options (maybe C++ related) and the uses this set when building the software.

Config.log contains (just an excerpt):

	BUILD_CC='/opt/local/bin/gcc-mp-14'
	BUILD_CFLAGS='-pipe -Os -Wa,-v -arch x86_64'
	BUILD_CPPFLAGS='-I/opt/local/include'
	BUILD_LDFLAGS='-L/opt/local/lib -Wl,-headerpad_max_install_names -arch x86_64'
	CC='/opt/local/bin/gcc-mp-14'
	CFLAGS='-pipe -Os -Wa,-v -arch x86_64'
	CFLAG_VISIBILITY='-fvisibility=hidden'

and was using for the final test

	configure:95467: /opt/local/bin/gcc-mp-14 -o conftest -pipe -Os -Wa,-v -arch x86_64 -I/opt/local/include  -L/opt/local/lib -Wl,-headerpad_max_install_names -arch x86_64 conftest.c  -lintl >&5

An early test was:

	configure:7178: /opt/local/bin/gcc-mp-14 -pipe -Os -Wa,-v -arch x86_64 -I/opt/local/include -L/opt/local/lib -Wl,-headerpad_max_install_names -arch x86_64 conftest.c  >&5

Configured was invoked as:

	  ./configure --prefix=/opt/local --disable-silent-rules --program-prefix=g --with-openssl=no --disable-year2038 CC=/opt/local/bin/gcc-mp-14 'CFLAGS=-pipe -Os -Wa,-v -arch x86_64' 'LDFLAGS=-L/opt/local/lib -Wl,-headerpad_max_install_names -arch x86_64' CPPFLAGS=-I/opt/local/include --no-create --no-recursion

Last GCC invocation before stepping on the bug was:

	/opt/local/bin/gcc-mp-14  -I. -I./lib  -Ilib -I./lib -Isrc -I./src -I/opt/local/include   -pipe -Os -Wa,-v -arch x86_64 -MT src/date.o -MD -MP -MF $depbase.Tpo -c -o src/date.o src/date.c &&\

IMO BUILD_CFLAGS and CFLAGS are the same…

> I'm surprised USE_AVX512_CRC32 is defined at all for you during your build?

I have no idea…

"find . -type f -exec grep -in USE_AVX512_CRC32 {} /dev/null \;" produces this output:

./ChangeLog:496:	* configure.ac (USE_AVX512_CRC32): Set to false if the function
./Makefile.in:714:@USE_AVX512_CRC32_TRUE@am__append_218 = src/libcksum_avx512.a
./Makefile.in:715:@USE_AVX512_CRC32_TRUE@am__append_219 = $(cksum_avx512_ldadd)
./Makefile.in:2051:@USE_AVX512_CRC32_TRUE@am_src_libcksum_avx512_a_OBJECTS = src/libcksum_avx512_a-cksum_avx512.$(OBJEXT)
./Makefile.in:7909:@USE_AVX512_CRC32_TRUE@src_libcksum_avx512_a_SOURCES = src/cksum_avx512.c src/cksum.h
./Makefile.in:7910:@USE_AVX512_CRC32_TRUE@cksum_avx512_ldadd = src/libcksum_avx512.a
./Makefile.in:7911:@USE_AVX512_CRC32_TRUE@src_libcksum_avx512_a_CFLAGS = -mavx512bw -mavx512f -mvpclmulqdq $(AM_CFLAGS)
./autom4te.cache/output.0:698:USE_AVX512_CRC32_FALSE
./autom4te.cache/output.0:699:USE_AVX512_CRC32_TRUE
./autom4te.cache/output.0:93182:printf "%s\n" "@%:@define USE_AVX512_CRC32 1" >>confdefs.h
./autom4te.cache/output.0:93186:  USE_AVX512_CRC32_TRUE=
./autom4te.cache/output.0:93187:  USE_AVX512_CRC32_FALSE='#'
./autom4te.cache/output.0:93189:  USE_AVX512_CRC32_TRUE='#'
./autom4te.cache/output.0:93190:  USE_AVX512_CRC32_FALSE=
./autom4te.cache/output.0:95897:if test -z "${USE_AVX512_CRC32_TRUE}" && test -z "${USE_AVX512_CRC32_FALSE}"; then
./autom4te.cache/output.0:95898:  as_fn_error $? "conditional \"USE_AVX512_CRC32\" was never defined.
./autom4te.cache/output.1:698:USE_AVX512_CRC32_FALSE
./autom4te.cache/output.1:699:USE_AVX512_CRC32_TRUE
./autom4te.cache/output.1:93182:printf "%s\n" "@%:@define USE_AVX512_CRC32 1" >>confdefs.h
./autom4te.cache/output.1:93186:  USE_AVX512_CRC32_TRUE=
./autom4te.cache/output.1:93187:  USE_AVX512_CRC32_FALSE='#'
./autom4te.cache/output.1:93189:  USE_AVX512_CRC32_TRUE='#'
./autom4te.cache/output.1:93190:  USE_AVX512_CRC32_FALSE=
./autom4te.cache/output.1:95897:if test -z "${USE_AVX512_CRC32_TRUE}" && test -z "${USE_AVX512_CRC32_FALSE}"; then
./autom4te.cache/output.1:95898:  as_fn_error $? "conditional \"USE_AVX512_CRC32\" was never defined.
./autom4te.cache/output.2:698:USE_AVX512_CRC32_FALSE
./autom4te.cache/output.2:699:USE_AVX512_CRC32_TRUE
./autom4te.cache/output.2:93182:printf "%s\n" "@%:@define USE_AVX512_CRC32 1" >>confdefs.h
./autom4te.cache/output.2:93186:  USE_AVX512_CRC32_TRUE=
./autom4te.cache/output.2:93187:  USE_AVX512_CRC32_FALSE='#'
./autom4te.cache/output.2:93189:  USE_AVX512_CRC32_TRUE='#'
./autom4te.cache/output.2:93190:  USE_AVX512_CRC32_FALSE=
./autom4te.cache/output.2:95897:if test -z "${USE_AVX512_CRC32_TRUE}" && test -z "${USE_AVX512_CRC32_FALSE}"; then
./autom4te.cache/output.2:95898:  as_fn_error $? "conditional \"USE_AVX512_CRC32\" was never defined.
./autom4te.cache/traces.0:56231:m4trace:configure.ac:747: -1- m4_pattern_allow([^USE_AVX512_CRC32$])
./autom4te.cache/traces.0:56232:m4trace:configure.ac:750: -1- AM_CONDITIONAL([USE_AVX512_CRC32], [test $utils_cv_avx512_pclmul_intrinsic_exists = yes])
./autom4te.cache/traces.0:56233:m4trace:configure.ac:750: -1- m4_pattern_allow([^USE_AVX512_CRC32_TRUE$])
./autom4te.cache/traces.0:56234:m4trace:configure.ac:750: -1- m4_pattern_allow([^USE_AVX512_CRC32_FALSE$])
./autom4te.cache/traces.0:56235:m4trace:configure.ac:750: -1- _AM_SUBST_NOTMAKE([USE_AVX512_CRC32_TRUE])
./autom4te.cache/traces.0:56236:m4trace:configure.ac:750: -1- _AM_SUBST_NOTMAKE([USE_AVX512_CRC32_FALSE])
./autom4te.cache/traces.1:17466:m4trace:configure.ac:747: -1- AC_DEFINE_TRACE_LITERAL([USE_AVX512_CRC32])
./autom4te.cache/traces.1:17467:m4trace:configure.ac:747: -1- m4_pattern_allow([^USE_AVX512_CRC32$])
./autom4te.cache/traces.1:17468:m4trace:configure.ac:747: -1- AH_OUTPUT([USE_AVX512_CRC32], [/* CRC32 calculation by avx512 hardware instructions enabled */
./autom4te.cache/traces.1:17469:@%:@undef USE_AVX512_CRC32])
./autom4te.cache/traces.1:17470:m4trace:configure.ac:750: -1- AM_CONDITIONAL([USE_AVX512_CRC32], [test $utils_cv_avx512_pclmul_intrinsic_exists = yes])
./autom4te.cache/traces.1:17471:m4trace:configure.ac:750: -1- AC_SUBST([USE_AVX512_CRC32_TRUE])
./autom4te.cache/traces.1:17472:m4trace:configure.ac:750: -1- AC_SUBST_TRACE([USE_AVX512_CRC32_TRUE])
./autom4te.cache/traces.1:17473:m4trace:configure.ac:750: -1- m4_pattern_allow([^USE_AVX512_CRC32_TRUE$])
./autom4te.cache/traces.1:17474:m4trace:configure.ac:750: -1- AC_SUBST([USE_AVX512_CRC32_FALSE])
./autom4te.cache/traces.1:17475:m4trace:configure.ac:750: -1- AC_SUBST_TRACE([USE_AVX512_CRC32_FALSE])
./autom4te.cache/traces.1:17476:m4trace:configure.ac:750: -1- m4_pattern_allow([^USE_AVX512_CRC32_FALSE$])
./autom4te.cache/traces.1:17477:m4trace:configure.ac:750: -1- _AM_SUBST_NOTMAKE([USE_AVX512_CRC32_TRUE])
./autom4te.cache/traces.1:17478:m4trace:configure.ac:750: -1- _AM_SUBST_NOTMAKE([USE_AVX512_CRC32_FALSE])
./autom4te.cache/traces.2:17466:m4trace:configure.ac:747: -1- AC_DEFINE_TRACE_LITERAL([USE_AVX512_CRC32])
./autom4te.cache/traces.2:17467:m4trace:configure.ac:747: -1- m4_pattern_allow([^USE_AVX512_CRC32$])
./autom4te.cache/traces.2:17468:m4trace:configure.ac:747: -1- AH_OUTPUT([USE_AVX512_CRC32], [/* CRC32 calculation by avx512 hardware instructions enabled */
./autom4te.cache/traces.2:17469:@%:@undef USE_AVX512_CRC32])
./autom4te.cache/traces.2:17470:m4trace:configure.ac:750: -1- AM_CONDITIONAL([USE_AVX512_CRC32], [test $utils_cv_avx512_pclmul_intrinsic_exists = yes])
./autom4te.cache/traces.2:17471:m4trace:configure.ac:750: -1- AC_SUBST([USE_AVX512_CRC32_TRUE])
./autom4te.cache/traces.2:17472:m4trace:configure.ac:750: -1- AC_SUBST_TRACE([USE_AVX512_CRC32_TRUE])
./autom4te.cache/traces.2:17473:m4trace:configure.ac:750: -1- m4_pattern_allow([^USE_AVX512_CRC32_TRUE$])
./autom4te.cache/traces.2:17474:m4trace:configure.ac:750: -1- AC_SUBST([USE_AVX512_CRC32_FALSE])
./autom4te.cache/traces.2:17475:m4trace:configure.ac:750: -1- AC_SUBST_TRACE([USE_AVX512_CRC32_FALSE])
./autom4te.cache/traces.2:17476:m4trace:configure.ac:750: -1- m4_pattern_allow([^USE_AVX512_CRC32_FALSE$])
./autom4te.cache/traces.2:17477:m4trace:configure.ac:750: -1- _AM_SUBST_NOTMAKE([USE_AVX512_CRC32_TRUE])
./autom4te.cache/traces.2:17478:m4trace:configure.ac:750: -1- _AM_SUBST_NOTMAKE([USE_AVX512_CRC32_FALSE])
./config.log:154985:| #define USE_AVX512_CRC32 1
./config.log:158704:USE_AVX512_CRC32_FALSE='#'
./config.log:158705:USE_AVX512_CRC32_TRUE=''
./config.log:159742:#define USE_AVX512_CRC32 1
./config.status:713:S["USE_AVX512_CRC32_FALSE"]="#"
./config.status:714:S["USE_AVX512_CRC32_TRUE"]=""
./config.status:4329:D["USE_AVX512_CRC32"]=" 1"
./configure:698:USE_AVX512_CRC32_FALSE
./configure:699:USE_AVX512_CRC32_TRUE
./configure:93182:printf "%s\n" "#define USE_AVX512_CRC32 1" >>confdefs.h
./configure:93186:  USE_AVX512_CRC32_TRUE=
./configure:93187:  USE_AVX512_CRC32_FALSE='#'
./configure:93189:  USE_AVX512_CRC32_TRUE='#'
./configure:93190:  USE_AVX512_CRC32_FALSE=
./configure:95897:if test -z "${USE_AVX512_CRC32_TRUE}" && test -z "${USE_AVX512_CRC32_FALSE}"; then
./configure:95898:  as_fn_error $? "conditional \"USE_AVX512_CRC32\" was never defined.
./configure.ac:747:  AC_DEFINE([USE_AVX512_CRC32], [1],
./configure.ac:750:AM_CONDITIONAL([USE_AVX512_CRC32],
./configure~:682:USE_AVX512_CRC32_FALSE
./configure~:683:USE_AVX512_CRC32_TRUE
./configure~:93229:printf '%s\n' "#define USE_AVX512_CRC32 1" >>confdefs.h
./configure~:93233:  USE_AVX512_CRC32_TRUE=
./configure~:93234:  USE_AVX512_CRC32_FALSE='#'
./configure~:93236:  USE_AVX512_CRC32_TRUE='#'
./configure~:93237:  USE_AVX512_CRC32_FALSE=
./configure~:95932:if test -z "${USE_AVX512_CRC32_TRUE}" && test -z "${USE_AVX512_CRC32_FALSE}"; then
./configure~:95933:  as_fn_error $? "conditional \"USE_AVX512_CRC32\" was never defined.
./lib/config.h:3936:#define USE_AVX512_CRC32 1
./lib/config.hin:3935:#undef USE_AVX512_CRC32
./src/cksum.c:189:# if USE_AVX512_CRC32
./src/local.mk:443:if USE_AVX512_CRC32

You might be also surprised seeing ./configure and ./configure~ (I am) – somehow configure is run twice. First invocation is

	--->  Configuring coreutils-devel
	Executing:  cd "/opt/local/var/macports/build/_opt_mports_macports-ports_sysutils_coreutils-devel/coreutils-devel/work/coreutils-9.7" && ./configure --prefix=/opt/local --disable-silent-rules --program-prefix=g --with-openssl=no --disable-year2038 

which comes to an end and then starts again here:

	checking that generated files are newer than configure... done
	configure: creating ./config.status
	config.status: creating Makefile
	config.status: creating po/Makefile.in
	config.status: creating gnulib-tests/Makefile
	config.status: creating lib/config.h
	config.status: executing depfiles commands
	config.status: executing po-directories commands
	config.status: creating po/POTFILES
	config.status: creating po/Makefile
	Warning: Configuration logfiles contain indications of -Wimplicit-function-declaration; check that features were not accidentally disabled:
	  alignof: found in coreutils-9.7/config.log
	  __GNUC_PREREQ: found in coreutils-9.7/config.log
	  MIN: found in coreutils-9.7/config.log
	  __fpending: found in coreutils-9.7/config.log
	  re_set_syntax: found in coreutils-9.7/config.log
	  re_compile_pattern: found in coreutils-9.7/config.log
	  re_search: found in coreutils-9.7/config.log
	  re_match: found in coreutils-9.7/config.log
	  free: found in coreutils-9.7/config.log
	--->  Building coreutils-devel
	Executing:  cd "/opt/local/var/macports/build/_opt_mports_macports-ports_sysutils_coreutils-devel/coreutils-devel/work/coreutils-9.7" && /usr/bin/make -j8 -w all 
	make: Entering directory `/opt/local/var/macports/build/_opt_mports_macports-ports_sysutils_coreutils-devel/coreutils-devel/work/coreutils-9.7'
	CDPATH="${ZSH_VERSION+.}:" && cd . && /bin/sh '/opt/local/var/macports/build/_opt_mports_macports-ports_sysutils_coreutils-devel/coreutils-devel/work/coreutils-9.7/build-aux/missing' aclocal-1.17 -I m4
	CDPATH="${ZSH_VERSION+.}:" && cd . && /bin/sh '/opt/local/var/macports/build/_opt_mports_macports-ports_sysutils_coreutils-devel/coreutils-devel/work/coreutils-9.7/build-aux/missing' autoconf
	 cd . && /bin/sh /opt/local/var/macports/build/_opt_mports_macports-ports_sysutils_coreutils-devel/coreutils-devel/work/coreutils-9.7/build-aux/missing automake-1.17 --gnu
	/bin/sh ./config.status --recheck
	running CONFIG_SHELL=/bin/sh /bin/sh ./configure --prefix=/opt/local --disable-silent-rules --program-prefix=g --with-openssl=no --disable-year2038 CC=/opt/local/bin/gcc-mp-14 CFLAGS=-pipe -Os -Wa,-v -arch x86_64 LDFLAGS=-L/opt/local/lib -Wl,-headerpad_max_install_names -arch x86_64 CPPFLAGS=-I/opt/local/include --no-create --no-recursion

Since I am also chasing bugs in my old PowerBook G4 I see there, Mac OS X 10.4.11, Tiger, just one single run of configure, same on my (almost) up-to-date MacBook with macOS Sonoma 14.7.4. Here, on macOS High Sierra, Version 10.13.6, configuration happens twice.

To me it looks as if automake-1.17 decides that a rebuild is necessary… (because version mismatch 1.16.x vs. 1.17?)

--
Greetings

  Pete

Swimming in money is dry fun.