Opened 4 years ago

Closed 4 years ago

#16329 closed build error (fixed)

wxwidgets doesn't build on Mac OS 10.10

Reported by: opoku Owned by: csomor
Priority: normal Milestone: 3.0.3
Component: wxOSX Version: 3.0.1
Keywords: Cc: fred.wang@…
Blocked By: Blocking:
Patch: yes

Description

Build error
./src/osx/webview_webkit.mm:936:25: error: cannot initialize a variable of type 'WebBackForwardList *' with an rvalue of type 'WKBackForwardList *'

WebBackForwardList* history = [m_webView backForwardList];

~

./src/osx/webview_webkit.mm:954:25: error: cannot initialize a variable of type 'WebBackForwardList *' with an rvalue of type 'WKBackForwardList *'

WebBackForwardList* history = [m_webView backForwardList];

~

2 errors generated.
make: * [webviewdll_osx_webview_webkit.o] Error 1

Full build log found here

https://gist.github.com/anonymous/800433ba97165afbc255

Attachments (2)

wx_webview.patch download (245 bytes) - added by opoku 4 years ago.
Patch for broken build in wx web view
0001-using-proper-types-for-webkit-variants-see-16329.patch download (5.7 KB) - added by vadz 4 years ago.
Patch for 3.0 branch

Download all attachments as: .zip

Change History (24)

comment:1 Changed 4 years ago by Dom_T4

  • Version changed from 3.0.0 to 3.0.1

Same issue as above. Perhaps expected at this point in 10.10.

My final readout:

./src/osx/webview_webkit.mm:392:30: warning: incompatible pointer types sending
      'WebViewUIDelegate *' to parameter of type 'id<WKUIDelegate>'
      [-Wincompatible-pointer-types]
    [m_webView setUIDelegate:uiDelegate];
                             ^~~~~~~~~~
./src/osx/webview_webkit.mm:464:34: warning: 'WKPreferences' may not respond to
      'setUsesPageCache:'
        [[m_webView preferences] setUsesPageCache:NO];
         ~~~~~~~~~~~~~~~~~~~~~~~ ^
./src/osx/webview_webkit.mm:466:34: warning: 'WKPreferences' may not respond to
      'setUsesPageCache:'
        [[m_webView preferences] setUsesPageCache:YES];
         ~~~~~~~~~~~~~~~~~~~~~~~ ^
./src/osx/webview_webkit.mm:936:25: error: cannot initialize a variable of type
      'WebBackForwardList *' with an rvalue of type 'WKBackForwardList *'
    WebBackForwardList* history = [m_webView backForwardList];
                        ^         ~~~~~~~~~~~~~~~~~~~~~~~~~~~
./src/osx/webview_webkit.mm:954:25: error: cannot initialize a variable of type
      'WebBackForwardList *' with an rvalue of type 'WKBackForwardList *'
    WebBackForwardList* history = [m_webView backForwardList];
                        ^         ~~~~~~~~~~~~~~~~~~~~~~~~~~~
3 warnings and 2 errors generated.
make: *** [webviewdll_osx_webview_webkit.o] Error 1

comment:2 Changed 4 years ago by vadz

This is strange, backForwardList is still documented as returning WebBackForwardList* in Apple documentation so I really don't know what's going on here. And WKBackForwardList can't even be found in the Apple docs at all (although it is in Webkit code).

Unfortunately I don't even have OS X 10.10 so I am not going to be able to do anything about this myself.

Changed 4 years ago by opoku

Patch for broken build in wx web view

comment:3 Changed 4 years ago by opoku

I figured out a fix. For 10.10, Apple migrated all the existing Webkit.h headers into a WebkitLegacy.h. Changing the header as shown below works fine but only for 10.10. However, it is obviously not a suitable patch to apply to the general code base because it doesn't target 10.10 specifically.

--- src/osx/webview_webkit.mm	
+++ ww_we.mm			
@@ -28,7 +28,7 @@
 #include "wx/hashmap.h"
 #include "wx/filesys.h"
 
-#include <WebKit/WebKit.h>
+#include <WebKit/WebKitLegacy.h>
 #include <WebKit/HIWebView.h>
 #include <WebKit/CarbonUtils.h>

Ideally, there is some 10.10 specific #define that can be used. An example is shown below. Unfortunately, I wasn't able to figure out an appropriate #define to use here. Maybe someone else can suggest something appropriate.

