From 7b9f87ff71892d243dd532051d763e907a47c52f Mon Sep 17 00:00:00 2001 From: Weijia Wang <9713184+wegank@users.noreply.github.com> Date: Fri, 10 Nov 2023 02:28:13 +0100 Subject: [PATCH] mcpp: fix build with clang 16 --- pkgs/development/compilers/mcpp/default.nix | 4 ++++ .../development/compilers/mcpp/readlink.patch | 24 +++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 pkgs/development/compilers/mcpp/readlink.patch diff --git a/pkgs/development/compilers/mcpp/default.nix b/pkgs/development/compilers/mcpp/default.nix index 0f556f85daa3..e8eb62a15f13 100644 --- a/pkgs/development/compilers/mcpp/default.nix +++ b/pkgs/development/compilers/mcpp/default.nix @@ -14,6 +14,10 @@ stdenv.mkDerivation (finalAttrs: { hash= "sha256-T4feegblOeG+NU+c+PAobf8HT8KDSfcINkRAa1hNpkY="; }; + patches = [ + ./readlink.patch + ]; + configureFlags = [ "--enable-mcpplib" ]; meta = with lib; { diff --git a/pkgs/development/compilers/mcpp/readlink.patch b/pkgs/development/compilers/mcpp/readlink.patch new file mode 100644 index 000000000000..0f5fc6d7e963 --- /dev/null +++ b/pkgs/development/compilers/mcpp/readlink.patch @@ -0,0 +1,24 @@ +From 1c4b0f26614bff331eb8a9f2b514309af6f31fd0 Mon Sep 17 00:00:00 2001 +From: Jose +Date: Mon, 26 Jun 2023 16:43:43 +0200 +Subject: [PATCH] Add 'unistd' header for readlink (#8) + +--- + src/system.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/src/system.c b/src/system.c +index a3501f9..646caf6 100644 +--- a/src/system.c ++++ b/src/system.c +@@ -37,6 +37,11 @@ + * 2. append the system-dependent routines in this file. + */ ++ ++#ifndef _MSC_VER ++# include // For readlink() ++#endif ++ + #if PREPROCESSED + #include "mcpp.H" + #else