build-tools icon indicating copy to clipboard operation
build-tools copied to clipboard

Error running `e build` on macOS: Input to targets not generated by a dependency

Open jtbandes opened this issue 1 year ago • 6 comments

I'm looking for some advice on building electron from source.

I'm running the following steps on a macOS arm64 (apple silicon) host on macOS 15.1. I have Xcode 16.1 installed.

  • npm i -g @electron/[email protected]

  • e init mybuilder --import release --reclient none --target-cpu x64

    • This outputs:
      WARN Automatically detected an unknown macOS SDK null - falling back to default of 15.0
      INFO Now using SDK version 15.0
      
  • e sync --revision v33.0.2

  • e load-macos-sdk

    • This outputs INFO Now using SDK version 14.0
  • e build

The final e build step fails with this error:

INFO Building electron with remote execution disabled
Running "/Users/USER/.electron_build_tools/third_party/depot_tools/gn gen out/Release" in /Users/USER/Desktop/actions-runner/_work/custom-electron-builder/custom-electron-builder/electron/src
ERROR Input to targets not generated by a dependency.
The file:
  //out/Release/xcode_links/electron/MacOSX14.0.sdk/usr/include/mach/exc.defs
is listed as an input or source for the targets:
  //third_party/crashpad/crashpad/util:mig(//build/toolchain/mac:clang_x64)
  //third_party/crashpad/crashpad/util:mig(//build/toolchain/mac:clang_arm64_v8_x64)
  //third_party/crashpad/crashpad/util:mig(//build/toolchain/mac:clang_arm64)
but no targets in the build generate that file.
ERROR Input to targets not generated by a dependency.
The file:
  //out/Release/xcode_links/electron/MacOSX14.0.sdk/usr/include/mach/mach_exc.defs
is listed as an input or source for the targets:
  //third_party/crashpad/crashpad/util:mig(//build/toolchain/mac:clang_x64)
  //third_party/crashpad/crashpad/util:mig(//build/toolchain/mac:clang_arm64_v8_x64)
  //third_party/crashpad/crashpad/util:mig(//build/toolchain/mac:clang_arm64)
but no targets in the build generate that file.
ERROR Input to targets not generated by a dependency.
The file:
  //out/Release/xcode_links/electron/MacOSX14.0.sdk/usr/include/mach/notify.defs
is listed as an input or source for the targets:
  //third_party/crashpad/crashpad/util:mig(//build/toolchain/mac:clang_x64)
  //third_party/crashpad/crashpad/util:mig(//build/toolchain/mac:clang_arm64_v8_x64)
  //third_party/crashpad/crashpad/util:mig(//build/toolchain/mac:clang_arm64)
but no targets in the build generate that file.
If you have generated inputs, there needs to be a dependency path between the
two targets in addition to just listing the files. For indirect dependencies,
the intermediate ones must be public_deps. data_deps don't count since they're
only runtime dependencies. If you think a dependency chain exists, it might be
because the chain is private. Try "gn path" to analyze.
3 generated input errors found.
ERROR Error: Command failed: /Users/USER/.electron_build_tools/third_party/depot_tools/gn gen out/Release
    at checkExecSyncError (node:child_process:890:11)
    at Object.execFileSync (node:child_process:926:15)
    at Object.depotExecFileSync [as execFileSync] (/Users/USER/.electron_build_tools/src/utils/depot-tools.js:147:23)
    at runGNGen (/Users/USER/.electron_build_tools/src/e-build.js:42:9)
    at ensureGNGen (/Users/USER/.electron_build_tools/src/e-build.js:47:41)
    at runNinja (/Users/USER/.electron_build_tools/src/e-build.js:70:3)
    at Command.<anonymous> (/Users/USER/.electron_build_tools/src/e-build.js:112:7)
    at Command.listener [as _actionHandler] (/Users/USER/.electron_build_tools/node_modules/commander/lib/command.js:480:17)
    at /Users/USER/.electron_build_tools/node_modules/commander/lib/command.js:1234:65

Any advice would be appreciated. Thanks!

jtbandes avatar Oct 29 '24 22:10 jtbandes

hey @jtbandes - we've adjusted that logic a fair amount lately so there's definitely a bug or two at play here. I'll take a look - this bug should be on build-tools though so I'm going to transfer it there.

codebytere avatar Oct 30 '24 10:10 codebytere

Any tips for if there's a quick workaround on this before it gets fixed upstream?

jtbandes avatar Nov 04 '24 20:11 jtbandes

Actually it seems like running e build a second time works as a workaround 😄

jtbandes avatar Nov 05 '24 19:11 jtbandes

@jtbandes thank for your workaround

alirv90 avatar Nov 08 '24 03:11 alirv90

The workaround doesn't work for me...on the 2nd e build run I also get the exactly same error as in the issue description, even if I pin the build-tools version as here. How do you solve this in your Electron pipelines @codebytere?

nikitakot avatar Nov 29 '24 08:11 nikitakot

@codebytere sorry for pinging again but maybe you have other workarounds in mind or a particular electron version i can build now with this issue?

nikitakot avatar Dec 02 '24 10:12 nikitakot

@nikitakot are you building with reclient?

codebytere avatar Jun 08 '25 07:06 codebytere

Isn't reclient just a cache? Why would it cause or fix errors like this?

jtbandes avatar Jul 22 '25 21:07 jtbandes

Does this still happen?

codebytere avatar Nov 05 '25 14:11 codebytere

I tried again with v39.1.0 and no longer seeing this error.

Since the caching behavior has changed I don't really know how to verify for sure that it works all the time, or if i just got lucky with a cache hit.

jtbandes avatar Nov 06 '25 00:11 jtbandes

We ended up working around this by doing an xcode select prior to running e sync / e build.

derekcicerone avatar Nov 06 '25 00:11 derekcicerone

For anyone interested, here is my complete/working build script: https://gist.github.com/jtbandes/677df14872fbff5d2e7d01f53ccc455c

jtbandes avatar Nov 14 '25 22:11 jtbandes