--- src/osx/webview_webkit.mm	
+++ ww_we.mm			
@@ -28,7 +28,7 @@
 #include "wx/hashmap.h"
 #include "wx/filesys.h"
 
-#include <WebKit/WebKit.h>
+#ifdef _FAKE_DEFINE_MAC_YOSEMITE_
+#include <WebKit/WebKitLegacy.h>
+#else
+#include <WebKit/WebKit.h>
+#endif
 #include <WebKit/HIWebView.h>
 #include <WebKit/CarbonUtils.h>
 

comment:4 Changed 4 years ago by plorkyeran

#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 101000 should be the correct check.

Last edited 4 years ago by plorkyeran (previous) (diff)

comment:5 Changed 4 years ago by csomor

  • Owner set to csomor
  • Status changed from new to accepted

comment:6 Changed 4 years ago by csomor

strange, are you sure you are building against the correct and current 10.10 SDK of an XCode distribution ? My Webkit/Webkit.h does include all WK headers and a WebKitLegacy.h at the end ?

so use --with-macosx-sdk and direct to the SDK in the XCode6 Beta

you shouldn't use folders of the system itself, always use the SDK

comment:7 Changed 4 years ago by csomor

btw: if you build by a script use things like

xcrun --sdk macosx --show-sdk-path to retrieve the correct path for --with-macosx-sdk

and sudo xcode-select -s PATH_TO_XCODE_DEVELOPER_FOLDER to set the correct xcode version

Last edited 4 years ago by csomor (previous) (diff)

comment:8 Changed 4 years ago by csomor

  • Status changed from accepted to infoneeded

comment:9 Changed 4 years ago by opoku

  • Status changed from infoneeded to accepted

You are correct. The Webkit.h header also includes WebkitLegacy.h. This is the case both in the system framework header and the header in the SDK.

However, the m_webView object is defined as id in the source and, while I'm not completely sure exactly what the compiler does with this type information, it seems to use the first matching method of any object based on the order of occurrence in the header.

This first matching method just so happens to return a WKBackForwardList instead of the WebBackForwardList object that would actually be returned at runtime since the m_webView is in fact a WebView and not a WKWebView.

comment:10 Changed 4 years ago by SC

In 76743:

using proper types for webkit variants, see #16329

comment:11 Changed 4 years ago by SC

In 76744:

fixes 64 bit to 32 warnings, see #16329

comment:12 Changed 4 years ago by csomor

although in my Xcode builds I only got warnings but no errors, I've changed the types to proper cocoa instance ptrs, so things should not create warnings anymore. Could you please retest? Thanks

comment:13 Changed 4 years ago by VZ

In 77698:

fixes 64 bit to 32 warnings, see #16329

comment:14 Changed 4 years ago by historic_bruno

I've tested a patch based on r76743 applied to wxWidgets 3.0.2 and was able to build on both Yosemite and Lion with no errors.

comment:15 Changed 4 years ago by frederic_wang

  • Cc fred.wang@… added

comment:16 Changed 4 years ago by frederic_wang

FWIW, I just tested on Yosemite ; the stable release has the build error but not the development version. So I guess this bug can be closed.

Changed 4 years ago by vadz

Patch for 3.0 branch

comment:17 Changed 4 years ago by vadz

  • Milestone set to 3.0.3
  • Patch set

Could someone please test attachment:0001-using-proper-types-for-webkit-variants-see-16329.patch under 10.10 and check if it works? I'd like to fix this in 3.0.3.

TIA!

comment:18 Changed 4 years ago by frederic_wang

I can try, but I'm a bit confused as I thought this was fixed on trunk. Which version of wxwidgets do you want me to apply the patch?

comment:19 Changed 4 years ago by vadz

3.0.2 (where it still doesn't work). Thanks!

comment:20 Changed 4 years ago by frederic_wang

OK, the patch seems to work for me.

comment:21 Changed 4 years ago by lanurmi

I also confirm that the patch fixes compilation on 10.10 when applied to 3.0.2.

comment:22 Changed 4 years ago by Vadim Zeitlin <vadim@…>

  • Resolution set to fixed
  • Status changed from accepted to closed

In 2a13ad64d85213846147c31f095e7b419487f677/git-wxWidgets:

Fix wxOSX build under 10.10.

Use proper types for webkit variants.

Closes #16329.

Note: See TracTickets for help on using tickets.