Overriding apple_sdk for x86_64-darwin.catboost


Recently catboost-1.2.3 failed to build for me on x86_64-darwin. Apparently it requires at least version 11.0 of the Apple SDK. I learned about darwin.apple_sdk_11_0 and attempted to override with something like

(final: prev: {
    catboost = final.darwin.apple_sdk_11_0.callPackage prev.catboost {
        llvmPackages = final.darwin.apple_sdk_11_0.llvmPackages_16;
        darwin = final.darwin.apple_sdk_11_0.darwin;

but obviously I do it wrong way as the build still utilizes the 10.2. Can anyone please guide me? Thank you!

Do you also need to override llvmPackages_12? What does the build failure look like?

No I don’t as llvmPackages_12 is used only for CUDA build which is not the case. The build fails due to an error unknown type name '__darwin_mbstate_t'.

I managed to fix that by patching derivation, now my overlay looks like

    (final: prev: rec {
      catboost = final.callPackage ../catboost {};

and derivation uses

  mkDerivation = (
    if stdenv.isDarwin
    then darwin.apple_sdk_11_0.llvmPackages_16.stdenv
    else llvmPackages.stdenv).mkDerivation;

(was honestly snatched from clickhouse package)

So I’m pretty much sure about the issue and the way to fix it. I just don’t understand how to do it with callPackage :slight_smile:

Does it work if you use the following?

    catboost = final.callPackage prev.catboost {
        llvmPackages = final.llvmPackages // { stdenv = final.overrideSDK final.llvmPackages.stdenv "11.0"; };

Nope, same error as before.