Skip to content

ghc962: could not execute: otool #267250

@avdv

Description

@avdv

Describe the bug

I am trying to use GHC 9.6.2 from nixpkgs with Bazel but receive this error:

ERROR: /Users/claudio/rules_haskell/tools/runfiles/BUILD.bazel:24:16: HaskellLinkDynamicLibrary tools/runfiles/libHStoolsZSrunfilesZSrunfiles-ghc9.6.2.dylib failed: (Exit 1): process-wrapper failed: error executing command 
  (cd /private/var/tmp/_bazel_claudio/afceb7d1cdeddc94d64e34c0a088ac89/sandbox/processwrapper-sandbox/455/execroot/rules_haskell && \
  exec env - \
    CC_WRAPPER_CC_PATH=external/nixpkgs_config_cc/cc_wrapper.sh \
    CC_WRAPPER_CPU=darwin_arm64 \
    CC_WRAPPER_PLATFORM=darwin \
    LANG=C.UTF-8 \
    MUST_EXTRACT_ABI=false \
    PATH=/nix/store/ccjpkiqx40y6y98rpa2l8z4xg9mdlmq7-posix-toolchain/bin \
    RULES_HASKELL_DOCDIR_PATH=/nix/store/ywfzw2q59fna075p6ww98zlls4pgw17c-ghc-9.6.2/lib/ghc-9.6.2/lib/../../../../ya2qgcdazcvdb478zlzz97xpwp79jfjv-ghc-9.6.2-doc/share/doc/ghc/html/libraries/base-4.18.0.0 \
    RULES_HASKELL_GHC_PATH=external/rules_haskell_ghc_nixpkgs/bin/ghc \
    RULES_HASKELL_GHC_PKG_PATH=external/rules_haskell_ghc_nixpkgs/bin/ghc-pkg \
    RULES_HASKELL_LIBDIR_PATH=/nix/store/ywfzw2q59fna075p6ww98zlls4pgw17c-ghc-9.6.2/lib/ghc-9.6.2/lib \
    TMPDIR=/tmp \
  /var/tmp/_bazel_claudio/install/aa60e81d6fcd23c7034d0325a85596ce/process-wrapper '--timeout=0' '--kill_delay=15' '--stats=/private/var/tmp/_bazel_claudio/afceb7d1cdeddc94d64e34c0a088ac89/sandbox/processwrapper-sandbox/455/stats.out' bazel-out/darwin_arm64-opt-exec-C7777A24/bin/haskell/ghc_wrapper bazel-out/darwin_arm64-fastbuild/bin/tools/runfiles/compile_flags_runfiles____HaskellLinkDynamicLibrary bazel-out/darwin_arm64-fastbuild/bin/tools/runfiles/extra_args_runfiles____HaskellLinkDynamicLibrary)
/Library/Developer/CommandLineTools/usr/bin/install_name_tool: warning: changes being made to the file will invalidate the code signature in: bazel-out/darwin_arm64-fastbuild/bin/tools/runfiles/libHStoolsZSrunfilesZSrunfiles-ghc9.6.2.dylib
bazel-out/darwin_arm64-fastbuild/bin/tools/runfiles/libHStoolsZSrunfilesZSrunfiles-ghc9.6.2.dylib.resign: replacing existing signature
ghc-9.6.2: could not execute: otool

Note that PATH is set to /nix/store/ccjpkiqx40y6y98rpa2l8z4xg9mdlmq7-posix-toolchain/bin inside Bazel's sandbox.

However, using GHC 9.4.6 or 9.2.8 works just fine.

Looking at GHC's settings ( /nix/store/ywfzw2q59fna075p6ww98zlls4pgw17c-ghc-9.6.2/lib/ghc-9.6.2/lib/settings) I notice that the otool command is just set to otool:

,("otool command", "otool")

But previously, for former GHC versions it is properly set (e.g. /nix/store/lyfm7yz87ygvp8lkizxn43jcc11irpyq-ghc-9.4.6/lib/ghc-9.4.6/settings):

,("otool command", "/nix/store/s9j9nksvxalyw464x6q1brdp79ga1qhr-cctools-binutils-darwin-973.0.1/bin/otool")

Steps To Reproduce

(it is a bit more involved to create a few simple steps to reproduce and I think it is quite clear what the problem is. I can provide these steps if wanted)

Expected behavior

GHC should be able to execute otool even it is not on the PATH.

Additional context

Add any other context about the problem here.

Notify maintainers

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m" - system: `"aarch64-darwin"`
 - host os: `Darwin 21.6.0, macOS 12.7`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.13.3`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixpkgs`

Metadata

Metadata

Assignees

No one assigned

    Labels

    0.kind: bugSomething is broken6.topic: darwinRunning or building packages on Darwin6.topic: haskellGeneral-purpose, statically typed, purely functional programming language
    No fields configured for issues without a type.

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions