jedisct1 / libsodium

A modern, portable, easy to use crypto library.

Home Page:https://libsodium.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build tries to use AVX on i386 when no support for them available

barracuda156 opened this issue · comments

Build with GCC on i386 (Core Duo) fails, apparently because AVX instructions are not supported by Apple as:

libtool: compile:  /opt/local/bin/gcc-mp-13 -DPACKAGE_NAME=\"libsodium\" -DPACKAGE_TARNAME=\"libsodium\" -DPACKAGE_VERSION=\"1.0.19\" "-DPACKAGE_STRING=\"libsodium 1.0.19\"" -DPACKAGE_BUGREPORT=\"https://github.com/jedisct1/libsodium/issues\" -DPACKAGE_URL=\"https://libsodium.org\" -DPACKAGE=\"libsodium\" -DVERSION=\"1.0.19\" -DHAVE_STDIO_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_STRINGS_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_UNISTD_H=1 -DHAVE_WCHAR_H=1 -DSTDC_HEADERS=1 -D_ALL_SOURCE=1 -D_DARWIN_C_SOURCE=1 -D_GNU_SOURCE=1 -D_HPUX_ALT_XOPEN_SOCKET_API=1 -D_NETBSD_SOURCE=1 -D_OPENBSD_SOURCE=1 -D_POSIX_PTHREAD_SEMANTICS=1 -D__STDC_WANT_IEC_60559_ATTRIBS_EXT__=1 -D__STDC_WANT_IEC_60559_BFP_EXT__=1 -D__STDC_WANT_IEC_60559_DFP_EXT__=1 -D__STDC_WANT_IEC_60559_FUNCS_EXT__=1 -D__STDC_WANT_IEC_60559_TYPES_EXT__=1 -D__STDC_WANT_LIB_EXT2__=1 -D__STDC_WANT_MATH_SPEC_FUNCS__=1 -D_TANDEM_SOURCE=1 -D__EXTENSIONS__=1 -DHAVE_PTHREAD_PRIO_INHERIT=1 -DHAVE_PTHREAD=1 -DHAVE_C_VARARRAYS=1 -DHAVE_CATCHABLE_SEGV=1 -DHAVE_CATCHABLE_ABRT=1 -DTLS=_Thread_local -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DHAVE_MMINTRIN_H=1 -DHAVE_EMMINTRIN_H=1 -DHAVE_PMMINTRIN_H=1 -DHAVE_TMMINTRIN_H=1 -DHAVE_SMMINTRIN_H=1 -DHAVE_AVX512FINTRIN_H=1 -DHAVE_WMMINTRIN_H=1 -DHAVE_SYS_MMAN_H=1 -DHAVE_SYS_PARAM_H=1 -DHAVE_SYS_RANDOM_H=1 -DHAVE_CET_H=1 -DNATIVE_LITTLE_ENDIAN=1 -DHAVE_INLINE_ASM=1 -DHAVE_CPUID=1 -DASM_HIDE_SYMBOL=.private_extern -DHAVE_WEAK_SYMBOLS=1 -DHAVE_ATOMIC_OPS=1 -DHAVE_C11_MEMORY_FENCES=1 -DHAVE_GCC_MEMORY_FENCES=1 -DHAVE_ALLOCA_H=1 -DHAVE_ALLOCA=1 -DHAVE_ARC4RANDOM=1 -DHAVE_MMAP=1 -DHAVE_MLOCK=1 -DHAVE_MADVISE=1 -DHAVE_MPROTECT=1 -DHAVE_RAISE=1 -DHAVE_SYSCONF=1 -DHAVE_GETPID=1 -DHAVE_POSIX_MEMALIGN=1 -DHAVE_NANOSLEEP=1 -DCONFIGURED=1 -I. -I./include/sodium -I./include/sodium -msse2 -I/opt/local/include -pipe -Os -arch i386 -pthread -fvisibility=hidden -fPIC -fno-strict-aliasing -fno-strict-overflow -fstack-protector -Wno-deprecated-declarations -Wno-unknown-pragmas -ftls-model=local-dynamic -MT crypto_pwhash/scryptsalsa208sha256/sse/libsse2_la-pwhash_scryptsalsa208sha256_sse.lo -MD -MP -MF crypto_pwhash/scryptsalsa208sha256/sse/.deps/libsse2_la-pwhash_scryptsalsa208sha256_sse.Tpo -c crypto_pwhash/scryptsalsa208sha256/sse/pwhash_scryptsalsa208sha256_sse.c  -fno-common -DPIC -o crypto_pwhash/scryptsalsa208sha256/sse/.libs/libsse2_la-pwhash_scryptsalsa208sha256_sse.o
crypto_pwhash/scryptsalsa208sha256/sse/pwhash_scryptsalsa208sha256_sse.c: In function 'smix':
crypto_pwhash/scryptsalsa208sha256/sse/pwhash_scryptsalsa208sha256_sse.c:251:13: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
  251 |         Y = (__m128i *) ((uintptr_t)(V) + i * s);
      |             ^
