electron / build-tools

The GN scripts to use for Electron dev-flows
MIT License
257 stars 76 forks source link

failed to build on mac m1 #498

Closed anyerqi closed 8 months ago

anyerqi commented 1 year ago

Operating System

macOS 13.4.1 chip: Apple m1

Expected Behavior

build successfully on v22.3.6

Actual Behavior

build failed: ../../third_party/webrtc/modules/desktop_capture/mac/screen_capturer_mac.mm:462:11: error: 'CGDisplayStreamUpdateGetRects' is only available on macOS 13.0 or newer [-Werror,-Wunguarded-availability-new] CGDisplayStreamUpdateGetRects(updateRef, kCGDisplayStreamUpdateDirtyRects, &count);

To Reproduce

  1. checkout electorn to v22.3.6: git checkout tags/v22.3.6 -b v22.3.6
  2. e sync
  3. e build

Screenshots

Additional Information

e build
Running "e load-xcode --quiet"
WARN Xcode 13.3.0 is not supported on macOS Ventura, falling back to default of 14.3.0
Running "ninja -j 200 electron" in *********/src/out/Testing
[0/1] Regenerating ninja files
[1649/22290] OBJCXX obj/third_party/webrtc/modules/desktop_capture/desktop_capture_objc/screen_capturer_mac.o
FAILED: obj/third_party/webrtc/modules/desktop_capture/desktop_capture_objc/screen_capturer_mac.o
/Users/Hunter/.electron_build_tools/third_party/goma/gomacc ../../third_party/llvm-build/Release+Asserts/bin/clang++ -MMD -MF obj/third_party/webrtc/modules/desktop_capture/desktop_capture_objc/screen_capturer_mac.o.d -DDCHECK_ALWAYS_ON=1 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D_FORTIFY_SOURCE=2 -DCR_XCODE_VERSION=1430 -DCR_CLANG_REVISION=\"llvmorg-16-init-6578-g0d30e92f-2\" -D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS -D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS -DCR_LIBCXX_REVISION=64d36e572d3f9719c5d75011a718f33f11126851 -DNDEBUG -DNVALGRIND -DDYNAMIC_ANNOTATIONS_ENABLED=0 -DWEBRTC_ENABLE_PROTOBUF=1 -DRTC_ENABLE_VP9 -DRTC_DAV1D_IN_INTERNAL_DECODER_FACTORY -DWEBRTC_HAVE_SCTP -DENABLE_EXTERNAL_AUTH -DWEBRTC_USE_H264 -DHAVE_WEBRTC_VIDEO -DLOGGING_INSIDE_WEBRTC -DWEBRTC_ARCH_ARM64 -DWEBRTC_HAS_NEON -DWEBRTC_LIBRARY_IMPL -DWEBRTC_ENABLE_AVX2 -DWEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS=0 -DWEBRTC_CHROMIUM_BUILD -DWEBRTC_POSIX -DWEBRTC_MAC -DABSL_ALLOCATOR_NOTHROW=1 -I../.. -Igen -I../../buildtools/third_party/libc++ -I../../third_party/webrtc_overrides -I../../third_party/webrtc -Igen/third_party/webrtc -I../../third_party/abseil-cpp -I../../third_party/perfetto/include -Igen/third_party/perfetto/build_config -Igen/third_party/perfetto -I../../third_party/libyuv/include -I../../third_party/webrtc/sdk/objc -I../../third_party/webrtc/sdk/objc/base  -Wall -Werror -Wextra -Wimplicit-fallthrough -Wextra-semi -Wunreachable-code-aggressive -Wthread-safety -Wunguarded-availability -Wno-missing-field-initializers -Wno-unused-parameter -Wno-psabi -Wloop-analysis -Wno-unneeded-internal-declaration -Wenum-compare-conditional -Wno-ignored-pragma-optimize -Wno-deprecated-builtins -Wno-bitfield-constant-conversion -Wshadow -fno-delete-null-pointer-checks -fno-ident -fno-strict-aliasing -fstack-protector -fcolor-diagnostics -fmerge-all-constants -fcrash-diagnostics-dir=../../tools/clang/crashreports -mllvm -instcombine-lower-dbg-declare=0 -ffp-contract=off -fcomplete-member-pointers -arch arm64 -Wno-builtin-macro-redefined -D__DATE__= -D__TIME__= -D__TIMESTAMP__= -ffile-compilation-dir=. -no-canonical-prefixes -ftrivial-auto-var-init=pattern -O2 -fno-omit-frame-pointer -gdwarf-4 -g1 -gdwarf-aranges -isysroot sdk/xcode_links/MacOSX13.3.sdk -mmacos-version-min=10.13 -fvisibility=hidden -Xclang -add-plugin -Xclang find-bad-constructs -Xclang -plugin-arg-find-bad-constructs -Xclang raw-ref-template-as-trivial-member -Wheader-hygiene -Wstring-conversion -Wtautological-overlap-compare -Wexit-time-destructors -Wglobal-constructors -Wno-shadow -Wctad-maybe-unsupported -Wimplicit-retain-self -Wstrict-overflow -Wmissing-field-initializers -Wobjc-missing-property-synthesis -std=c++20 -Wno-trigraphs -fobjc-call-cxx-cdtors -fno-exceptions -fno-rtti -nostdinc++ -isystem../../buildtools/third_party/libc++/trunk/include -isystem../../buildtools/third_party/libc++abi/trunk/include -fvisibility-inlines-hidden -fobjc-arc -c ../../third_party/webrtc/modules/desktop_capture/mac/screen_capturer_mac.mm -o obj/third_party/webrtc/modules/desktop_capture/desktop_capture_objc/screen_capturer_mac.o
../../third_party/webrtc/modules/desktop_capture/mac/screen_capturer_mac.mm:462:11: error: 'CGDisplayStreamUpdateGetRects' is only available on macOS 13.0 or newer [-Werror,-Wunguarded-availability-new]
          CGDisplayStreamUpdateGetRects(updateRef, kCGDisplayStreamUpdateDirtyRects, &count);
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sdk/xcode_links/MacOSX13.3.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGDisplayStream.h:106:37: note: 'CGDisplayStreamUpdateGetRects' has been marked as being introduced in macOS 13.0 here, but the deployment target is macOS 10.13.0
CG_EXTERN const CGRect * __nullable CGDisplayStreamUpdateGetRects(CGDisplayStreamUpdateRef __nullable updateRef,
                                    ^
../../third_party/webrtc/modules/desktop_capture/mac/screen_capturer_mac.mm:462:11: note: enclose 'CGDisplayStreamUpdateGetRects' in an @available check to silence this warning
          CGDisplayStreamUpdateGetRects(updateRef, kCGDisplayStreamUpdateDirtyRects, &count);
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../third_party/webrtc/modules/desktop_capture/mac/screen_capturer_mac.mm:472:45: error: 'kCGDisplayStreamShowCursor' is only available on macOS 13.0 or newer [-Werror,-Wunguarded-availability-new]
                           (const void* []){kCGDisplayStreamShowCursor},
                                            ^~~~~~~~~~~~~~~~~~~~~~~~~~
sdk/xcode_links/MacOSX13.3.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGDisplayStream.h:195:30: note: 'kCGDisplayStreamShowCursor' has been marked as being introduced in macOS 13.0 here, but the deployment target is macOS 10.13.0
CG_EXTERN const CFStringRef  kCGDisplayStreamShowCursor CG_AVAILABLE_BUT_DEPRECATED(13.0, 14.0, "Please use ScreenCaptureKit API's SCStreamConfiguration showsCursor property instead");  /* CFBoolean - defaults to false */
                             ^
../../third_party/webrtc/modules/desktop_capture/mac/screen_capturer_mac.mm:472:45: note: enclose 'kCGDisplayStreamShowCursor' in an @available check to silence this warning
                           (const void* []){kCGDisplayStreamShowCursor},
                                            ^~~~~~~~~~~~~~~~~~~~~~~~~~
../../third_party/webrtc/modules/desktop_capture/mac/screen_capturer_mac.mm:478:41: error: 'CGDisplayStreamCreate' is only available on macOS 13.0 or newer [-Werror,-Wunguarded-availability-new]
    CGDisplayStreamRef display_stream = CGDisplayStreamCreate(
                                        ^~~~~~~~~~~~~~~~~~~~~
sdk/xcode_links/MacOSX13.3.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGDisplayStream.h:243:41: note: 'CGDisplayStreamCreate' has been marked as being introduced in macOS 13.0 here, but the deployment target is macOS 10.13.0
CG_EXTERN CGDisplayStreamRef __nullable CGDisplayStreamCreate(CGDirectDisplayID display,
                                        ^
../../third_party/webrtc/modules/desktop_capture/mac/screen_capturer_mac.mm:478:41: note: enclose 'CGDisplayStreamCreate' in an @available check to silence this warning
    CGDisplayStreamRef display_stream = CGDisplayStreamCreate(
                                        ^~~~~~~~~~~~~~~~~~~~~
../../third_party/webrtc/modules/desktop_capture/mac/screen_capturer_mac.mm:482:23: error: 'CGDisplayStreamStart' is only available on macOS 13.0 or newer [-Werror,-Wunguarded-availability-new]
      CGError error = CGDisplayStreamStart(display_stream);
                      ^~~~~~~~~~~~~~~~~~~~
sdk/xcode_links/MacOSX13.3.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGDisplayStream.h:273:19: note: 'CGDisplayStreamStart' has been marked as being introduced in macOS 13.0 here, but the deployment target is macOS 10.13.0
CG_EXTERN CGError CGDisplayStreamStart(CGDisplayStreamRef cg_nullable displayStream)
                  ^
../../third_party/webrtc/modules/desktop_capture/mac/screen_capturer_mac.mm:482:23: note: enclose 'CGDisplayStreamStart' in an @available check to silence this warning
      CGError error = CGDisplayStreamStart(display_stream);
                      ^~~~~~~~~~~~~~~~~~~~
../../third_party/webrtc/modules/desktop_capture/mac/screen_capturer_mac.mm:485:35: error: 'CGDisplayStreamGetRunLoopSource' is only available on macOS 13.0 or newer [-Werror,-Wunguarded-availability-new]
      CFRunLoopSourceRef source = CGDisplayStreamGetRunLoopSource(display_stream);
                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sdk/xcode_links/MacOSX13.3.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGDisplayStream.h:295:41: note: 'CGDisplayStreamGetRunLoopSource' has been marked as being introduced in macOS 13.0 here, but the deployment target is macOS 10.13.0
CG_EXTERN CFRunLoopSourceRef __nullable CGDisplayStreamGetRunLoopSource(CGDisplayStreamRef cg_nullable displayStream)
                                        ^
../../third_party/webrtc/modules/desktop_capture/mac/screen_capturer_mac.mm:485:35: note: enclose 'CGDisplayStreamGetRunLoopSource' in an @available check to silence this warning
      CFRunLoopSourceRef source = CGDisplayStreamGetRunLoopSource(display_stream);
                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../third_party/webrtc/modules/desktop_capture/mac/screen_capturer_mac.mm:498:33: error: 'CGDisplayStreamGetRunLoopSource' is only available on macOS 13.0 or newer [-Werror,-Wunguarded-availability-new]
    CFRunLoopSourceRef source = CGDisplayStreamGetRunLoopSource(stream);
                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sdk/xcode_links/MacOSX13.3.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGDisplayStream.h:295:41: note: 'CGDisplayStreamGetRunLoopSource' has been marked as being introduced in macOS 13.0 here, but the deployment target is macOS 10.13.0
CG_EXTERN CFRunLoopSourceRef __nullable CGDisplayStreamGetRunLoopSource(CGDisplayStreamRef cg_nullable displayStream)
                                        ^
../../third_party/webrtc/modules/desktop_capture/mac/screen_capturer_mac.mm:498:33: note: enclose 'CGDisplayStreamGetRunLoopSource' in an @available check to silence this warning
    CFRunLoopSourceRef source = CGDisplayStreamGetRunLoopSource(stream);
                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../third_party/webrtc/modules/desktop_capture/mac/screen_capturer_mac.mm:500:5: error: 'CGDisplayStreamStop' is only available on macOS 13.0 or newer [-Werror,-Wunguarded-availability-new]
    CGDisplayStreamStop(stream);
    ^~~~~~~~~~~~~~~~~~~
sdk/xcode_links/MacOSX13.3.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGDisplayStream.h:285:19: note: 'CGDisplayStreamStop' has been marked as being introduced in macOS 13.0 here, but the deployment target is macOS 10.13.0
CG_EXTERN CGError CGDisplayStreamStop(CGDisplayStreamRef cg_nullable displayStream)
                  ^
../../third_party/webrtc/modules/desktop_capture/mac/screen_capturer_mac.mm:500:5: note: enclose 'CGDisplayStreamStop' in an @available check to silence this warning
    CGDisplayStreamStop(stream);
    ^~~~~~~~~~~~~~~~~~~
7 errors generated.
[1848/22290] CXX obj/gpu/ipc/common/gpu_channel_mojom/gpu_channel.mojom.o
ninja: build stopped: subcommand failed.
ERROR Error: Command failed: ninja -j 200 electron
    at checkExecSyncError (node:child_process:885:11)
    at Object.execFileSync (node:child_process:921:15)
    at Object.depotExecFileSync [as execFileSync] (/Users/Hunter/.electron_build_tools/src/utils/depot-tools.js:131:23)
    at runNinja (/Users/Hunter/.electron_build_tools/src/e-build.js:60:9)
    at Command.<anonymous> (/Users/Hunter/.electron_build_tools/src/e-build.js:121:7)
    at Command.listener [as _actionHandler] (/Users/Hunter/.electron_build_tools/node_modules/commander/lib/command.js:480:17)
    at /Users/Hunter/.electron_build_tools/node_modules/commander/lib/command.js:1234:65
    at Command._chainOrCall (/Users/Hunter/.electron_build_tools/node_modules/commander/lib/command.js:1151:12)
    at Command._parseCommand (/Users/Hunter/.electron_build_tools/node_modules/commander/lib/command.js:1234:27)
codebytere commented 8 months ago

This was caused by https://bugs.chromium.org/p/chromium/issues/detail?id=1432420 which has since been addressed and fixed.