Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MacOS: error: unknown target CPU 'armv8.2-a+sha3' #4509

Open
crazydef opened this issue Dec 30, 2024 · 2 comments
Open

MacOS: error: unknown target CPU 'armv8.2-a+sha3' #4509

crazydef opened this issue Dec 30, 2024 · 2 comments

Comments

@crazydef
Copy link

Trying to build a universal binary with the latest version of Botan on MacOS and I'm getting the following errors:

clang++  -fstack-protector -pthread -stdlib=libc++ -force_cpusubtype_ALL -arch x86_64 -arch arm64 -std=c++20 -D_REENTRANT  -g -Wall -Wextra -Wpedantic -Wshadow -Wstrict-aliasing -Wstrict-overflow=5 -Wcast-align -Wmissing-declarations -Wpointer-arith -Wcast-qual -Wshorten-64-to-32 -Wcomma -Wdocumentation -DBOTAN_IS_BEING_BUILT -march=armv8.2-a+sha3 -I build/include/public -I build/include/internal  -isystem build/include/external -c src/lib/hash/sha2_64/sha2_64_armv8/sha2_64_armv8.cpp -o build/obj/lib/hash_sha2_64_sha2_64_armv8.o
error: unknown target CPU 'armv8.2-a+sha3'
note: valid target CPU values are: nocona, core2, penryn, bonnell, atom, silvermont, slm, goldmont, goldmont-plus, tremont, nehalem, corei7, westmere, sandybridge, corei7-avx, ivybridge, core-avx-i, haswell, core-avx2, broadwell, skylake, skylake-avx512, skx, cascadelake, cooperlake, cannonlake, icelake-client, rocketlake, icelake-server, tigerlake, sapphirerapids, alderlake, raptorlake, meteorlake, sierraforest, grandridge, graniterapids, graniterapids-d, emeraldrapids, knl, knm, k8, athlon64, athlon-fx, opteron, k8-sse3, athlon64-sse3, opteron-sse3, amdfam10, barcelona, btver1, btver2, bdver1, bdver2, bdver3, bdver4, znver1, znver2, znver3, znver4, x86-64, x86-64-v2, x86-64-v3, x86-64-v4
make: *** [build/obj/lib/hash_sha2_64_sha2_64_armv8.o] Error 1
clang++  -fstack-protector -pthread -stdlib=libc++ -force_cpusubtype_ALL -arch x86_64 -arch arm64 -std=c++20 -D_REENTRANT  -g -Wall -Wextra -Wpedantic -Wshadow -Wstrict-aliasing -Wstrict-overflow=5 -Wcast-align -Wmissing-declarations -Wpointer-arith -Wcast-qual -Wshorten-64-to-32 -Wcomma -Wdocumentation -DBOTAN_IS_BEING_BUILT -march=armv8.2-a+sha3 -I build/include/public -I build/include/internal  -isystem build/include/external -c src/lib/hash/sha2_64/sha2_64_armv8/sha2_64_armv8.cpp -o build/obj/lib/hash_sha2_64_sha2_64_armv8.o
error: unknown target CPU 'armv8.2-a+sha3'
note: valid target CPU values are: nocona, core2, penryn, bonnell, atom, silvermont, slm, goldmont, goldmont-plus, tremont, nehalem, corei7, westmere, sandybridge, corei7-avx, ivybridge, core-avx-i, haswell, core-avx2, broadwell, skylake, skylake-avx512, skx, cascadelake, cooperlake, cannonlake, icelake-client, rocketlake, icelake-server, tigerlake, sapphirerapids, alderlake, raptorlake, meteorlake, sierraforest, grandridge, graniterapids, graniterapids-d, emeraldrapids, knl, knm, k8, athlon64, athlon-fx, opteron, k8-sse3, athlon64-sse3, opteron-sse3, amdfam10, barcelona, btver1, btver2, bdver1, bdver2, bdver3, bdver4, znver1, znver2, znver3, znver4, x86-64, x86-64-v2, x86-64-v3, x86-64-v4
make: *** [build/obj/lib/hash_sha2_64_sha2_64_armv8.o] Error 1

I'm building Botan from a Python script as follows:

commonoptions =  " --no-install-python-module"
commonoptions += " --disable-shared-library"
commonoptions += " --without-documentation"
commonoptions += " --build-targets=static"

debugoptions =  " --no-optimizations"
debugoptions += " --debug-mode"

macoptions =  " --link-method=copy"
macoptions += " --disable-armv8crypto"
macoptions += " --disable-neon"
macoptions += " --cc-abi-flags=\"-force_cpusubtype_ALL -arch x86_64 -arch arm64\""
macoptions += " --includedir=" + os.path.join( scriptdir, "..", "include", "macos" )

subprocess.run( "python3 configure.py --library-suffix=.macOS.Debug" + debugoptions + macoptions + commonoptions + " --prefix=" + os.path.join( outputdir, "Debug" ), shell = True )
subprocess.run( "make", shell = True )
subprocess.run( "make install", shell = True )
@randombit
Copy link
Owner

Can you try this patch

diff --git a/src/lib/hash/sha2_64/sha2_64_armv8/info.txt b/src/lib/hash/sha2_64/sha2_64_armv8/info.txt
index 86f851fe6..3a6b033d6 100644
--- a/src/lib/hash/sha2_64/sha2_64_armv8/info.txt
+++ b/src/lib/hash/sha2_64/sha2_64_armv8/info.txt
@@ -8,5 +8,6 @@ brief -> "SHA-512 using ARMv8 crypto instructions"
 </module_info>

 <isa>
+neon
 armv8sha512
 </isa>

@crazydef
Copy link
Author

That fixes the build.

(Insofar as it now builds the unoptimised versions of those files instead of the ARM specific ones.)

That's good enough for me for the time being, and I doubt I'll ever actually notice these in a profile.

Cheers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants