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

aarch64 OBJC_OLD_DISPATCH_PROTOTYPES=1 ignored #292

Open
chairmanwow opened this issue May 31, 2021 · 4 comments
Open

aarch64 OBJC_OLD_DISPATCH_PROTOTYPES=1 ignored #292

chairmanwow opened this issue May 31, 2021 · 4 comments

Comments

@chairmanwow
Copy link

chairmanwow commented May 31, 2021

Hi, I'm trying to build a hello world level app using web-view. Builds perfectly on amd64 Linux. On the aarch64 apple m1, I'm running into issues even building.

I did some digging into OBJC_OLD_DISPATCH_PROTOTYPES=1 and build.rs and see you're already using the right flag to activate the old prototype that took three args. I'm confused why this is happening and wondering if this is an aarch64-specific issue? I tried setting CFLAGS_arch64_apple_darwin to -DOBJC_OLD_DISPATCH_PROTOTYPES=1 but this probably had no effect since you do this already in build.rs. I did -ferror-limit=0 for kicks and got to about 120 errors, so I'm clearly busted. I also tried setting -framework WebKit just to see if there was something around that. Also nothing.

If you have any suggestions on a fix, or if you know this is just my environment, I'd appreciate the info.

Build error below:

Caused by:
  process didn't exit successfully: `~/server/target/debug/build/webview-sys-5d6f4b20218f03fb/build-script-build` (exit status: 1)
  --- stdout
  cargo:rustc-link-lib=framework=Cocoa
  cargo:rustc-link-lib=framework=WebKit
  TARGET = Some("aarch64-apple-darwin")
  OPT_LEVEL = Some("0")
  HOST = Some("aarch64-apple-darwin")
  CC_aarch64-apple-darwin = None
  CC_aarch64_apple_darwin = None
  HOST_CC = None
  CC = None
  CFLAGS_aarch64-apple-darwin = None
  CFLAGS_aarch64_apple_darwin = None
  HOST_CFLAGS = None
  CFLAGS = None
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("true")
  CARGO_CFG_TARGET_FEATURE = Some("aes,crc,crypto,dpb,fcma,fp,fp16,jsconv,lse,neon,ras,rcpc,rdm,sha2,v8.1a,v8.2a,v8.3a")
  CC_aarch64-apple-darwin = None
  CC_aarch64_apple_darwin = None
  HOST_CC = None
  CC = None
  CFLAGS_aarch64-apple-darwin = None
  CFLAGS_aarch64_apple_darwin = None
  HOST_CFLAGS = None
  CFLAGS = None
  CRATE_CC_NO_DEFAULTS = None
  CARGO_CFG_TARGET_FEATURE = Some("aes,crc,crypto,dpb,fcma,fp,fp16,jsconv,lse,neon,ras,rcpc,rdm,sha2,v8.1a,v8.2a,v8.3a")
  CC_aarch64-apple-darwin = None
  CC_aarch64_apple_darwin = None
  HOST_CC = None
  CC = None
  CFLAGS_aarch64-apple-darwin = None
  CFLAGS_aarch64_apple_darwin = None
  HOST_CFLAGS = None
  CFLAGS = None
  CRATE_CC_NO_DEFAULTS = None
  CARGO_CFG_TARGET_FEATURE = Some("aes,crc,crypto,dpb,fcma,fp,fp16,jsconv,lse,neon,ras,rcpc,rdm,sha2,v8.1a,v8.2a,v8.3a")
  running: "cc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-arch" "arm64" "-I" "webview.h" "-Wall" "-Wextra" "-x" "objective-c" "-std=c11" "-w" "-DDEBUG" "-DOBJC_OLD_DISPATCH_PROTOTYPES=1" "-o" "~/server/target/debug/build/webview-sys-90d3225d97425bce/out/webview_cocoa.o" "-c" "webview_cocoa.c"

. . . loads of errors related to the objc_msgSend signature. . .


  cargo:warning=webview_cocoa.c:185:43: error: too many arguments to function call, expected 0, have 2
  cargo:warning=                   id path = objc_msgSend(url, sel_registerName("path"));
  cargo:warning=                             ~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  cargo:warning=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/objc/message.h:63:1: note: 'objc_msgSend' declared here
  cargo:warning=objc_msgSend(void /* id self, SEL op, ... */ )
  cargo:warning=^
  cargo:warning=webview_cocoa.c:181:16: error: too many arguments to function call, expected 0, have 3
  cargo:warning=  objc_msgSend(savePanel, sel_registerName("beginWithCompletionHandler:"),
  cargo:warning=  ~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  cargo:warning=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/objc/message.h:63:1: note: 'objc_msgSend' declared here
  cargo:warning=objc_msgSend(void /* id self, SEL op, ... */ )
  cargo:warning=^
  cargo:warning=fatal error: too many errors emitted, stopping now [-ferror-limit=]
  cargo:warning=20 errors generated.
  exit status: 1

  --- stderr


  error occurred: Command "cc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-arch" "arm64" "-I" "webview.h" "-Wall" "-Wextra" "-x" "objective-c" "-std=c11" "-w" "-DDEBUG" "-DOBJC_OLD_DISPATCH_PROTOTYPES=1" "-o" "~/server/target/debug/build/webview-sys-90d3225d97425bce/out/webview_cocoa.o" "-c" "webview_cocoa.c" with args "cc" did not execute successfully (status code exit status: 1).
@gaoxiaojun
Copy link

me too

@svenpaulsen
Copy link
Contributor

OBJC_OLD_DISPATCH_PROTOTYPES is ignored on ARM based Macs on purpose. I've addressed this in #294.

@brandonros
Copy link

For anyone else: crates.rs 0.7.3 version does not have this patch https://crates.io/crates/web-view

Instead do this in Cargo.toml:

[dependencies]
web-view = { git = "https://github.com/Boscop/web-view", ref = "e87e08cab3a2d500d54068ec9c7aaa055a711465" }

If somebody wanted to kick off a 0.7.4 release if there was time with that latest Mac ARM64 patch... thank you very much for doing it! awesome package nevertheless!

@nothingismagick
Copy link
Contributor

Hey @brandonros - seems like you're visiting a project that has mostly stalled. Over at tauri, we used this lib for a while, but then moved to the webview project, and finally decided to just bite the bullet and write our own full bindings in rust.

Please consider https://github.com/tauri-apps/wry to be the "spiritual successor" if not exactly the replacement for this repository here.

And the framework that consumes wry is called tauri, and comes with a bunch of APIs and a bundler and a whole system to get your project moving really quickly.

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

No branches or pull requests

5 participants