astc-encoder
astc-encoder copied to clipboard
Builds for wrong-architecture on M1 macs
A user reported a problem building the Vulkan Sample repository after an update to the most recent release of ASTC.
The linker errors shown indicate that the file is being built for an x86_64 architecture even though it's building on an arm64 arch.
I was able to reproduce this by executing the following
ec2-user@ip-172-31-45-6 astc % cmake -B build -DASTCENC_ISA_NATIVE=ON -DASTCENC_UNIVERSAL_BUILD=OFF
-- AVX2 backend - OFF
-- SSE4.1 backend - OFF
-- SSE2 backend - OFF
-- NEON backend - OFF
-- NONE backend - OFF
-- NATIVE backend - ON
-- Universal bin - OFF
-- Invariance - ON
-- Shared libs - OFF
-- Decompressor - OFF
-- Diagnostics - OFF
-- ASAN - OFF
-- Unit tests - OFF
-- Configuring done (0.1s)
-- Generating done (0.0s)
-- Build files have been written to: /Users/ec2-user/Vulkan-Samples/third_party/astc/build
ec2-user@ip-172-31-45-6 astc % cmake --build build --parallel
[ 3%] Building CXX object Source/CMakeFiles/astcenc-native-veneer.dir/astcenccli_entry.cpp.o
<snip>
[100%] Linking CXX executable astcenc-native
[100%] Built target astcenc-native
ec2-user@ip-172-31-45-6 astc % file ./build/Source/astcenc-native
./build/Source/astcenc-native: Mach-O 64-bit executable x86_64
ec2-user@ip-172-31-45-6 astc % uname -a
Darwin ip-172-31-45-6.ec2.internal 23.3.0 Darwin Kernel Version 23.3.0: Wed Dec 20 21:33:31 PST 2023; root:xnu-10002.81.5~7/RELEASE_ARM64_T8112 arm64
I've got a fix that works around it by forcing the OSX_ARCHITECTURES property of the target to arm64
in the case where we're building on Apple and running on M1 hardware or later.
Thanks - will take a look, but might not get around to it until later in the month.
I think that there should be elseif(NOT ${ASTCENC_ISA_SIMD} MATCHES "none" AND NOT ${ASTCENC_ISA_SIMD} MATCHES "native")
Fixed in 71a55e7697a72df9e004a8212288f1ef71572f9e