naqvis / webview

Crystal bindings to Webview library
MIT License
93 stars 8 forks source link

Problem installing Webview Shard on Mac #7

Closed serge-hulne closed 2 years ago

serge-hulne commented 2 years ago

Problem installing Webview for Crystal on Mac (shard)

When running shards install, I get the following error message:

of webview: make Failed postinstall of webview on make: c++ -c -o ext/webview.o -DWEBVIEW_COCOA=1 -DOBJC_OLD_DISPATCH_PROTOTYPES=1 -std=c++11 ext/webview.cc In file included from ext/webview.cc:2: ext/webview.h:576:10: error: no matching function for call to 'objc_msgSend' return objc_msgSend("NSString"_cls, "stringWithUTF8String:"_sel, s); ^~~~~~~~~~~~ /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/objc/message.h:63:1: note: candidate function not viable: requires 0 arguments, but 3 were provided objc_msgSend(void /* id self, SEL op, ... */ ) ^ In file included from ext/webview.cc:2: ext/webview.h:576:10: error: cannot initialize return object of type 'id' (aka 'objc_object *') with an rvalue of type 'void' return objc_msgSend("NSString"_cls, "stringWithUTF8String:"_sel, s); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ext/webview.h:583:14: error: no matching function for call to 'objc_msgSend' id app = objc_msgSend("NSApplication"_cls, "sharedApplication"_sel); ^~~~~~~~~~~~ /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/objc/message.h:63:1: note: candidate function not viable: requires 0 arguments, but 2 were provided objc_msgSend(void /* id self, SEL op, ... */ ) ^ In file included from ext/webview.cc:2: ext/webview.h:583:8: error: cannot initialize a variable of type 'id' (aka 'objc_object *') with an rvalue of type 'void' id app = objc_msgSend("NSApplication"_cls, "sharedApplication"_sel); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ext/webview.h:584:5: error: no matching function for call to 'objc_msgSend' objc_msgSend(app, "setActivationPolicy:"_sel, ^~~~~~~~~~~~ /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/objc/message.h:63:1: note: candidate function not viable: requires 0 arguments, but 3 were provided objc_msgSend(void /* id self, SEL op, ... */ ) ^ In file included from ext/webview.cc:2: ext/webview.h:598:27: error: no matching function for call to 'objc_msgSend' objc_msgSend(msg, "body"_sel), "UTF8String"_sel)); ^~~~~~~~~~~~ /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/objc/message.h:63:1: note: candidate function not viable: requires 0 arguments, but 2 were provided objc_msgSend(void /* id self, SEL op, ... */ ) ^ In file included from ext/webview.cc:2: ext/webview.h:597:51: error: no matching function for call to 'objc_msgSend' w->on_message((const char *)objc_msgSend( ^~~~~~~~~~~~ /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/objc/message.h:63:1: note: candidate function not viable: requires 0 arguments, but 2 were provided objc_msgSend(void /* id self, SEL op, ... */ ) ^ In file included from ext/webview.cc:2: ext/webview.h:603:21: error: no matching function for call to 'objc_msgSend' auto delegate = objc_msgSend((id)cls, "new"_sel); ^~~~~~~~~~~~ /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/objc/message.h:63:1: note: candidate function not viable: requires 0 arguments, but 2 were provided objc_msgSend(void /* id self, SEL op, ... */ ) ^ In file included from ext/webview.cc:2: ext/webview.h:610:18: error: no matching function for call to 'objc_msgSend' m_window = objc_msgSend("NSWindow"_cls, "alloc"_sel); ^~~~~~~~~~~~ /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/objc/message.h:63:1: note: candidate function not viable: requires 0 arguments, but 2 were provided objc_msgSend(void /* id self, SEL op, ... */ ) ^ In file included from ext/webview.cc:2: ext/webview.h:610:18: error: assigning to 'id' (aka 'objc_object *') from incompatible type 'void' m_window = objc_msgSend("NSWindow"_cls, "alloc"_sel); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ext/webview.h:611:18: error: no matching function for call to 'objc_msgSend' m_window = objc_msgSend( ^~~~~~~~~~~~ /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/objc/message.h:63:1: note: candidate function not viable: requires 0 arguments, but 6 were provided objc_msgSend(void /* id self, SEL op, ... */ ) ^ In file included from ext/webview.cc:2: ext/webview.h:611:18: error: assigning to 'id' (aka 'objc_object *') from incompatible type 'void' m_window = objc_msgSend( ^~~~~~~~~~~~~ ext/webview.h:619:19: error: no matching function for call to 'objc_msgSend' auto config = objc_msgSend("WKWebViewConfiguration"_cls, "new"_sel); ^~~~~~~~~~~~ /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/objc/message.h:63:1: note: candidate function not viable: requires 0 arguments, but 2 were provided objc_msgSend(void /* id self, SEL op, ... */ ) ^ In file included from ext/webview.cc:2: ext/webview.h:621:17: error: no matching function for call to 'objc_msgSend' m_webview = objc_msgSend("WKWebView"_cls, "alloc"_sel); ^~~~~~~~~~~~ /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/objc/message.h:63:1: note: candidate function not viable: requires 0 arguments, but 2 were provided objc_msgSend(void /* id self, SEL op, ... */ ) ^ In file included from ext/webview.cc:2: ext/webview.h:621:17: error: assigning to 'id' (aka 'objc_object *') from incompatible type 'void' m_webview = objc_msgSend("WKWebView"_cls, "alloc"_sel); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ext/webview.h:625:20: error: no matching function for call to 'objc_msgSend' objc_msgSend("NSNumber"_cls, "numberWithBool:"_sel, 1), ^~~~~~~~~~~~ /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/objc/message.h:63:1: note: candidate function not viable: requires 0 arguments, but 3 were provided objc_msgSend(void /* id self, SEL op, ... */ ) ^ In file included from ext/webview.cc:2: ext/webview.h:639:5: error: no matching function for call to 'objc_msgSend' objc_msgSend(m_window, "setContentView:"_sel, m_webview); ^~~~~~~~~~~~ /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/objc/message.h:63:1: note: candidate function not viable: requires 0 arguments, but 3 were provided objc_msgSend(void /* id self, SEL op, ... */ ) ^ In file included from ext/webview.cc:2: ext/webview.h:640:5: error: no matching function for call to 'objc_msgSend' objc_msgSend(m_window, "makeKeyAndOrderFront:"_sel, nullptr); ^~~~~~~~~~~~ /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/objc/message.h:63:1: note: candidate function not viable: requires 0 arguments, but 3 were provided objc_msgSend(void /* id self, SEL op, ... */ ) ^ In file included from ext/webview.cc:2: ext/webview.h:646:5: error: no matching function for call to 'objc_msgSend' objc_msgSend("NSApp"_cls, "terminate:"_sel, nullptr); ^~~~~~~~~~~~ /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/objc/message.h:63:1: note: candidate function not viable: requires 0 arguments, but 3 were provided objc_msgSend(void /* id self, SEL op, ... */ ) ^ fatal error: too many errors emitted, stopping now [-ferror-limit=] 20 errors generated. make: *** [ext/webview.o] Error 1

naqvis commented 2 years ago

Updated webview.h to its latest version to fix the problem. Please use the updated version of this shard

serge-hulne commented 2 years ago

My aplogies. I was using a old version of the Xcode command line.