在Mac OS 10.15上使用gn和ninja从源构建电子时发生错误

目前,我尝试修复电子中的一些可访问性错误。为此,我试图从源头制造电子。来源未经我编辑或更改,因此是原始的。

我按照构建说明从GitHub上的官方仓库中提取了源代码,并且使用了客户端等。

这是我在Mac OS X 10.15下的终端中的步骤的输出:

Christophers-MacBook-Pro:src chpross$ gn gen out/Testing --args="import(\"//electron/build/args/testing.gn\") $GN_EXTRA_ARGS"
Done. Made 11597 targets from 1978 files in 6073ms

Christophers-MacBook-Pro:src chpross$ ninja -C out/Testing electron
ninja: Entering directory `out/Testing'
[8992/26566] CXX obj/services/network/..._cpp_sources/udp_socket.mojom-shared.o^[9026/26566] CXX obj/services/network/...content_security_policy.mojom-shared.o^[9044/26566] CXX obj/services/video_ca...ed_cpp_sources/receiver.mojom-shared.o^[9047/26566] CXX obj/services/video_ca...ared_cpp_sources/device.mojom-shared.o^[9098/26566] CXX obj/v8/torque_generat...itializers/object-fromentries-tq-csa.o^[9160/26566] CXX obj/third_party/blink...nderer/core/inspector/generated/Page.o^[10130/26566] OBJCXX obj/components/vi...tal_context_provider/metal_api_proxy.o
FAILED: obj/components/viz/common/metal_context_provider/metal_api_proxy.o 
/Users/chpross/programmierung/electron-gn/src/electron/external_binaries/sccache ../../third_party/llvm-build/Release+Asserts/bin/clang++ -MMD -MF obj/components/viz/common/metal_context_provider/metal_api_proxy.o.d -DVIZ_MetaL_CONTEXT_PROVIDER_IMPLEMENTATION -DDCHECK_ALWAYS_ON=1 -D_LIBCPP_HAS_NO_ALIGNED_ALLOCATION -DCR_XCODE_VERSION=1120 -DCR_CLANG_REVISION=\"373424-64a362e7-1\" -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D_FORTIFY_SOURCE=2 -D_LIBCPP_ABI_UNSTABLE -D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS -D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS -D_LIBCPP_ENABLE_NODISCARD -DCR_LIBCXX_REVISION=361348 -D__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES=0 -DNDEBUG -DNVALGRIND -DDYNAMIC_ANNOTATIONS_ENABLED=0 -DWEBP_EXTERN=extern -DENABLE_IPC_fuzzer -DUSE_EGL -DSK_GL -DSK_HAS_PNG_libraRY -DSK_HAS_WEBP_libraRY -DSK_USER_CONFIG_HEADER=\"../../skia/config/SkUserConfig.h\" -DSK_HAS_JPEG_libraRY -DSK_SUPPORT_GPU=1 -DSK_GPU_WORKAROUNDS_HEADER=\"gpu/config/gpu_driver_bug_workaround_autogen.h\" -DSK_BUILD_FOR_MAC -DSK_MetaL -DU_USING_ICU_NAMESPACE=0 -DU_ENABLE_DYLOAD=0 -DUSE_CHROMIUM_ICU=1 -DU_STATIC_IMPLEMENTATION -DICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_FILE -DUCHAR_TYPE=uint16_t -I../.. -Igen -I../../third_party/libwebp/src -I../../third_party/skia -I../../third_party/boringssl/src/include -I../../third_party/icu/source/common -I../../third_party/icu/source/i18n -I../../third_party/khronos -I../../gpu -I../../third_party/mesa_headers -fno-strict-aliasing -fstack-protector -fcolor-diagnostics -fmerge-all-constants -fcrash-diagnostics-dir=../../tools/clang/crashreports -Xclang -mllvm -Xclang -instcombine-lower-dbg-declare=0 -fcomplete-member-pointers -arch x86_64 -Wno-builtin-macro-redefined -D__DATE__= -D__TIME__= -D__TIMESTAMP__= -Xclang -fdebug-compilation-dir -Xclang . -no-canonical-prefixes -Wall -Werror -Wextra -Wimplicit-fallthrough -Wthread-safety -Wextra-semi -Wunguarded-availability -Wno-missing-field-initializers -Wno-unused-parameter -Wno-c++11-narrowing -Wno-unneeded-internal-declaration -Wno-undefined-var-template -Wno-ignored-pragma-optimize -Wno-implicit-int-float-conversion -Wno-c99-designator -Wno-final-dtor-non-final-class -Wno-sizeof-array-div -O2 -fno-omit-frame-pointer -gdwarf-4 -g1 -isysroot ../../../../../../../Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -mmacosx-version-min=10.10.0 -fvisibility=hidden -Xclang -add-plugin -Xclang find-bad-constructs -Wheader-hygiene -Wstring-conversion -Wtautological-overlap-compare -std=c++14 -stdlib=libc++ -fobjc-call-cxx-cdtors -Wobjc-missing-property-synthesis -fno-exceptions -fno-rtti -fvisibility-inlines-hidden -include obj/components/viz/common/metal_context_provider/precompile.h-mm -c ../../components/viz/common/gpu/metal_api_proxy.mm -o obj/components/viz/common/metal_context_provider/metal_api_proxy.o
../../components/viz/common/gpu/metal_api_proxy.mm:224:17: error: auto property synthesis will not synthesize property 'hasUnifiedMemory' declared in protocol 'MTLDevice' [-Werror,-Wobjc-protocol-property-synthesis]
@implementation MTLDeviceProxy
                ^
../../../../../../../Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/library/Frameworks/Metal.framework/Headers/MTLDevice.h:353:27: note: property declared here
@property (readonly) BOOL hasUnifiedMemory API_AVAILABLE(macos(10.15),ios(13.0));
                          ^
../../components/viz/common/gpu/metal_api_proxy.mm:578:1: note: add a '@synthesize' directive
@end
^
../../components/viz/common/gpu/metal_api_proxy.mm:224:17: error: auto property synthesis will not synthesize property 'location' declared in protocol 'MTLDevice' [-Werror,-Wobjc-protocol-property-synthesis]
@implementation MTLDeviceProxy
                ^
../../../../../../../Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/library/Frameworks/Metal.framework/Headers/MTLDevice.h:368:40: note: property declared here
@property (readonly) MTLDeviceLocation location API_AVAILABLE(macos(10.15)) API_UNAVAILABLE(ios);
                                       ^
../../components/viz/common/gpu/metal_api_proxy.mm:578:1: note: add a '@synthesize' directive
@end
^
../../components/viz/common/gpu/metal_api_proxy.mm:224:17: error: auto property synthesis will not synthesize property 'locationNumber' declared in protocol 'MTLDevice' [-Werror,-Wobjc-protocol-property-synthesis]
@implementation MTLDeviceProxy
                ^
../../../../../../../Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/library/Frameworks/Metal.framework/Headers/MTLDevice.h:377:33: note: property declared here
@property (readonly) NSUInteger locationNumber API_AVAILABLE(macos(10.15)) API_UNAVAILABLE(ios);
                                ^
../../components/viz/common/gpu/metal_api_proxy.mm:578:1: note: add a '@synthesize' directive
@end
^
../../components/viz/common/gpu/metal_api_proxy.mm:224:17: error: auto property synthesis will not synthesize property 'maxTransferRate' declared in protocol 'MTLDevice' [-Werror,-Wobjc-protocol-property-synthesis]
@implementation MTLDeviceProxy
                ^
../../../../../../../Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/library/Frameworks/Metal.framework/Headers/MTLDevice.h:385:31: note: property declared here
@property (readonly) uint64_t maxTransferRate API_AVAILABLE(macos(10.15)) API_UNAVAILABLE(ios);
                              ^
../../components/viz/common/gpu/metal_api_proxy.mm:578:1: note: add a '@synthesize' directive
@end
^
../../components/viz/common/gpu/metal_api_proxy.mm:224:17: error: auto property synthesis will not synthesize property 'barycentricCoordsSupported' declared in protocol 'MTLDevice' [-Werror,-Wobjc-protocol-property-synthesis]
@implementation MTLDeviceProxy
                ^
../../../../../../../Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/library/Frameworks/Metal.framework/Headers/MTLDevice.h:421:64: note: property declared here
@property(readonly,getter=areBarycentricCoordsSupported) BOOL barycentricCoordsSupported API_AVAILABLE(macos(10.15)) API_UNAVAILABLE(ios);
                                                               ^
../../components/viz/common/gpu/metal_api_proxy.mm:578:1: note: add a '@synthesize' directive
@end
^
../../components/viz/common/gpu/metal_api_proxy.mm:224:17: error: auto property synthesis will not synthesize property 'supportsShaderBarycentricCoordinates' declared in protocol 'MTLDevice' [-Werror,-Wobjc-protocol-property-synthesis]
@implementation MTLDeviceProxy
                ^
../../../../../../../Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/library/Frameworks/Metal.framework/Headers/MTLDevice.h:423:27: note: property declared here
@property (readonly) BOOL supportsShaderBarycentricCoordinates API_AVAILABLE(macos(10.15)) API_UNAVAILABLE(ios);
                          ^
../../components/viz/common/gpu/metal_api_proxy.mm:578:1: note: add a '@synthesize' directive
@end
^
../../components/viz/common/gpu/metal_api_proxy.mm:224:17: error: auto property synthesis will not synthesize property 'peerGroupID' declared in protocol 'MTLDevice' [-Werror,-Wobjc-protocol-property-synthesis]
@implementation MTLDeviceProxy
                ^
../../../../../../../Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/library/Frameworks/Metal.framework/Headers/MTLDevice.h:753:31: note: property declared here
@property (readonly) uint64_t peerGroupID API_AVAILABLE(macos(10.15)) API_UNAVAILABLE(ios);
                              ^
../../components/viz/common/gpu/metal_api_proxy.mm:578:1: note: add a '@synthesize' directive
@end
^
../../components/viz/common/gpu/metal_api_proxy.mm:224:17: error: auto property synthesis will not synthesize property 'peerIndex' declared in protocol 'MTLDevice' [-Werror,-Wobjc-protocol-property-synthesis]
@implementation MTLDeviceProxy
                ^
../../../../../../../Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/library/Frameworks/Metal.framework/Headers/MTLDevice.h:760:31: note: property declared here
@property (readonly) uint32_t peerIndex API_AVAILABLE(macos(10.15)) API_UNAVAILABLE(ios);
                              ^
../../components/viz/common/gpu/metal_api_proxy.mm:578:1: note: add a '@synthesize' directive
@end
^
../../components/viz/common/gpu/metal_api_proxy.mm:224:17: error: auto property synthesis will not synthesize property 'peerCount' declared in protocol 'MTLDevice' [-Werror,-Wobjc-protocol-property-synthesis]
@implementation MTLDeviceProxy
                ^
../../../../../../../Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/library/Frameworks/Metal.framework/Headers/MTLDevice.h:766:31: note: property declared here
@property (readonly) uint32_t peerCount API_AVAILABLE(macos(10.15)) API_UNAVAILABLE(ios);
                              ^
../../components/viz/common/gpu/metal_api_proxy.mm:578:1: note: add a '@synthesize' directive
@end
^
../../components/viz/common/gpu/metal_api_proxy.mm:224:17: error: auto property synthesis will not synthesize property 'counterSets' declared in protocol 'MTLDevice' [-Werror,-Wobjc-protocol-property-synthesis]
@implementation MTLDeviceProxy
                ^
../../../../../../../Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/library/Frameworks/Metal.framework/Headers/MTLDevice.h:782:60: note: property declared here
@property (readonly,nullable) NSArray<id<MTLCounterSet>>* counterSets API_AVAILABLE(macos(10.15)) API_UNAVAILABLE(ios);
                                                           ^
../../components/viz/common/gpu/metal_api_proxy.mm:578:1: note: add a '@synthesize' directive
@end
^
../../components/viz/common/gpu/metal_api_proxy.mm:224:17: error: method 'supportsFamily:' in protocol 'MTLDevice' not implemented [-Werror,-Wprotocol]
@implementation MTLDeviceProxy
                ^
../../../../../../../Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/library/Frameworks/Metal.framework/Headers/MTLDevice.h:659:1: note: method 'supportsFamily:' declared here
- (BOOL)supportsFamily:(MTLGPUFamily)gpuFamily API_AVAILABLE(macos(10.15),ios(13.0));
^
../../components/viz/common/gpu/metal_api_proxy.mm:224:17: error: method 'newCounterSampleBufferWithDescriptor:error:' in protocol 'MTLDevice' not implemented [-Werror,-Wprotocol]
@implementation MTLDeviceProxy
                ^
../../../../../../../Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/library/Frameworks/Metal.framework/Headers/MTLDevice.h:793:1: note: method 'newCounterSampleBufferWithDescriptor:error:' declared here
- (nullable id<MTLCounterSampleBuffer>) newCounterSampleBufferWithDescriptor:(MTLCounterSampleBufferDescriptor*)descriptor
^
../../components/viz/common/gpu/metal_api_proxy.mm:224:17: error: method 'sampleTimestamps:gpuTimestamp:' in protocol 'MTLDevice' not implemented [-Werror,-Wprotocol]
@implementation MTLDeviceProxy
                ^
../../../../../../../Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/library/Frameworks/Metal.framework/Headers/MTLDevice.h:803:1: note: method 'sampleTimestamps:gpuTimestamp:' declared here
-(void)sampleTimestamps:(NSUInteger *)cpuTimestamp
^
13 errors generated.
[10139/26566] CXX obj/v8/v8_initializers/code-stub-assembler.o
ninja: build stopped: subcommand failed.

所以不同的忍者目标会产生不同的错误。我认为这对于一个问题来说意义重大,因此,如果有人需要此错误,可以将其粘贴到pastebin中。源代码是官方的,但是构建失败,我已经重新启动了系统,清理了out-dir等。希望有人知道这里出了什么问题。

do11223 回答:在Mac OS 10.15上使用gn和ninja从源构建电子时发生错误

SDK不兼容
尝试构建时,Electron / Chromium与MacOSX 10.15 SDK不兼容。

指出所需的版本是10.14
$ gn args out/Testing --list --short|grep sdk
mac_sdk_min = "10.14"

the docs相对。从旧版本的XCode或通过

从GitHub非正式地下载
svn checkout https://github.com/phracker/MacOSX-SDKs/tree/master/MacOSX10.14.sdk

并将其设置为对忍者有效,例如通过src/electron/build/args/testing.gn将路径包括在mac_sdk_path = "$path_to_sdk_folder"中。 我恢复了更改(请参见原始帖子)并删除了out/Testing,并丢弃了所有编译结果。重置/重新编译受影响的文件的破坏性可能较小。然后通过gn gen regenerate the config并重新开始编译。

不幸的是,v8_context_snapshot的错误仍然存​​在:

ACTION //tools/v8_context_snapshot:generate_v8_context_snapshot(//build/toolchain/mac:clang_x64)
FAILED: v8_context_snapshot.bin
python ../../build/gn_run_binary.py ./v8_context_snapshot_generator --output_file=v8_context_snapshot.bin
[1119/152748.970749:FATAL:protected_memory.h(218)] Check failed: SetMemoryReadWrite(&writers,&writers + 1).
0   v8_context_snapshot_generator       0x000000010eda4829 base::debug::CollectStackTrace(void**,unsigned long) + 9
1   v8_context_snapshot_generator       0x000000010ec88dd3 base::debug::StackTrace::StackTrace() + 19
2   v8_context_snapshot_generator       0x000000010ec9b869 logging::LogMessage::~LogMessage() + 233
3   v8_context_snapshot_generator       0x000000010f1337df base::AutoWritableMemory::AutoWritableMemory(void*,void*) + 239
4   v8_context_snapshot_generator       0x000000010f133421 MojoEmbedderSetSystemThunks(MojoSystemThunks const*) + 257
5   v8_context_snapshot_generator       0x000000010c135c16 main + 86
6   libdyld.dylib                       0x00007fff6a0ed3d5 start + 1

./v8_context_snapshot_generator failed with exit code -5
ninja: build stopped: subcommand failed.

另一个选择是等待上游对其进行修复,如here所指出的那样。或通过以下第一个来自己实施必要的更改,但是还需要更多。


原始帖子

铬具有MTLDeviceProxy,其中

  

包装对MTLDevice的所有调用,并向GPU看门狗报告进度。

不幸的是,它缺少MTLDevice protocol所需的属性 C can't auto-synthesize
因此,我们在components/viz/common/gpu/metal_api_proxy.mm中明确合成了它们:

@implementation MTLDeviceProxy
- (id)initWithDevice:(id<MTLDevice>)device {
  if (self = [super init]) {
    device_.reset(device,base::scoped_policy::RETAIN);
    libraryCache_ = std::make_unique<MTLLibraryCache>();
  }
  return self;
}

// add synthesized properties here
@synthesize hasUnifiedMemory;
@synthesize location;
@synthesize locationNumber;
@synthesize maxTransferRate;
@synthesize barycentricCoordsSupported;
@synthesize supportsShaderBarycentricCoordinates;
@synthesize peerGroupID;
@synthesize peerIndex;
@synthesize peerCount;
@synthesize counterSets;

还缺少三个抽象方法。 在末尾插入这三个包装器:

PROXY_METHOD1(BOOL,supportsFamily,MTLGPUFamily)
PROXY_METHOD2_SLOW(nullable id<MTLCounterSampleBuffer>,newCounterSampleBufferWithDescriptor,MTLCounterSampleBufferDescriptor*,error,NSError**)
PROXY_METHOD2_SLOW(void,sampleTimestamps,NSUInteger *,gpuTimestamp,NSUInteger *)

#endif
#pragma clang diagnostic pop

我想知道这些属性和方法是如何被遗忘的,为什么这个问题现在浮出水面。 编译愉快!

,

Chromium似乎已针对macOS 10.15更新了其代码。 您可以在这里找到更新的代码。 https://github.com/chromium/chromium/commit/961e7821b9356445f48e5ce2c077c40c2c6b2309

本文链接:https://www.f2er.com/3127022.html

大家都在问