Skip to content

Support platforms without upstream ccache/sccache releases#439

Merged
hendrikmuhs merged 1 commit into
hendrikmuhs:mainfrom
luhenry:main
Apr 21, 2026
Merged

Support platforms without upstream ccache/sccache releases#439
hendrikmuhs merged 1 commit into
hendrikmuhs:mainfrom
luhenry:main

Conversation

@luhenry
Copy link
Copy Markdown
Contributor

@luhenry luhenry commented Apr 8, 2026

Hello! This is an issue that we ran into in ggml-org/llama.cpp. This should allow to support more platforms for which there are ccache/sccache binaries available in their respective distributions, but not yet in https://github.com/ccache/ccache releases

@luhenry
Copy link
Copy Markdown
Contributor Author

luhenry commented Apr 8, 2026

@luhenry
Copy link
Copy Markdown
Contributor Author

luhenry commented Apr 14, 2026

It's been merged in ggml-org/ccache-action: ggml-org#1. It's generally helpful for any platform (not just riscv64) for which ccache doesn't ship a binary on GitHub.

@luhenry
Copy link
Copy Markdown
Contributor Author

luhenry commented Apr 14, 2026

@hendrikmuhs would it please be possible to have a review? Happy to modify in any way! Thank you 🙏

Comment thread src/restore.ts Outdated
Comment on lines +386 to +393
if (method === INSTALL_METHOD.DETECT && await io.which(variant)) {
// If the install method is "detect" and the package is already installed,
// don't try to install it. This is to bypass architectures that are not
// released in upstream projects (linux-riscv64 for ccache/ccache for example).
} else {
const pkg = selectPackage(variant)
await pkg.install(method);
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is already handled automatically by the install function:

  async install(method: INSTALL_METHOD): Promise<void> {
    switch (method) {
      // ...
      case INSTALL_METHOD.DETECT:
        if (!await io.which(this.variant)) await this.installAuto()
        break
      // ...
    }
  }

Copy link
Copy Markdown
Contributor

@crueter crueter Apr 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I just realized this can cause issues if the specified combination doesn't exist... but that will throw anyways in selectPackage:

export function selectPackage(variant: VARIANT): Package {
  // ...
  if (!entry) {
    throw new Error(
      `No metadata found for combination: variant=${variant}, arch=${archKey}, platform=${platform}`
    );
  }
}

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 The flow is somehow strange now, as we bypass the usual logic of 1. getting the package and 2. call install on the returned package.

@crueter would it make sense to relax package to never throw and instead return an UnknownPackage, which could be a constant(or a package with Unknown's). Instead of selectPackage we could let install handle the case when INSTALL_METHOD != DETECT and package == UnknownPackage.

(FWIW: It makes total sense to me to not restrict the action in case of unknown platform/package and let users install by themselves.)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that would work

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll update to that logic.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated it, let me know what you think, and if it's in line with what you had in mind.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good, @crueter, you wrote the original implementation, wdyt?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As stated in my other review: not "ideal" but plenty fine for now. I'll work on implementing something a bit better somewhat soon. LGTM

Comment thread metadata/metadata.json
Comment thread metadata/metadata.json
@luhenry luhenry force-pushed the main branch 2 times, most recently from 55248ef to 944c4c8 Compare April 15, 2026 09:09
@luhenry luhenry changed the title Add riscv64 support Support platforms without upstream ccache/sccache releases Apr 15, 2026
Introduce UnknownPackage to handle platform/arch combinations (e.g.
linux-riscv64) that lack upstream binary releases. When install-method
is "detect", fall back to locally installed ccache/sccache instead of
failing.

Move the detect-and-skip logic from runInner into
UnknownPackage.install so all install paths go through the same
Package interface.
@luhenry
Copy link
Copy Markdown
Contributor Author

luhenry commented Apr 15, 2026

Testing it out at https://github.com/luhenry/llama.cpp/actions/runs/24450526137/job/71438158660.

Example output:

Install ccache
  Warning: No metadata found for combination: variant=ccache, arch=riscv64, platform=linux
  ccache installed at /usr/bin/ccache

Comment thread src/restore.ts
Comment on lines +209 to +226
export class UnknownPackage {
constructor(
public readonly variant: VARIANT,
public readonly arch: ARCH,
public readonly platform: PLATFORM) { }

async install(method: INSTALL_METHOD): Promise<void> {
if (method === INSTALL_METHOD.DETECT && await io.which(this.variant)) {
// If the install method is "detect" and the package is already installed,
// don't try to install it. This is to bypass architectures that are not
// released in upstream projects (linux-riscv64 for ccache/ccache for example).
} else {
throw new Error(
`No metadata found for combination: variant=${this.variant}, arch=${this.arch}, platform=${this.platform}`
);
}
}
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly, this isn't my favorite way to implement this, but it works. I'll devise something a bit "cleaner" at some point, but LGTM for now

@luhenry
Copy link
Copy Markdown
Contributor Author

luhenry commented Apr 20, 2026

Is there anything else you'd like me to change for it to go forward? Thank you!

@crueter
Copy link
Copy Markdown
Contributor

crueter commented Apr 20, 2026

All good on my end, Hendrik is probably just busy so wait for now. Thanks for the change!

@hendrikmuhs
Copy link
Copy Markdown
Owner

Sorry, was about to merge, but got distracted with something else.

Thanks for the contribution!

@hendrikmuhs hendrikmuhs merged commit d62db5f into hendrikmuhs:main Apr 21, 2026
74 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants