Opened 26 hours ago

Closed 25 hours ago

#70787 closed defect (fixed)

libsodium @ 1.0.19 fails to build on Sequoia for aarch64- fix included

Reported by: mthused Owned by: jmroot (Joshua Root)
Priority: Normal Milestone:
Component: ports Version: 2.10.1
Keywords: Cc:
Port: libsodium

Description

Problem is in the source used by this port, but is actually fixed in the upstream version (same tagged rev of 1.0.19). Recommend updating port source from upstream if possible, otherwise apply the diff below.

Issue is caused by including 'arm_neon.h' after a '#pragma clang attribute push(...' statement in aead_aes256gcm_armcrypto.c. Fix is to move the include above the pragma as in this diff:

*** src/libsodium/crypto_aead/aes256gcm/armcrypto/aead_aes256gcm_armcrypto.c    2023-09-13 06:46:16
--- /tmp/aead_aes256gcm_armcrypto_fix.c 2024-09-18 11:38:37
***************
*** 19,24 ****
--- 19,26 ----
  #define __vectorcall
  #endif
  
+ #include <arm_neon.h>
+ 
  #ifdef __clang__
  #pragma clang attribute push(__attribute__((target("neon,crypto,aes"))), apply_to = function)
  #elif defined(__GNUC__)
***************
*** 32,38 ****
  #define __ARM_FEATURE_AES 1
  #endif
  
- #include <arm_neon.h>
  
  #define ABYTES    crypto_aead_aes256gcm_ABYTES
  #define NPUBBYTES crypto_aead_aes256gcm_NPUBBYTES
--- 34,39 ----


Error detail from build log:

:info:build libtool: compile:  /usr/bin/clang -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_ARMCRYPTO=1 -DHAVE_SYS_MMAN_H=1 -DHAVE_SYS_PARAM_H=1 -DHAVE_SYS_RANDOM_H=1 -DHAVE_COMMONCRYPTO_COMMONRANDOM_H=1 -DHAVE_CET_H=1 -DNATIVE_LITTLE_ENDIAN=1 -DHAVE_INLINE_ASM=1 -DHAVE_TI_MODE=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_ARC4RANDOM_BUF=1 -DHAVE_MMAP=1 -DHAVE_MLOCK=1 -DHAVE_MADVISE=1 -DHAVE_MPROTECT=1 -DHAVE_RAISE=1 -DHAVE_SYSCONF=1 -DHAVE_GETENTROPY=1 -DHAVE_GETPID=1 -DHAVE_POSIX_MEMALIGN=1 -DHAVE_NANOSLEEP=1 -DHAVE_CLOCK_GETTIME=1 -DHAVE_MEMSET_S=1 -DCONFIGURED=1 -I. -I./include/sodium -I./include/sodium -I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk -arch arm64 -pthread -fvisibility=hidden -fPIC -fno-strict-aliasing -fno-strict-overflow -fstack-protector -Wno-deprecated-declarations -Wno-unknown-pragmas -ftls-model=local-dynamic -MT crypto_onetimeauth/poly1305/sse2/libsse2_la-poly1305_sse2.lo -MD -MP -MF crypto_onetimeauth/poly1305/sse2/.deps/libsse2_la-poly1305_sse2.Tpo -c crypto_onetimeauth/poly1305/sse2/poly1305_sse2.c -fPIE -o crypto_onetimeauth/poly1305/sse2/libsse2_la-poly1305_sse2.o >/dev/null 2>&1
:info:build In file included from crypto_aead/aes256gcm/armcrypto/aead_aes256gcm_armcrypto.c:35:
:info:build /Library/Developer/CommandLineTools/usr/lib/clang/16/include/arm_neon.h:62828:32: error: always_inline function 'vget_high_p64' requires target feature 'crypto', but would be inlined into function 'vmull_high_p64' that is compiled without support for 'crypto'
:info:build  62828 |   __ret = vmull_p64((poly64_t)(vget_high_p64(__p0)), (poly64_t)(vget_high_p64(__p1)));
:info:build        |                                ^
:info:build /Library/Developer/CommandLineTools/usr/lib/clang/16/include/arm_neon.h:62828:65: error: always_inline function 'vget_high_p64' requires target feature 'crypto', but would be inlined into function 'vmull_high_p64' that is compiled without support for 'crypto'
:info:build  62828 |   __ret = vmull_p64((poly64_t)(vget_high_p64(__p0)), (poly64_t)(vget_high_p64(__p1)));
:info:build        |                                                                 ^

Change History (2)

comment:1 Changed 26 hours ago by mthused

Summary: libsodium @ 1.0.19 fails to build on Sequoia for aarch64libsodium @ 1.0.19 fails to build on Sequoia for aarch64- fix included

comment:2 Changed 25 hours ago by jmroot (Joshua Root)

Owner: set to jmroot
Resolution: fixed
Status: newclosed

In d837855692b64d94a5c22a74ca0b164298555a7d/macports-ports (master):

libsodium: update to 1.0.20

Closes: #70787

Note: See TracTickets for help on using tickets.