REOPENED 229241
[CMake] Mac JSC fails to build because of undefined JSC_API_AVAILABLE macro
https://bugs.webkit.org/show_bug.cgi?id=229241
Summary [CMake] Mac JSC fails to build because of undefined JSC_API_AVAILABLE macro
qz
Reported 2021-08-18 11:25:26 PDT
If __APPLE__ is defined, WebKitAvailability.h includes AvailabilityMacros.h and CoreFoundation/CoreFoundation.h but fails to define JSC_API_AVAILABLE and it breaks build with errors like: JSValueRef.h:205:112: error: expected function body after function declarator Problem is solved by adding #define JSC_API_AVAILABLE(...) under #ifdef __APPLE__ in WebkitAvailability.h
Attachments
build log (184.25 KB, text/plain)
2021-08-20 05:47 PDT, qz
no flags
recording of shell commands (10.92 KB, application/octet-stream)
2021-08-20 20:10 PDT, qz
no flags
Alexey Proskuryakov
Comment 1 2021-08-18 17:18:15 PDT
JSC_API_AVAILABLE is only present in WebKit source code, and not in Xcode SDK, where it's replaced with API_AVAILABLE. If you are building your project using headers in WebKit source, this is not supported, and is expected to fail. If you are doing something different, please clarify what it is, and how we can reproduce.
qz
Comment 2 2021-08-19 10:28:52 PDT
I'm using build-webkit --debug on cloned repo as said in https://webkit.org/building-webkit/ If there's special build procedure on OSX where is it documented?
Alexey Proskuryakov
Comment 3 2021-08-19 12:58:55 PDT
No, this is the correct procedure. Not sure what can go wrong then, we build like this continuously on the bots. Could you please attach a complete build log (everything starting from the command you run, copy/paste it all into a file)? Please also specify your macOS and Xcode versions.
qz
Comment 4 2021-08-20 05:47:37 PDT
Created attachment 435975 [details] build log
qz
Comment 5 2021-08-20 05:48:06 PDT
XCode - Version 12.5.1 (12E507) OSX - Version 11.5.2
Alexey Proskuryakov
Comment 6 2021-08-20 10:44:43 PDT
The attachment does not show how you started the build, but it is clear from the log that it's building with CMake. I don't know how `build-webkit --debug` can do that, but in any case the Mac CMake build is unofficial, and is not verified by any CI bots. I don't see postprocess-header-rule anywhere in the build log, so CMake must be failing to invoke it. This is the script that replaces JSC_API_AVAILABLE with API_AVAILABLE.
qz
Comment 7 2021-08-20 20:10:48 PDT
Created attachment 436057 [details] recording of shell commands Log file is produced using this command: Tools/Scripts/build-webkit --jsc-only --debug > build.log CMake (and it being unofficial) is not mentioned anywhere in https://webkit.org/building-webkit/ How do I go with official way to build WebKit? I'm attaching recording of shell commands just in case..
Alexey Proskuryakov
Comment 8 2021-08-23 09:11:41 PDT
I suspect that the "--jsc-only" option switches the build to CMake for some reason. This problem shouldn't happen if you don't add this option. I CC'ed some people who fixed this build style in the past, they can comment if they still care - otherwise we should just remove this option.
Konstantin Tokarev
Comment 9 2021-08-23 09:19:39 PDT
JSCOnly is a separate WebKit port that aims to build JSC as a portable library and interperter with minimal possible dependencies. It uses CMake for its build system. If you want to build JavaScriptCore.framework similar to one shipped in macOS, I guess you should use build-jsc script instead which should build jsc target of Apple port.
Note You need to log in before you can comment on or make changes to this bug.