From a07d42d35bacf721616b45466ce1227c47cb1618 Mon Sep 17 00:00:00 2001 From: Tom Scogland Date: Mon, 21 Oct 2024 10:32:14 -0700 Subject: Devtools darwin (#46910) * stacks: add a stack for devtools on darwin After getting this whole mess building on darwin, let's keep it that way, and maybe make it so we have some non-ML darwin binaries in spack as well. * reuse: false for devtools * dtc: fix darwin dylib name and id On mac the convention is `lib..dylib`, while the makefile creates a num suffixed one by default. The id in the file is also a local name rather than rewritten to the full path, this fixes both problems. * node-js: make whereis more deterministic * relocation(darwin): catch Mach-O load failure The MachO library can throw an exception rather than return no headers, this happened in an elf file in the test data of go-bootstrap. Trying catching the exception and moving on for now. May also need to look into why we're trying to rewrite an elf file. * qemu: add darwin flags to clear out warnings There's a build failure for qemu in CI, but it's invisible because of the immense mass of warning output. Explicitly specify the target macos version and remove the extraneous unknown-warning-option flag. * dtc: libyaml is also a link dependency libyaml is required at runtime to run the dtc binary, lack of it caused the ci for qemu to fail when the library wasn't found. --- var/spack/repos/builtin/packages/dtc/package.py | 13 ++++++++++++- var/spack/repos/builtin/packages/node-js/package.py | 8 +++++++- var/spack/repos/builtin/packages/qemu/package.py | 10 +++++++++- 3 files changed, 28 insertions(+), 3 deletions(-) (limited to 'var') diff --git a/var/spack/repos/builtin/packages/dtc/package.py b/var/spack/repos/builtin/packages/dtc/package.py index 541041d532..8790d702fb 100644 --- a/var/spack/repos/builtin/packages/dtc/package.py +++ b/var/spack/repos/builtin/packages/dtc/package.py @@ -24,9 +24,9 @@ class Dtc(MakefilePackage): # Build error with flex 2.6.3 # (convert-dtsv0-lexer.lex.c:398: error: "yywrap" redefined) depends_on("flex@2.6.4:", type="build") - depends_on("libyaml", type="build") depends_on("pkgconfig", type="build") depends_on("python", type="build") + depends_on("libyaml", type=("build", "link")) def edit(self, spec, prefix): makefile = FileFilter("Makefile") @@ -35,3 +35,14 @@ class Dtc(MakefilePackage): makefile.filter( r"WARNINGS = -Wall", "WARNINGS = -Wall -Wno-unused-command-line-argument" ) + + if self.spec.satisfies("platform=darwin"): + libfdt_makefile = FileFilter("libfdt/Makefile.libfdt") + libfdt_makefile.filter( + r"LIBFDT_soname = .*", "LIBFDT_soname = libfdt.1.$(SHAREDLIB_EXT)" + ) + + @run_after("install") + def darwin_fix(self): + if self.spec.satisfies("platform=darwin"): + fix_darwin_install_name(self.prefix.lib) diff --git a/var/spack/repos/builtin/packages/node-js/package.py b/var/spack/repos/builtin/packages/node-js/package.py index b76d72ae91..e0111dd673 100644 --- a/var/spack/repos/builtin/packages/node-js/package.py +++ b/var/spack/repos/builtin/packages/node-js/package.py @@ -113,8 +113,14 @@ class NodeJs(Package): # # /usr/bin/libtool # libtool: /usr/bin/libtool + # + # We specify -M -f (an empty list of man-path entries) to prevent man-page + # searching to avoid an Illegal seek error processing manpath results in CI, + # which prevents the last form: # libtool: /usr/bin/libtool /Applications/Xcode.app/.../share/man/man1/libtool.1 - process_pipe = subprocess.Popen(["whereis", "libtool"], stdout=subprocess.PIPE) + process_pipe = subprocess.Popen( + ["whereis", "-M", "-f", "libtool"], stdout=subprocess.PIPE + ) result_whereis_list = process_pipe.communicate()[0].strip().split() if len(result_whereis_list) == 1: result_whereis = result_whereis_list[0] diff --git a/var/spack/repos/builtin/packages/qemu/package.py b/var/spack/repos/builtin/packages/qemu/package.py index c095b9a6a6..8ac1e92bf7 100644 --- a/var/spack/repos/builtin/packages/qemu/package.py +++ b/var/spack/repos/builtin/packages/qemu/package.py @@ -139,7 +139,7 @@ class Qemu(AutotoolsPackage): @when("@9:") def configure_args(self): - return [ + args = [ "--disable-bsd-user", "--disable-guest-agent", "--disable-sdl", @@ -155,3 +155,11 @@ class Qemu(AutotoolsPackage): "--enable-zstd", "--disable-docs", ] + extra_cflags = "-Wno-unknown-warning-option" + if self.spec.satisfies("%apple-clang platform=darwin"): + # qemu 9: uses pthread_jit_write_protect_np which requires OSX 11.0 or newer + extra_cflags += " -mmacosx-version-min=11.0" + args.append(f"--extra-cflags={extra_cflags}") + args.append(f"--extra-cxxflags={extra_cflags}") + + return args -- cgit v1.2.3-70-g09d2