VASTDynamics/Vaporizer2

CMake build: Apple arm64 build fails due to attempt to link libfftw3f_x64.a

Closed this issue · 5 comments

I'm trying to build Vaporizer2 on arm64 mac but I needed to tweak some parts in CMakeLists.txt. The most problematic part is that it always enables BUILD_AVX and when it is enabled it tries to link libfftw3f_x64.a (note that x64 part).

If I make local change to CMakeLists.txt the build passes that part.

(I also noticed that build_macos.sh script does not seem to consider Apple Silicon targets but that's another issue which I do not care so far.)

Regarding the second point / Silcomn targets this is maybe a naming problem:
macOS64SSE builds a unversl binary for silcon:

"macOS64SSE") #this is the universal binary supporting silicon M2 on Neon
cmake -B"cmake-build\x64SSE" -DCMAKE_BUILD_TYPE=Release -G Xcode -DCMAKE_PREFIX_PATH=../JUCE/install -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64"

Also for the first issue - use "maxOS64SSE" as target - this one disables AVX and links the libfftw3f_universal.a

The x64SSE target does not prevent the build script run into that if(BUILD_AVX) path in CMakeLists.txt:

  if(BUILD_AVX)
    #target_link_options(${PROJECT_NAME} PUBLIC -lfftw3f_x64)
    set_target_properties(fftw3f PROPERTIES IMPORTED_LOCATION ${CMAKE_SOURCE_DIR}/fftw-3.3.10/lib/libfftw3f_x64.a)

ld: warning: ignoring file /Users/atsushi/sources/JuceApps/Vaporizer2/fftw-3.3.10/lib/libfftw3f_x64.a, building for macOS-arm64 but attempting to link with file built for macOS-x86_64

I confirmed that no line in CMakeLists.txt disables BUILD_AVX.

No that's correct. But the build setting in build_macos.sh do:

"macOS64SSE") #this is the universal binary supporting silicon M2 on Neon
cmake -B"cmake-build\x64SSE" -DCMAKE_BUILD_TYPE=Release -G Xcode -DCMAKE_PREFIX_PATH=../JUCE/install -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" -DCMAKE_OSX_DEPLOYMENT_TARGET=10.13 -DBUILD_AVX=OFF -DBUILD_32=OFF -DAAX_SDK_LOCATION:STRING="../AAX_SDK/aax-sdk-2-6-0" -DVST2_SDK_LOCATION:STRING="../VST_SDK/VST2_SDK"
cmake --build "cmake-build\x64SSE" --config Release
;;

Alrght, maybe it is too much to expect that cmake -B build just works. I'll go without patching. Thanks.