xcodeapple-m1fftwlipo

Build FFTW for Apple M1 and the older intel devices


I built FFTW on my Apple m1 computer. When I run lipo -info libfftw3.a (which is located in .libs/libfftw3.a). It says it is of architecture ARM64.

In my Xcode I set the build target to 10.11, for backward compatibility.

Now when I add the FFTW library into my Xcode project, it complains:

The linked library 'libfftw3.a' is missing one or more architectures required by this target: x86_64.

How can I solve this? Do I need to build the library in an Intel device and create a universal library with these two libraries together (using lipo) or what's the right way to solve this?


Solution

  • You can configure it also with this line and it will build x86_64 & arm64 binary.

    ./configure CFLAGS="-arch arm64 -arch x86_64 -mmacosx-version-min=11.0"