1

I want to build the new Qt5.10.0 version from source for my macOS with version 10.12.6 (Sierra).

These errors occurred at the end of the build process:

qwebview_darwin.mm:261:24: error:
'loadFileURL:allowingReadAccessToURL:' is only available on macOS 10.11
or newer
[-Werror,-Wunguarded-availability]
[wkWebView loadFileURL:url.toNSURL()
                   ^~~~~~~~~~~~~~~~~~~~~~~~~

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/WebKit.framework/Headers/WKWebView.h:102:1: 
note: 
'loadFileURL:allowingReadAccessToURL:' has been explicitly marked
partial here
- (nullable WKNavigation *)loadFileURL:(NSURL *)URL allowingReadAccessToURL:(NSURL *)readAccessURL API_AVAILAB...
^
qwebview_darwin.mm:261:24: note: enclose
'loadFileURL:allowingReadAccessToURL:' in an @available check to
silence this warning

[wkWebView loadFileURL:url.toNSURL()


                   ^~~~~~~~~~~~~~~~~~~~~~~~~

1 error generated.
make[4]: *** [.obj/debug/qwebview_darwin.o] Error 1
make[3]: *** [debug-install] Error 2
make[2]: *** [sub-webview-install_subtargets] Error 2
make[1]: *** [sub-src-install_subtargets] Error 2
make: *** [module-qtwebview-install_subtargets] Error 2

Maybe you have some tricks to handle this error. Do you know, what i have to do? And how to bypass these errors?

czm35388
  • 11
  • 2

2 Answers2

1

According to this report on the Qt bug tracker this appears to be fixed in 5.10.1 (and also 5.9.4), so pulling the new version should solve your and my problem without having to edit the Qt source

I can now confirm that the code in 5.10.1 is now guarded by

if (__builtin_available(macOS 10.11, iOS 9, *)) {
0

Enclose the call to loadFileURL in an @available check, like the following

if (@available(macOS 10.11, *)) {
    [wkWebView loadFileURL:url.toNSURL() allowingReadAccessToURL:QUrl(url.toString(QUrl::RemoveFilename)).toNSURL()];
}
kindoblue
  • 151
  • 1
  • 7