Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sigtool to the bazel cc wrapper #489

Merged
merged 1 commit into from
Mar 27, 2024
Merged

Conversation

avdv
Copy link
Member

@avdv avdv commented Mar 27, 2024

This is needed on Darwin when (re-)signing binaries.

This failed when using a nixpgks configured cc like this:

 Traceback (most recent call last):
  File "/private/var/tmp/_bazel_runner/d1e3bdaa0c37ce8d00ecff62b05849c3/sandbox/processwrapper-sandbox/149/execroot/rules_haskell/bazel-out/darwin-opt-exec-C7777A24/bin/haskell/cc_wrapper-python.runfiles/rules_haskell/haskell/cc_wrapper.py", line 1161, in <module>
    main()
  File "/private/var/tmp/_bazel_runner/d1e3bdaa0c37ce8d00ecff62b05849c3/sandbox/processwrapper-sandbox/149/execroot/rules_haskell/bazel-out/darwin-opt-exec-C7777A24/bin/haskell/cc_wrapper-python.runfiles/rules_haskell/haskell/cc_wrapper.py", line 96, in main
    link(parsed.output, parsed.libraries, parsed.rpaths, parsed.args)
  File "/private/var/tmp/_bazel_runner/d1e3bdaa0c37ce8d00ecff62b05849c3/sandbox/processwrapper-sandbox/149/execroot/rules_haskell/bazel-out/darwin-opt-exec-C7777A24/bin/haskell/cc_wrapper-python.runfiles/rules_haskell/haskell/cc_wrapper.py", line 580, in link
    darwin_rewrite_load_commands(darwin_rewrites, output)
  File "/private/var/tmp/_bazel_runner/d1e3bdaa0c37ce8d00ecff62b05849c3/sandbox/processwrapper-sandbox/149/execroot/rules_haskell/bazel-out/darwin-opt-exec-C7777A24/bin/haskell/cc_wrapper-python.runfiles/rules_haskell/haskell/cc_wrapper.py", line 939, in darwin_rewrite_load_commands
    subprocess.check_call([CODESIGN] + ["-f", "-s", "-"] + [f"{output}.resign"], env = {'CODESIGN_ALLOCATE': CODESIGN_ALLOCATE})
  File "/nix/store/cdbhdah4qillzy7z9rsi3svbarwm8a6i-python3-3.11.6/lib/python3.11/subprocess.py", line 408, in check_call
    retcode = call(*popenargs, **kwargs)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/cdbhdah4qillzy7z9rsi3svbarwm8a6i-python3-3.11.6/lib/python3.11/subprocess.py", line 389, in call
    with Popen(*popenargs, **kwargs) as p:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/cdbhdah4qillzy7z9rsi3svbarwm8a6i-python3-3.11.6/lib/python3.11/subprocess.py", line 1026, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/nix/store/cdbhdah4qillzy7z9rsi3svbarwm8a6i-python3-3.11.6/lib/python3.11/subprocess.py", line 1950, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: '/nix/store/ckwiyngb33gsfahpshb6n9476mdkc0h4-bazel-clang-wrapper-16.0.6-wrapper/bin/codesign'

CI passed for rules_haskell including these changes: https://github.com/tweag/rules_haskell/actions/runs/8450680413

(except format & lint and bzlmod jobs, but that's expected)

This is needed on Darwin when (re-)signing binaries.
@avdv avdv requested a review from benradf as a code owner March 27, 2024 10:55
@avdv avdv added the merge-queue merge on green CI label Mar 27, 2024
@mergify mergify bot merged commit 024e571 into master Mar 27, 2024
15 checks passed
@mergify mergify bot deleted the cb/add-sigtool-to-cc-on-darwin branch March 27, 2024 14:30
@mergify mergify bot removed the merge-queue merge on green CI label Mar 27, 2024
@avdv avdv mentioned this pull request Mar 27, 2024
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants