electron / build-tools

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

Building electron for x86 on ARM based Mac #278

Closed louistb closed 3 years ago

louistb commented 3 years ago

Im trying to run e build on a M1 mac to produce a x86 version of electron. Im getting this error :

FAILED: obj/electron/electron_framework_shared_library/Electron Framework obj/electron/electron_framework_shared_library/Electron Framework.TOC if [ ! -e "obj/electron/electron_framework_shared_library/Electron Framework" -o ! -e "obj/electron/electron_framework_shared_library/Electron Framework.TOC" ] || /Users/louistb/.electron_build_tools/third_party/Xcode/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/otool -l "obj/electron/electron_framework_shared_library/Electron Framework" | grep -q LC_REEXPORT_DYLIB ; then TOOL_VERSION=1619325618 ../../build/toolchain/mac/linker_driver.py -Wcrl,strippath,/Users/louistb/.electron_build_tools/third_party/Xcode/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/strip ../../third_party/llvm-build/Release+Asserts/bin/clang++ -B /Users/louistb/.electron_build_tools/third_party/Xcode/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ -shared -Wl,-install_name,@rpath/Electron\ Framework.framework/Electron\ Framework -rpath @loader_path/Libraries -Wl,-force_load,obj/third_party/electron_node/deps/uv/libuv.a -Wl,-fatal_warnings -stdlib=libc++ -arch x86_64 -Werror -Wl,-dead_strip -nostdlib++ -isysroot sdk/xcode_links/MacOSX11.0.sdk -mmacosx-version-min=10.11.0 -Wl,-ObjC -Lsdk/xcode_links/MacOSX11.0.sdk/usr/lib -F. -o "obj/electron/electron_framework_shared_library/Electron Framework" -Wl,-filelist,"obj/electron/electron_framework_shared_library/Electron Framework.rsp" -framework IOSurface -framework AVFoundation -framework Carbon -framework LocalAuthentication -framework QuartzCore -framework Quartz -framework Security -framework SecurityInterface -framework ServiceManagement -framework StoreKit -framework Squirrel -framework ReactiveObjC -framework Mantle -framework ApplicationServices -framework AppKit -framework CoreFoundation -framework IOKit -framework OpenDirectory -framework Foundation -framework CFNetwork -framework CoreServices -framework SystemConfiguration -framework CoreMedia -framework CoreGraphics -framework CoreText -framework Metal -framework OpenGL -framework Accelerate -framework AudioUnit -framework CoreVideo -framework AudioToolbox -framework CoreAudio -framework Cocoa -framework VideoToolbox -framework IOBluetooth -framework CoreMIDI -framework MediaAccessibility -framework DiskArbitration -framework ForceFeedback -framework GameController -framework CoreLocation -framework CoreWLAN -framework ImageCaptureCore -weak_framework MediaPlayer -weak_framework Metal -weak_framework MetalKit -weak_framework Vision ./libffmpeg.dylib -lbsm -lpmenergy -lpmsample -lresolv -lsandbox -lcups -lm && { /Users/louistb/.electron_build_tools/third_party/Xcode/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/otool -l "obj/electron/electron_framework_shared_library/Electron Framework" | grep LC_ID_DYLIB -A 5; /Users/louistb/.electron_build_tools/third_party/Xcode/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/nm -gPp "obj/electron/electron_framework_shared_library/Electron Framework" | cut -f1-2 -d' ' | grep -v U$$; true; } > "obj/electron/electron_framework_shared_library/Electron Framework.TOC"; else TOOL_VERSION=1619325618 ../../build/toolchain/mac/linker_driver.py -Wcrl,strippath,/Users/louistb/.electron_build_tools/third_party/Xcode/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/strip ../../third_party/llvm-build/Release+Asserts/bin/clang++ -B /Users/louistb/.electron_build_tools/third_party/Xcode/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ -shared -Wl,-install_name,@rpath/Electron\ Framework.framework/Electron\ Framework -rpath @loader_path/Libraries -Wl,-force_load,obj/third_party/electron_node/deps/uv/libuv.a -Wl,-fatal_warnings -stdlib=libc++ -arch x86_64 -Werror -Wl,-dead_strip -nostdlib++ -isysroot sdk/xcode_links/MacOSX11.0.sdk -mmacosx-version-min=10.11.0 -Wl,-ObjC -Lsdk/xcode_links/MacOSX11.0.sdk/usr/lib -F. -o "obj/electron/electron_framework_shared_library/Electron Framework" -Wl,-filelist,"obj/electron/electron_framework_shared_library/Electron Framework.rsp" -framework IOSurface -framework AVFoundation -framework Carbon -framework LocalAuthentication -framework QuartzCore -framework Quartz -framework Security -framework SecurityInterface -framework ServiceManagement -framework StoreKit -framework Squirrel -framework ReactiveObjC -framework Mantle -framework ApplicationServices -framework AppKit -framework CoreFoundation -framework IOKit -framework OpenDirectory -framework Foundation -framework CFNetwork -framework CoreServices -framework SystemConfiguration -framework CoreMedia -framework CoreGraphics -framework CoreText -framework Metal -framework OpenGL -framework Accelerate -framework AudioUnit -framework CoreVideo -framework AudioToolbox -framework CoreAudio -framework Cocoa -framework VideoToolbox -framework IOBluetooth -framework CoreMIDI -framework MediaAccessibility -framework DiskArbitration -framework ForceFeedback -framework GameController -framework CoreLocation -framework CoreWLAN -framework ImageCaptureCore -weak_framework MediaPlayer -weak_framework Metal -weak_framework MetalKit -weak_framework Vision ./libffmpeg.dylib -lbsm -lpmenergy -lpmsample -lresolv -lsandbox -lcups -lm && { /Users/louistb/.electron_build_tools/third_party/Xcode/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/otool -l "obj/electron/electron_framework_shared_library/Electron Framework" | grep LC_ID_DYLIB -A 5; /Users/louistb/.electron_build_tools/third_party/Xcode/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/nm -gPp "obj/electron/electron_framework_shared_library/Electron Framework" | cut -f1-2 -d' ' | grep -v U$$; true; } > "obj/electron/electron_framework_shared_library/Electron Framework.tmp" && if ! cmp -s "obj/electron/electron_framework_shared_library/Electron Framework.tmp" "obj/electron/electron_framework_shared_library/Electron Framework.TOC"; then mv "obj/electron/electron_framework_shared_library/Electron Framework.tmp" "obj/electron/electron_framework_shared_library/Electron Framework.TOC" ; fi; fi Undefined symbols for architecture x86_64: "network::SetFetchMetadataHeaders(net::URLRequest*, network::mojom::RequestMode, bool, network::mojom::RequestDestination, GURL const*, network::mojom::URLLoaderFactoryParams const&)", referenced from: network::URLLoader::URLLoader(net::URLRequestContext*, network::mojom::NetworkServiceClient*, network::mojom::NetworkContextClient*, base::OnceCallback<void (network::mojom::URLLoader*)>, mojo::PendingReceiver<network::mojom::URLLoader>, int, network::ResourceRequest const&, mojo::PendingRemote<network::mojom::URLLoaderClient>, base::Optional<network::DataPipeUseTracker>, net::NetworkTrafficAnnotationTag const&, network::mojom::URLLoaderFactoryParams const*, network::mojom::CrossOriginEmbedderPolicyReporter*, unsigned int, int, bool, scoped_refptr<network::ResourceSchedulerClient>, base::WeakPtr<network::KeepaliveStatisticsRecorder>, base::WeakPtr<network::NetworkUsageAccumulator>, network::mojom::TrustedURLLoaderHeaderClient*, network::mojom::TrustedURLLoaderAuthClient*, network::mojom::OriginPolicyManager*, std::__1::unique_ptr<network::TrustTokenRequestHelperFactory, std::__1::default_delete<network::TrustTokenRequestHelperFactory> >, network::cors::OriginAccessList const*, mojo::PendingRemote<network::mojom::CookieAccessObserver>) in libnetwork_service.a(url_loader.o) network::URLLoader::OnReceivedRedirect(net::URLRequest*, net::RedirectInfo const&, bool*) in libnetwork_service.a(url_loader.o) (maybe you meant: network::SetFetchMetadataHeaders(net::URLRequest*, network::mojom::RequestMode, bool, network::mojom::RequestDestination, GURL const*, network::mojom::URLLoaderFactoryParams const&, network::cors::OriginAccessList const&)) ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) Traceback (most recent call last): File "../../build/toolchain/mac/linker_driver.py", line 307, in <module> Main(sys.argv) File "../../build/toolchain/mac/linker_driver.py", line 97, in Main subprocess.check_call(compiler_driver_args, env=env) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 190, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['../../third_party/llvm-build/Release+Asserts/bin/clang++', '-B', '/Users/louistb/.electron_build_tools/third_party/Xcode/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/', '-shared', '-Wl,-install_name,@rpath/Electron Framework.framework/Electron Framework', '-rpath', '@loader_path/Libraries', '-Wl,-force_load,obj/third_party/electron_node/deps/uv/libuv.a', '-Wl,-fatal_warnings', '-stdlib=libc++', '-arch', 'x86_64', '-Werror', '-Wl,-dead_strip', '-nostdlib++', '-isysroot', 'sdk/xcode_links/MacOSX11.0.sdk', '-mmacosx-version-min=10.11.0', '-Wl,-ObjC', '-Lsdk/xcode_links/MacOSX11.0.sdk/usr/lib', '-F.', '-o', 'obj/electron/electron_framework_shared_library/Electron Framework', '-Wl,-filelist,obj/electron/electron_framework_shared_library/Electron Framework.rsp', '-framework', 'IOSurface', '-framework', 'AVFoundation', '-framework', 'Carbon', '-framework', 'LocalAuthentication', '-framework', 'QuartzCore', '-framework', 'Quartz', '-framework', 'Security', '-framework', 'SecurityInterface', '-framework', 'ServiceManagement', '-framework', 'StoreKit', '-framework', 'Squirrel', '-framework', 'ReactiveObjC', '-framework', 'Mantle', '-framework', 'ApplicationServices', '-framework', 'AppKit', '-framework', 'CoreFoundation', '-framework', 'IOKit', '-framework', 'OpenDirectory', '-framework', 'Foundation', '-framework', 'CFNetwork', '-framework', 'CoreServices', '-framework', 'SystemConfiguration', '-framework', 'CoreMedia', '-framework', 'CoreGraphics', '-framework', 'CoreText', '-framework', 'Metal', '-framework', 'OpenGL', '-framework', 'Accelerate', '-framework', 'AudioUnit', '-framework', 'CoreVideo', '-framework', 'AudioToolbox', '-framework', 'CoreAudio', '-framework', 'Cocoa', '-framework', 'VideoToolbox', '-framework', 'IOBluetooth', '-framework', 'CoreMIDI', '-framework', 'MediaAccessibility', '-framework', 'DiskArbitration', '-framework', 'ForceFeedback', '-framework', 'GameController', '-framework', 'CoreLocation', '-framework', 'CoreWLAN', '-framework', 'ImageCaptureCore', '-weak_framework', 'MediaPlayer', '-weak_framework', 'Metal', '-weak_framework', 'MetalKit', '-weak_framework', 'Vision', './libffmpeg.dylib', '-lbsm', '-lpmenergy', '-lpmsample', '-lresolv', '-lsandbox', '-lcups', '-lm']' returned non-zero exit status 1 ninja: build stopped: subcommand failed. Also, im curious is there anyone looking at the issues on this repo ? thanks

MarshallOfSound commented 3 years ago

It is not possible to build Electron for macOS targeting x86. The only supported architectures on macOS are arm64 and x64.

louistb commented 3 years ago

@MarshallOfSound i meant to say x64 sorry. I just want to be able to build electron for intel based macs but on my arm based mac, is this possible ?

MarshallOfSound commented 3 years ago

Honestly not sure, I've personally build x64 on x64, arm64 on x64 and arm64 on arm64. But never built x64 from and arm64 machine. My guess is if you run bash under rosetta and then run all the build tools commands from there it might work. It's not something we support / have tested though.

louistb commented 3 years ago

Ok thanks for the response, might become a needed feature sooner then later hehe I tried to run from a rosseta terminal with no sucess.