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.
This commit is contained in:
Randy Eckenrode 2023-06-04 17:40:37 -04:00
parent 7cb8db1c02
commit cf77dee3ad
No known key found for this signature in database
GPG Key ID: 64C1CD4EC2A600D9
2 changed files with 7 additions and 9 deletions

View File

@ -1,7 +1,3 @@
MacOS SDKs before 10.13 don't support open_memstream. This is already replaced
by a runtime check in cctools-port, but because we build with SDK 10.12 by
default, linking still fails for us. Disable it entirely here.
--- a/cctools/include/stuff/diagnostics.h
+++ b/cctools/include/stuff/diagnostics.h
@@ -60,13 +60,6 @@ void diagnostics_log_msg(enum diagnostic_level level, const char* message);
@ -16,6 +12,6 @@ default, linking still fails for us. Disable it entirely here.
-#ifndef HAVE_OPENMEMSTREAM_RUNTIME
-# define HAVE_OPENMEMSTREAM_RUNTIME 1
-#endif
+#define HAVE_OPENMEMSTREAM_RUNTIME 0
+#define HAVE_OPENMEMSTREAM_RUNTIME 1
#endif /* diagnostics_h */

View File

@ -1,4 +1,4 @@
{ lib, stdenv, fetchFromGitHub, autoconf, automake, libtool, autoreconfHook
{ lib, stdenv, fetchFromGitHub, autoconf, automake, libtool, autoreconfHook, memstreamHook
, installShellFiles
, libuuid
, libobjc ? null, maloader ? null
@ -35,7 +35,8 @@ stdenv.mkDerivation {
outputs = [ "out" "dev" "man" ];
nativeBuildInputs = [ autoconf automake libtool autoreconfHook installShellFiles ];
nativeBuildInputs = [ autoconf automake libtool autoreconfHook installShellFiles ]
++ lib.optionals (stdenv.isDarwin && stdenv.isx86_64) [ memstreamHook ];
buildInputs = [ libuuid ]
++ lib.optionals stdenv.isDarwin [ libobjc ]
++ lib.optional enableTapiSupport libtapi;
@ -51,8 +52,9 @@ stdenv.mkDerivation {
url = "https://github.com/MercuryTechnologies/cctools-port/commit/025899b7b3593dedb0c681e689e57c0e7bbd9b80.patch";
hash = "sha256-SWVUzFaJHH2fu9y8RcU3Nx/QKx60hPE5zFx0odYDeQs=";
})
]
++ lib.optional stdenv.isDarwin ./darwin-no-memstream.patch;
# Always use `open_memstream`. This is provided by memstream via hook on x86_64-darwin.
./darwin-memstream.patch
];
__propagatedImpureHostDeps = [
# As far as I can tell, otool from cctools is the only thing that depends on these two, and we should fix them