cctools-port: fix build with clang 16 on x86_64-darwin

Clang 16 fails to build even with `open_memstream` disabled. Just use
the memstream package to provide an implementation.

+7 -9
+1 -5
pkgs/os-specific/darwin/cctools/darwin-no-memstream.patch pkgs/os-specific/darwin/cctools/darwin-memstream.patch
··· 1 - MacOS SDKs before 10.13 don't support open_memstream. This is already replaced 2 - by a runtime check in cctools-port, but because we build with SDK 10.12 by 3 - default, linking still fails for us. Disable it entirely here. 4 - 5 --- a/cctools/include/stuff/diagnostics.h 6 +++ b/cctools/include/stuff/diagnostics.h 7 @@ -60,13 +60,6 @@ void diagnostics_log_msg(enum diagnostic_level level, const char* message); ··· 16 -#ifndef HAVE_OPENMEMSTREAM_RUNTIME 17 -# define HAVE_OPENMEMSTREAM_RUNTIME 1 18 -#endif 19 - +#define HAVE_OPENMEMSTREAM_RUNTIME 0 20 21 #endif /* diagnostics_h */
··· 1 --- a/cctools/include/stuff/diagnostics.h 2 +++ b/cctools/include/stuff/diagnostics.h 3 @@ -60,13 +60,6 @@ void diagnostics_log_msg(enum diagnostic_level level, const char* message); ··· 12 -#ifndef HAVE_OPENMEMSTREAM_RUNTIME 13 -# define HAVE_OPENMEMSTREAM_RUNTIME 1 14 -#endif 15 + +#define HAVE_OPENMEMSTREAM_RUNTIME 1 16 17 #endif /* diagnostics_h */
+6 -4
pkgs/os-specific/darwin/cctools/port.nix
··· 1 - { lib, stdenv, fetchFromGitHub, autoconf, automake, libtool, autoreconfHook 2 , installShellFiles 3 , libuuid 4 , libobjc ? null, maloader ? null ··· 35 36 outputs = [ "out" "dev" "man" ]; 37 38 - nativeBuildInputs = [ autoconf automake libtool autoreconfHook installShellFiles ]; 39 buildInputs = [ libuuid ] 40 ++ lib.optionals stdenv.isDarwin [ libobjc ] 41 ++ lib.optional enableTapiSupport libtapi; ··· 51 url = "https://github.com/MercuryTechnologies/cctools-port/commit/025899b7b3593dedb0c681e689e57c0e7bbd9b80.patch"; 52 hash = "sha256-SWVUzFaJHH2fu9y8RcU3Nx/QKx60hPE5zFx0odYDeQs="; 53 }) 54 - ] 55 - ++ lib.optional stdenv.isDarwin ./darwin-no-memstream.patch; 56 57 __propagatedImpureHostDeps = [ 58 # As far as I can tell, otool from cctools is the only thing that depends on these two, and we should fix them
··· 1 + { lib, stdenv, fetchFromGitHub, autoconf, automake, libtool, autoreconfHook, memstreamHook 2 , installShellFiles 3 , libuuid 4 , libobjc ? null, maloader ? null ··· 35 36 outputs = [ "out" "dev" "man" ]; 37 38 + nativeBuildInputs = [ autoconf automake libtool autoreconfHook installShellFiles ] 39 + ++ lib.optionals (stdenv.isDarwin && stdenv.isx86_64) [ memstreamHook ]; 40 buildInputs = [ libuuid ] 41 ++ lib.optionals stdenv.isDarwin [ libobjc ] 42 ++ lib.optional enableTapiSupport libtapi; ··· 52 url = "https://github.com/MercuryTechnologies/cctools-port/commit/025899b7b3593dedb0c681e689e57c0e7bbd9b80.patch"; 53 hash = "sha256-SWVUzFaJHH2fu9y8RcU3Nx/QKx60hPE5zFx0odYDeQs="; 54 }) 55 + # Always use `open_memstream`. This is provided by memstream via hook on x86_64-darwin. 56 + ./darwin-memstream.patch 57 + ]; 58 59 __propagatedImpureHostDeps = [ 60 # As far as I can tell, otool from cctools is the only thing that depends on these two, and we should fix them