Unverified Commit d859f82c authored by Gaétan Lepage's avatar Gaétan Lepage Committed by GitHub
Browse files

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

parents d8f7d884 cae93b24
Loading
Loading
Loading
Loading
+15 −6
Original line number Diff line number Diff line
@@ -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
    ];
  };
}
})
+4 −4
Original line number Diff line number Diff line
@@ -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
    ];
  };
}
})