python3Packages.executorch: fix build with GCC 15 (#482299)

This commit is contained in:
Gaétan Lepage
2026-01-21 15:33:33 +00:00
committed by GitHub
2 changed files with 19 additions and 10 deletions
@@ -46,7 +46,7 @@
writableTmpDirAsHomeHook,
yaspin,
}:
buildPythonPackage rec {
buildPythonPackage (finalAttrs: {
pname = "executorch";
version = "1.0.1";
pyproject = true;
@@ -54,7 +54,7 @@ buildPythonPackage rec {
src = fetchFromGitHub {
owner = "pytorch";
repo = "executorch";
tag = "v${version}";
tag = "v${finalAttrs.version}";
# The ExecuTorch repo must be cloned into a directory named exactly `executorch`.
# See https://github.com/pytorch/executorch/issues/6475 for progress on a fix for this restriction.
@@ -63,7 +63,6 @@ buildPythonPackage rec {
fetchSubmodules = true;
hash = "sha256-h+nmipFDO/cdPTQXrjM5EkH//wHKBAvlDIp6SBbGN/8=";
};
# src = /home/gaetan/nix/nixpkgs-packages/executorch;
postPatch =
# Hardcode the default flatc binary path to the nixpkgs flatc
@@ -86,10 +85,19 @@ buildPythonPackage rec {
--replace-fail \
"CMAKE_MINIMUM_REQUIRED(VERSION 3.5 FATAL_ERROR)" \
"CMAKE_MINIMUM_REQUIRED(VERSION 3.10 FATAL_ERROR)"
''
# Fix build with GCC>=15
+ ''
substituteInPlace third-party/flatcc/include/flatcc/portable/grisu3_print.h \
--replace-fail \
'static char hexdigits[16] = "0123456789ABCDEF";' \
'static char hexdigits[17] = "0123456789ABCDEF";'
sed -i "1i #include <cstdint>" backends/apple/coreml/runtime/inmemoryfs/memory_buffer.hpp
'';
env = {
BUILD_VERSION = version;
BUILD_VERSION = finalAttrs.version;
};
build-system = [
@@ -117,6 +125,7 @@ buildPythonPackage rec {
"pytest-xdist"
];
pythonRelaxDeps = [
"scikit-learn"
"torchao"
];
dependencies = [
@@ -194,7 +203,7 @@ buildPythonPackage rec {
meta = {
description = "On-device AI across mobile, embedded and edge for PyTorch";
homepage = "https://github.com/pytorch/executorch";
changelog = "https://github.com/pytorch/executorch/releases/tag/v${version}";
changelog = "https://github.com/pytorch/executorch/releases/tag/${finalAttrs.src.tag}";
license = lib.licenses.bsd3;
maintainers = with lib.maintainers; [ GaetanLepage ];
badPlatforms = [
@@ -204,4 +213,4 @@ buildPythonPackage rec {
lib.systems.inspect.patterns.isDarwin
];
};
}
})
@@ -35,7 +35,7 @@
writableTmpDirAsHomeHook,
}:
buildPythonPackage rec {
buildPythonPackage (finalAttrs: {
pname = "torchtune";
version = "0.6.1";
pyproject = true;
@@ -43,7 +43,7 @@ buildPythonPackage rec {
src = fetchFromGitHub {
owner = "meta-pytorch";
repo = "torchtune";
tag = "v${version}";
tag = "v${finalAttrs.version}";
hash = "sha256-evhQBpZiUXriL0PAYkEzGypH21iRs37Ix6Nl5YAyeQ0=";
};
@@ -134,11 +134,11 @@ buildPythonPackage rec {
meta = {
description = "PyTorch native post-training library";
homepage = "https://github.com/meta-pytorch/torchtune";
changelog = "https://github.com/meta-pytorch/torchtune/releases/tag/${src.tag}";
changelog = "https://github.com/meta-pytorch/torchtune/releases/tag/${finalAttrs.src.tag}";
license = lib.licenses.bsd3;
maintainers = with lib.maintainers; [
GaetanLepage
sarahec
];
};
}
})