crypto_pwhash/scryptsalsa208sha256/sse/pwhash_scryptsalsa208sha256_sse.c:256:13: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
  256 |         X = (__m128i *) ((uintptr_t)(V) + (i + 1) * s);
      |             ^
crypto_pwhash/scryptsalsa208sha256/sse/pwhash_scryptsalsa208sha256_sse.c:262:9: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
  262 |     Y = (__m128i *) ((uintptr_t)(V) + i * s);
      |         ^
crypto_pwhash/scryptsalsa208sha256/sse/pwhash_scryptsalsa208sha256_sse.c:278:24: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
  278 |         __m128i *V_j = (__m128i *) ((uintptr_t)(V) + j * s);
      |                        ^
crypto_pwhash/scryptsalsa208sha256/sse/pwhash_scryptsalsa208sha256_sse.c:283:15: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
  283 |         V_j = (__m128i *) ((uintptr_t)(V) + j * s);
      |               ^
{standard input}:46:no such instruction: `vmovdqa (%ecx), %xmm0'
{standard input}:48:no such instruction: `vpxor (%eax), %xmm0,%xmm0'
{standard input}:50:no such instruction: `vaesenc 16(%eax,%ecx), %xmm0,%xmm0'
{standard input}:54:no such instruction: `vaesenclast 224(%eax), %xmm0,%xmm0'
{standard input}:57:no such instruction: `vmovdqu %xmm0, (%edx)'
{standard input}:66:no such instruction: `vpxor (%eax), %xmm0,%xmm0'
{standard input}:73:no such instruction: `vaesenc 16(%eax,%ebx), %xmm0,%xmm0'
{standard input}:77:no such instruction: `vaesenclast 224(%eax), %xmm0,%xmm0'
{standard input}:80:no such instruction: `vpxor (%ecx), %xmm0,%xmm0'
{standard input}:81:no such instruction: `vmovdqu %xmm0, (%edx)'
{standard input}:103:no such instruction: `vmovdqa (%eax), %xmm1'
{standard input}:105:no such instruction: `vpxor (%ebx,%ecx), %xmm1,%xmm0'
{standard input}:107:no such instruction: `vmovdqa %xmm0, -16(%ecx,%esi)'
{standard input}:114:no such instruction: `vmovdqa 16(%eax,%ebx), %xmm1'
. . .
{standard input}:1871:no such instruction: `vmovdqa %xmm3, %xmm0'
{standard input}:1872:no such instruction: `vmovdqa %xmm3, -440(%ebp)'
{standard input}:1886:no such instruction: `vmovdqa 272(%eax,%edi), %xmm2'
{standard input}:1890:no such instruction: `vmovdqa %xmm2, %xmm0'
{standard input}:1891:no such instruction: `vmovdqa %xmm2, -440(%ebp)'
{standard input}:1902:no such instruction: `vmovdqa %xmm0, -296(%ebp)'
{standard input}:1905:no such instruction: `vmovdqa -216(%ebp,%esi), %xmm0'
{standard input}:1922:no such instruction: `vmovdqa %xmm5, %xmm0'
{standard input}:1928:no such instruction: `vmovdqa %xmm0, %xmm5'
{standard input}:1934:no such instruction: `vmovdqa 288(%eax), %xmm7'
{standard input}:1936:no such instruction: `vmovdqa %xmm7, %xmm0'
{standard input}:1937:no such instruction: `vmovdqa %xmm7, -440(%ebp)'
{standard input}:1959:no such instruction: `vmovdqa %xmm5, %xmm0'
{standard input}:1966:no such instruction: `vmovdqa %xmm0, %xmm5'
{standard input}:1968:no such instruction: `vmovdqa 256(%eax), %xmm3'
{standard input}:1970:no such instruction: `vmovdqa %xmm3, %xmm0'
{standard input}:1971:no such instruction: `vmovdqa %xmm3, -456(%ebp)'
{standard input}:1980:no such instruction: `vmovdqa 240(%eax), %xmm4'
{standard input}:1982:no such instruction: `vmovdqa %xmm4, %xmm0'
{standard input}:1983:no such instruction: `vmovdqa %xmm4, -456(%ebp)'
{standard input}:1993:no such instruction: `vmovdqa %xmm0, -296(%ebp)'
{standard input}:1995:no such instruction: `vmovdqa -216(%ebp), %xmm0'
{standard input}:1999:no such instruction: `vmovdqa -200(%ebp), %xmm0'
{standard input}:2023:no such instruction: `vmovdqa 240(%eax), %xmm7'
{standard input}:2025:no such instruction: `vmovdqa %xmm7, %xmm0'
{standard input}:2026:no such instruction: `vmovdqa %xmm7, -456(%ebp)'
{standard input}:2038:no such instruction: `vmovdqa %xmm0, -296(%ebp)'
{standard input}:2042:no such instruction: `vpshufb lC0-L10$pb(%eax), %xmm5,%xmm0'
{standard input}:2047:no such instruction: `vpaddq lC1-L10$pb(%eax), %xmm5,%xmm5'
{standard input}:2054:no such instruction: `vmovd %edx, %xmm1'
{standard input}:2057:no such instruction: `vmovd %eax, %xmm0'
{standard input}:2059:no such instruction: `vpunpcklqdq %xmm0, %xmm1,%xmm1'
{standard input}:2060:no such instruction: `vpshufb %xmm6, %xmm1,%xmm1'
{standard input}:2084:no such instruction: `vmovdqa %xmm1, -56(%ebp)'
{standard input}:2091:no such instruction: `vpshufb %xmm6, %xmm5,%xmm0'
{standard input}:2104:no such instruction: `vmovdqa %xmm1, -72(%ebp)'
{standard input}:2111:no such instruction: `vmovdqa -296(%ebp), %xmm2'
{standard input}:2114:no such instruction: `vpshufb %xmm6, %xmm2,%xmm0'
{standard input}:2115:no such instruction: `vpxor -88(%ebp), %xmm0,%xmm0'
{standard input}:2116:no such instruction: `vmovdqa %xmm0, -88(%ebp)'
{standard input}:2178:no such instruction: `vmovq 36(%ebp), %xmm0'
{standard input}:2183:no such instruction: `vmovdqa %xmm0, -40(%ebp)'
{standard input}:2256:no such instruction: `vmovq 20(%ebp), %xmm0'
{standard input}:2261:no such instruction: `vmovdqa %xmm0, -584(%ebp)'
{standard input}:2262:no such instruction: `vmovq 36(%ebp), %xmm0'
{standard input}:2265:no such instruction: `vmovdqa %xmm0, -600(%ebp)'
{standard input}:2327:no such instruction: `vmovq 24(%ebp), %xmm0'
{standard input}:2333:no such instruction: `vmovdqa %xmm0, -584(%ebp)'
{standard input}:2334:no such instruction: `vmovq 36(%ebp), %xmm0'
{standard input}:2337:no such instruction: `vmovdqa %xmm0, -600(%ebp)'
make[3]: *** [crypto_aead/aes256gcm/aesni/libaesni_la-aead_aes256gcm_aesni.lo] Error 1
make[3]: *** Waiting for unfinished jobs....
libtool: compile:  /opt/local/bin/gcc-mp-13 -DPACKAGE_NAME=\"libsodium\" -DPACKAGE_TARNAME=\"libsodium\" -DPACKAGE_VERSION=\"1.0.19\" "-DPACKAGE_STRING=\"libsodium 1.0.19\"" -DPACKAGE_BUGREPORT=\"https://github.com/jedisct1/libsodium/issues\" -DPACKAGE_URL=\"https://libsodium.org\" -DPACKAGE=\"libsodium\" -DVERSION=\"1.0.19\" -DHAVE_STDIO_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_STRINGS_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_UNISTD_H=1 -DHAVE_WCHAR_H=1 -DSTDC_HEADERS=1 -D_ALL_SOURCE=1 -D_DARWIN_C_SOURCE=1 -D_GNU_SOURCE=1 -D_HPUX_ALT_XOPEN_SOCKET_API=1 -D_NETBSD_SOURCE=1 -D_OPENBSD_SOURCE=1 -D_POSIX_PTHREAD_SEMANTICS=1 -D__STDC_WANT_IEC_60559_ATTRIBS_EXT__=1 -D__STDC_WANT_IEC_60559_BFP_EXT__=1 -D__STDC_WANT_IEC_60559_DFP_EXT__=1 -D__STDC_WANT_IEC_60559_FUNCS_EXT__=1 -D__STDC_WANT_IEC_60559_TYPES_EXT__=1 -D__STDC_WANT_LIB_EXT2__=1 -D__STDC_WANT_MATH_SPEC_FUNCS__=1 -D_TANDEM_SOURCE=1 -D__EXTENSIONS__=1 -DHAVE_PTHREAD_PRIO_INHERIT=1 -DHAVE_PTHREAD=1 -DHAVE_C_VARARRAYS=1 -DHAVE_CATCHABLE_SEGV=1 -DHAVE_CATCHABLE_ABRT=1 -DTLS=_Thread_local -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DHAVE_MMINTRIN_H=1 -DHAVE_EMMINTRIN_H=1 -DHAVE_PMMINTRIN_H=1 -DHAVE_TMMINTRIN_H=1 -DHAVE_SMMINTRIN_H=1 -DHAVE_AVX512FINTRIN_H=1 -DHAVE_WMMINTRIN_H=1 -DHAVE_SYS_MMAN_H=1 -DHAVE_SYS_PARAM_H=1 -DHAVE_SYS_RANDOM_H=1 -DHAVE_CET_H=1 -DNATIVE_LITTLE_ENDIAN=1 -DHAVE_INLINE_ASM=1 -DHAVE_CPUID=1 -DASM_HIDE_SYMBOL=.private_extern -DHAVE_WEAK_SYMBOLS=1 -DHAVE_ATOMIC_OPS=1 -DHAVE_C11_MEMORY_FENCES=1 -DHAVE_GCC_MEMORY_FENCES=1 -DHAVE_ALLOCA_H=1 -DHAVE_ALLOCA=1 -DHAVE_ARC4RANDOM=1 -DHAVE_MMAP=1 -DHAVE_MLOCK=1 -DHAVE_MADVISE=1 -DHAVE_MPROTECT=1 -DHAVE_RAISE=1 -DHAVE_SYSCONF=1 -DHAVE_GETPID=1 -DHAVE_POSIX_MEMALIGN=1 -DHAVE_NANOSLEEP=1 -DCONFIGURED=1 -I. -I./include/sodium -I./include/sodium -msse2 -I/opt/local/include -pipe -Os -arch i386 -pthread -fvisibility=hidden -fPIC -fno-strict-aliasing -fno-strict-overflow -fstack-protector -Wno-deprecated-declarations -Wno-unknown-pragmas -ftls-model=local-dynamic -MT crypto_pwhash/scryptsalsa208sha256/sse/libsse2_la-pwhash_scryptsalsa208sha256_sse.lo -MD -MP -MF crypto_pwhash/scryptsalsa208sha256/sse/.deps/libsse2_la-pwhash_scryptsalsa208sha256_sse.Tpo -c crypto_pwhash/scryptsalsa208sha256/sse/pwhash_scryptsalsa208sha256_sse.c -fPIE -o crypto_pwhash/scryptsalsa208sha256/sse/libsse2_la-pwhash_scryptsalsa208sha256_sse.o >/dev/null 2>&1
mv -f crypto_pwhash/scryptsalsa208sha256/sse/.deps/libsse2_la-pwhash_scryptsalsa208sha256_sse.Tpo crypto_pwhash/scryptsalsa208sha256/sse/.deps/libsse2_la-pwhash_scryptsalsa208sha256_sse.Plo
make[3]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_libsodium/libsodium/work/libsodium-1.0.19/src/libsodium'
make[2]: *** [all-recursive] Error 1

Configure assumes instructions are supported based on support for flags with compiler:

--->  Configuring libsodium
Executing:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_libsodium/libsodium/work/libsodium-1.0.19" && ./configure --prefix=/opt/local --disable-silent-rules 
checking build system type... i386-apple-darwin10.0.0d2
checking host system type... i386-apple-darwin10.0.0d2
checking target system type... i386-apple-darwin10.0.0d2
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a race-free mkdir -p... ./build-aux/install-sh -c -d
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether UID '0' is supported by ustar format... yes
checking whether GID '0' is supported by ustar format... yes
checking how to create a ustar tar archive... gnutar
checking whether make supports nested variables... (cached) yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking for gcc... /opt/local/bin/gcc-mp-13
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether the compiler supports GNU C... yes
checking whether /opt/local/bin/gcc-mp-13 accepts -g... yes
checking for /opt/local/bin/gcc-mp-13 option to enable C11 features... none needed
checking whether /opt/local/bin/gcc-mp-13 understands -c and -o together... yes
checking whether make supports the include directive... yes (GNU style)
checking dependency style of /opt/local/bin/gcc-mp-13... gcc3
checking dependency style of /opt/local/bin/gcc-mp-13... gcc3
checking for stdio.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for strings.h... yes
checking for sys/stat.h... yes
checking for sys/types.h... yes
checking for unistd.h... yes
checking for wchar.h... yes
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking whether _XOPEN_SOURCE should be defined... no
checking for a sed that does not truncate output... /opt/local/bin/gsed
checking how to run the C preprocessor... /opt/local/bin/gcc-mp-13 -E
checking for grep that handles long lines and -e... /opt/local/bin/ggrep
checking for egrep... /opt/local/bin/ggrep -E
checking whether /opt/local/bin/gcc-mp-13 is Clang... no
checking whether pthreads work with "-pthread" and "-lpthread"... yes
checking for joinable pthread attribute... PTHREAD_CREATE_JOINABLE
checking whether more special flags are required for pthreads... no
checking for PTHREAD_PRIO_INHERIT... yes
checking for variable-length arrays... yes
checking for __wasi__ defined... no
checking whether C compiler accepts -fvisibility=hidden... yes
checking whether C compiler accepts -fPIC... yes
checking whether C compiler accepts -fPIE... yes
checking whether the linker accepts -pie... yes
checking whether C compiler accepts -fno-strict-aliasing... yes
checking whether C compiler accepts -fno-strict-overflow... yes
checking whether C compiler accepts -fstack-protector... yes
checking whether the linker accepts -fstack-protector... yes
checking whether C compiler accepts -pipe -Os -arch i386 -pthread -fvisibility=hidden -fPIC -fPIE -fno-strict-aliasing -fno-strict-overflow -fstack-protector -Wall... yes
. . .
checking whether the linker accepts -Wl,-z,relro... no
checking whether the linker accepts -Wl,-z,now... no
checking whether the linker accepts -Wl,-z,noexecstack... no
checking whether segmentation violations can be caught... yes
checking whether SIGABRT can be caught... yes
checking for thread local storage (TLS) class... _Thread_local
thread local storage is supported
checking whether C compiler accepts -ftls-model=local-dynamic... yes
checking how to print strings... printf
checking for a sed that does not truncate output... (cached) /opt/local/bin/gsed
checking for fgrep... /opt/local/bin/ggrep -F
checking for ld used by /opt/local/bin/gcc-mp-13... /opt/local/bin/ld
checking if the linker (/opt/local/bin/ld) is GNU ld... no
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -p
checking the name lister (/usr/bin/nm -p) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 196608
checking how to convert i386-apple-darwin10.0.0d2 file names to i386-apple-darwin10.0.0d2 format... func_convert_file_noop
checking how to convert i386-apple-darwin10.0.0d2 file names to toolchain format... func_convert_file_noop
checking for /opt/local/bin/ld option to reload object files... -r
checking for file... file
checking for objdump... no
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @FILE support... no
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -p output from /opt/local/bin/gcc-mp-13 object... ok
checking for sysroot... no
checking for a working dd... /bin/dd
checking how to truncate binary pipes... /bin/dd bs=4096 count=1
checking for mt... no
checking if : is a manifest tool... no
checking for dsymutil... dsymutil
checking for nmedit... nmedit
checking for lipo... lipo
checking for otool... otool
checking for otool64... no
checking for -single_module linker flag... yes
checking for -exported_symbols_list linker flag... yes
checking for -force_load linker flag... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if /opt/local/bin/gcc-mp-13 supports -fno-rtti -fno-exceptions... no
checking for /opt/local/bin/gcc-mp-13 option to produce PIC... -fno-common -DPIC
checking if /opt/local/bin/gcc-mp-13 PIC flag -fno-common -DPIC works... yes
checking if /opt/local/bin/gcc-mp-13 static flag -static works... no
checking if /opt/local/bin/gcc-mp-13 supports -c -o file.o... yes
checking if /opt/local/bin/gcc-mp-13 supports -c -o file.o... (cached) yes
checking whether the /opt/local/bin/gcc-mp-13 linker (/opt/local/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin10.0.0d2 dyld
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking for ar... (cached) ar
checking for ARM64 target... no
checking whether C compiler accepts -mmmx... yes
checking for MMX instructions set... yes
checking whether C compiler accepts -mmmx... (cached) yes
checking whether C compiler accepts -msse2... yes
checking for SSE2 instructions set... yes
checking whether C compiler accepts -msse2... (cached) yes
checking whether C compiler accepts -msse3... yes
checking for SSE3 instructions set... yes
checking whether C compiler accepts -msse3... (cached) yes
checking whether C compiler accepts -mssse3... yes
checking for SSSE3 instructions set... yes
checking whether C compiler accepts -mssse3... (cached) yes
checking whether C compiler accepts -msse4.1... yes
checking for SSE4.1 instructions set... yes
checking whether C compiler accepts -msse4.1... (cached) yes
checking whether C compiler accepts -mavx... yes
checking for AVX instructions set... no
checking whether C compiler accepts -mavx2... yes
checking for AVX2 instructions set... no
checking whether C compiler accepts -mavx512f... yes
checking for AVX512F instructions set... yes
checking whether C compiler accepts -mavx512f... (cached) yes
checking whether C compiler accepts -maes... yes
checking whether C compiler accepts -mpclmul... yes
checking for AESNI instructions set and PCLMULQDQ... yes
checking whether C compiler accepts -maes... (cached) yes
checking whether C compiler accepts -mpclmul... (cached) yes
checking whether C compiler accepts -mrdrnd... yes
checking for RDRAND... no
checking for sys/mman.h... yes
checking for sys/param.h... yes
checking for sys/random.h... yes
checking for intrin.h... no
checking for sys/auxv.h... no
checking for CommonCrypto/CommonRandom.h... no
checking for cet.h... yes
checking if _xgetbv() is available... no
checking for inline... inline
checking whether byte ordering is bigendian... (cached) no
checking whether __STDC_LIMIT_MACROS is required... no
checking whether we can use inline asm code... yes
no
checking whether we can use x86_64 asm code... no
checking whether we can assemble AVX opcodes... no
checking for 128-bit arithmetic... no
checking for cpuid instruction... yes
checking if the .private_extern asm directive is supported... yes
checking if the .hidden asm directive is supported... no
checking if weak symbols are supported... yes
checking if atomic operations are supported... yes
checking if C11 memory fences are supported... yes
checking if gcc memory fences are supported... yes
checking for size_t... yes
checking for working alloca.h... yes
checking for alloca... yes
checking for arc4random... yes
checking for arc4random_buf... no
checking for mmap... yes
checking for mlock... yes
checking for madvise... yes
checking for mprotect... yes
checking for raise... yes
checking for sysconf... yes
checking for getrandom with a standard API... no
checking for getentropy with a standard API... no
checking for getpid... yes
checking for getauxval... no
checking for elf_aux_info... no
checking for posix_memalign... yes
checking for nanosleep... yes
checking for clock_gettime... no
checking for memset_s... no
checking for explicit_bzero... no
checking for memset_explicit... no
checking for explicit_memset... no
checking if gcc/ld supports -Wl,--output-def... no
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating builds/Makefile
config.status: creating contrib/Makefile
config.status: creating dist-build/Makefile
config.status: creating libsodium.pc
config.status: creating libsodium-uninstalled.pc
config.status: creating src/Makefile
config.status: creating src/libsodium/Makefile
config.status: creating src/libsodium/include/Makefile
config.status: creating src/libsodium/include/sodium/version.h
config.status: creating test/default/Makefile
config.status: creating test/Makefile
config.status: executing depfiles commands
config.status: executing libtool commands
Warning: Configuration logfiles contain indications of -Wimplicit-function-declaration; check that features were not accidentally disabled:
  getentropy: found in libsodium-1.0.19/config.log
  _rdrand64_step: found in libsodium-1.0.19/config.log

Apparently, some other mechanism is needed, so that vector instructions are only used when they are actually supported by CPU, compiler and assembler.

Your toolchain is broken. You're mixing tools that are 18 years apart, and that never were designed to work together to start with.

I just verified that libsodium still compiles fine on an i386 Mac using Xcode (11.4.1 appears to be the last version that runs).

If you want to use a recent gcc or clang version, I guess you must also use matching versions of related tools such as as, ld, nm, strip, etc.

@jedisct1 Toolchain is fine. The issue is that nothing checks whether instruction set is supported, but just assumes it is. It is certainly possible to implement a check, and it is just a right thing to do: it will improve the code.

P. S. Also CoreDuo itself does not support AVX, whatever tools one might install.

Your gcc frontend generates code for an assembler that doesn't understand it. Your toolchain is broken.

@jedisct1 How is gcc supposed to know what as supports? (Well, if it should check but does not, then it is a bug in gcc.)

I guess it doesn't, and assumes that you are using GNU as, and a version that roughly matches what's commonly available when a gcc version is released. Same thing for the linker, the strip tool, etc.

You can install the GNU binutils package, and then make sure that it's before Apple tools in your PATH. I don't know if they still support macOS/i386, though.

Really, using Xcode is the best way to have a consistent environment. I doubt a lot of people use gcc on macOS. And by the way, libsodium has better performance when using clang.

Well, Xcode 4.2 is the last supported on 10.6, and it is unusable with modern software.
The toolchain I have however is perfectly usable, on my PowerPC system I use exactly the same versions to build everything. If my toolchain was broken, I could not build gcc and CMake to begin with :)

