Using LAPACK in macOS 13.3

My app complied when “Minimum Deployments” was 12.x but with 13.3 I get the alert:

" 'dsyev_' was deprecated in macOS 13.3: The CLAPACK interface is deprecated. Please compile with -DACCELERATE_NEW_LAPACK to access the new lapack headers."

Where do I enter this compiler flag?

I am using XCode 14.3 Ventura 13.3.1 on an Intel macMini Build Phases:Link Binary With Libraries (3 items)

  • libf77lapack.tbd
  • libclapack.tbd
  • liblapack.tbd

each of which is provided by Apple.

I have rooted around in “Build Settings”, “ Build Phases”, and “Build Rules” but can’t see where to put the compiler flag.

Thanks

Accepted Reply

Found it...

“Build Phases”:”Compile Sources”:LAPACK functions.swift”. double-click and add: -DACCELERATE_NEW_LAPACK hit return. I had to re-launch XCode to get the alerts to stop.

  • The alerts/warnings have returned. Added -DACCELERATE_NEW_LAPACK to "Build Settings"/"Apple Clang - Custom Compiler Flags"/Debug & Release but alerts/warnings persist. Nevertheless, Build Succeeds and LAPACK generated data.

Add a Comment

Replies

Found it...

“Build Phases”:”Compile Sources”:LAPACK functions.swift”. double-click and add: -DACCELERATE_NEW_LAPACK hit return. I had to re-launch XCode to get the alerts to stop.

  • The alerts/warnings have returned. Added -DACCELERATE_NEW_LAPACK to "Build Settings"/"Apple Clang - Custom Compiler Flags"/Debug & Release but alerts/warnings persist. Nevertheless, Build Succeeds and LAPACK generated data.

Add a Comment

For Swift, I believe you should add ACCELERATE_NEW_LAPACK=1 and ACCELERATE_LAPACK_ILP64=1 in Build Settings > Preprocessor Macros. This made the warnings go away for me.

However, once you do that, then it seems you are required to target iOS 16.4 and later.

This worked fine in my XCode project, but I'm struggling adding these Preprocessor Macros in my package in XCode. Any help is appreciated.

See the attached screenshot above if it helps!

If you're writing a swift package, it's important to remember that the LAPACK preprocessor macros are a C++ setting and as such your Package.swift should be defined similarly as

.target(
            name: "MiniGrad",
            cxxSettings: [
                .define("ACCELERATE_NEW_LAPACK", to: "1")
            ],
            linkerSettings: [
                .linkedFramework("Accelerate")
            ]
        )