I still think it is configure checks here which fail to work as supposed.
Compare against libopus for example:

--->  Configuring libopus
Executing:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_audio_libopus/libopus/work/opus-1.4" && ./configure --prefix=/opt/local --disable-silent-rules 
checking whether make supports nested variables... yes
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... ./install-sh -c -d
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether to enable maintainer-specific portions of Makefiles... yes
checking build system type... i386-apple-darwin10.0.0d2
checking host system type... i386-apple-darwin10.0.0d2
checking how to print strings... printf
checking whether make supports the include directive... yes (GNU style)
checking for gcc... /opt/local/bin/gcc-mp-13
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether /opt/local/bin/gcc-mp-13 accepts -g... yes
checking for /opt/local/bin/gcc-mp-13 option to accept ISO C89... none needed
checking whether /opt/local/bin/gcc-mp-13 understands -c and -o together... yes
checking dependency style of /opt/local/bin/gcc-mp-13... gcc3
checking for a sed that does not truncate output... /opt/local/bin/gsed
checking for grep that handles long lines and -e... /opt/local/bin/ggrep
checking for egrep... /opt/local/bin/ggrep -E
checking for fgrep... /opt/local/bin/ggrep -F
checking for ld used by /opt/local/bin/gcc-mp-13... /opt/local/bin/ld
checking if the linker (/opt/local/bin/ld) is GNU ld... no
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -p
checking the name lister (/usr/bin/nm -p) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 196608
checking how to convert i386-apple-darwin10.0.0d2 file names to i386-apple-darwin10.0.0d2 format... func_convert_file_noop
checking how to convert i386-apple-darwin10.0.0d2 file names to toolchain format... func_convert_file_noop
checking for /opt/local/bin/ld option to reload object files... -r
checking for objdump... no
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @FILE support... no
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -p output from /opt/local/bin/gcc-mp-13 object... ok
checking for sysroot... no
checking for a working dd... /bin/dd
checking how to truncate binary pipes... /bin/dd bs=4096 count=1
checking for mt... no
checking if : is a manifest tool... no
checking for dsymutil... dsymutil
checking for nmedit... nmedit
checking for lipo... lipo
checking for otool... otool
checking for otool64... no
checking for -single_module linker flag... yes
checking for -exported_symbols_list linker flag... yes
checking for -force_load linker flag... yes
checking how to run the C preprocessor... /opt/local/bin/gcc-mp-13 -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if /opt/local/bin/gcc-mp-13 supports -fno-rtti -fno-exceptions... no
checking for /opt/local/bin/gcc-mp-13 option to produce PIC... -fno-common -DPIC
checking if /opt/local/bin/gcc-mp-13 PIC flag -fno-common -DPIC works... yes
checking if /opt/local/bin/gcc-mp-13 static flag -static works... no
checking if /opt/local/bin/gcc-mp-13 supports -c -o file.o... yes
checking if /opt/local/bin/gcc-mp-13 supports -c -o file.o... (cached) yes
checking whether the /opt/local/bin/gcc-mp-13 linker (/opt/local/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin10.0.0d2 dyld
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking for /opt/local/bin/gcc-mp-13 option to accept ISO C99... none needed
checking for an ANSI C-conforming const... yes
checking for inline... inline
checking dependency style of /opt/local/bin/gcc-mp-13... gcc3
checking for C/C++ restrict keyword... __restrict
checking for C99 variable-size arrays... yes
checking if compiler supports SSE intrinsics... yes
checking if compiler supports SSE2 intrinsics... yes
checking if compiler supports SSE4.1 intrinsics... no
checking if compiler supports SSE4.1 intrinsics with -msse4.1... yes
checking if compiler supports AVX intrinsics... no
checking if compiler supports AVX intrinsics with -mavx... no
configure: WARNING: Compiler does not support AVX intrinsics
checking How to get X86 CPU Info... Inline Assembly
checking for doxygen... no
checking for dot... no
checking if /opt/local/bin/gcc-mp-13 supports -fvisibility=hidden... yes
checking if /opt/local/bin/gcc-mp-13 supports -fstack-protector-strong... yes
checking whether to add -D_FORTIFY_SOURCE=2 to CFLAGS... yes
checking if /opt/local/bin/gcc-mp-13 supports -Wall -Wextra -Wcast-align -Wnested-externs -Wshadow -Wstrict-prototypes... yes
checking for lrintf... yes
checking for lrint... yes
checking for __malloc_hook... no
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating opus.pc
config.status: creating opus-uninstalled.pc
config.status: creating celt/arm/armopts.s
config.status: creating doc/Makefile
config.status: creating doc/Doxyfile
config.status: creating config.h
config.status: executing depfiles commands
config.status: executing libtool commands
configure:
------------------------------------------------------------------------
  opus 1.4:  Automatic configuration OK.

    Compiler support:

      C99 var arrays: ................ yes
      C99 lrintf: .................... yes
      Use alloca: .................... no (using var arrays)

    General configuration:

      Floating point support: ........ yes
      Fast float approximations: ..... no
      Fixed point debugging: ......... no
      Inline Assembly Optimizations: . No inline ASM for your platform, please send patches
      External Assembly Optimizations: 
      Intrinsics Optimizations: ...... x86 SSE SSE2 SSE4.1
      Run-time CPU detection: ........ x86 SSE4.1
      Custom modes: .................. no
      Assertion checking: ............ no
      Hardening: ..................... yes
      Fuzzing: ....................... no
      Check ASM: ..................... no

      API documentation: ............. yes
      Extra programs: ................ yes
------------------------------------------------------------------------

 Type "make; make install" to compile and install
 Type "make check" to run the test suite

It does detect lack of support for AVX (with same gcc) and builds with no errors in result. And most of ports build fine. So far I have encountered 3 related failures with just two looking identical (here and aom).
It could be explained by a lack of testing on affected platforms, which is understandable. But now we have tested it and found that it does not work. Maybe still worth fixing?

Maybe still worth fixing?

No.

Maybe still worth fixing?

No.

Amazing attitude. Well, whatever.