RESOLVED FIXED 152625
WebKit fails to build with musl libc library
https://bugs.webkit.org/show_bug.cgi?id=152625
Summary WebKit fails to build with musl libc library
Khem Raj
Reported 2015-12-31 14:00:22 PST
when building webkit2 with musl C library we end up with compile errors due to assumptions that C library for Linux is always glibc and it works with uclibc since uclibc pretends to be glibc in so many cases. However this breaks when we use musl C library for system C library on Linux. Errors like /home/ubuntu/work/oe/openembedded-core/build/tmp-musl/sysroots/qemuarm/usr/include/c++/5.3.0/arm-oe-linux-musleabi/bits/ctype_inline.h:68:29: error: 'isspace_WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h' was not declared in this scope __testis = isspace(__c); show up
Attachments
Patch to fix build errors on musl (2.69 KB, patch)
2015-12-31 14:04 PST, Khem Raj
no flags
updated patch (3.67 KB, patch)
2015-12-31 17:05 PST, Khem Raj
dbates: review-
dbates: commit-queue-
patch v3 (5.79 KB, patch)
2016-01-02 14:52 PST, Khem Raj
dbates: review+
dbates: commit-queue-
patch v4 (6.01 KB, patch)
2016-01-03 10:47 PST, Khem Raj
no flags
Khem Raj
Comment 1 2015-12-31 14:04:32 PST
Created attachment 268056 [details] Patch to fix build errors on musl Proposed fix.
Alexey Proskuryakov
Comment 2 2015-12-31 16:09:58 PST
Comment on attachment 268056 [details] Patch to fix build errors on musl View in context: https://bugs.webkit.org/attachment.cgi?id=268056&action=review > Source/WebCore/platform/linux/MemoryPressureHandlerLinux.cpp:204 > ReliefLogger log("Run malloc_trim"); Shouldn't this be inside the ifdef? Otherwise, it's not telling the truth.
Khem Raj
Comment 3 2015-12-31 17:05:54 PST
Created attachment 268060 [details] updated patch Addresses review comments and additionally also makes sure that backtrace)() API is limited to glibc/uclibc only.
Daniel Bates
Comment 4 2015-12-31 17:49:01 PST
Thank you Khem Raj for the patch. Although the change looks reasonable it cannot be landed because it is missing a ChangeLog entry. Please use either script prepare-ChangeLog or webkit-patch to generate a template ChangeLog entry. See <https://webkit.org/contributing-code/#changelogs> for more details, including an example of a well-written ChangeLog entry.
Khem Raj
Comment 5 2016-01-02 14:52:57 PST
Created attachment 268112 [details] patch v3 This adds ChangeLog entries as suggested by Daniel
WebKit Commit Bot
Comment 6 2016-01-02 14:54:35 PST
Attachment 268112 [details] did not pass style-queue: ERROR: Source/WTF/ChangeLog:8: Need whitespace between colon and description [changelog/filechangedescriptionwhitespace] [5] ERROR: Source/WTF/ChangeLog:13: Need whitespace between colon and description [changelog/filechangedescriptionwhitespace] [5] Total errors found: 2 in 7 files If any of these errors are false positives, please file a bug against check-webkit-style.
Daniel Bates
Comment 7 2016-01-02 21:19:57 PST
Comment on attachment 268112 [details] patch v3 View in context: https://bugs.webkit.org/attachment.cgi?id=268112&action=review > Source/JavaScriptCore/ChangeLog:4 > + https://bugs.webkit.org/show_bug.cgi?id=152625 > + qualify isnan() calls with std namespace. This ChangeLog entry does not conform to the format described in <https://webkit.org/contributing-code/#changelogs>. In particular, these two lines should be the bug title and bug URL in that order. The description (line 4) should be placed under the Reviewed by line and begin with a capital letter (Q). We should also explain in the description that the motivation of this change is to fix the build when building with the musl libc library on Linux. I also suggest that we omit the description of Option::operator== (line 9) because this ChangeLog only describes a change to a single function, Option::operator==, and the change description for Option::operator== (line 9) is almost the same as the description (line 4). Making the above changes, we have: 2016-01-02 Khem Raj <raj.khem@gmail.com> WebKit fails to build with musl libc library https://bugs.webkit.org/show_bug.cgi?id=152625 Reviewed by Daniel Bates. Qualify isnan() calls with std namespace to fix the build when building with the musl libc library on Linux. * runtime/Options.cpp: (Option::operator==): > Source/WTF/ChangeLog:4 > + Disable ctype.h check for musl C library on Linux. Similar to my remarks for the ChangeLog entry in Source/JavaScriptCore/ChangeLog, please move this description under the Reviewed by line, change line 3 to the the bug title ("WebKit fails to build with musl libc library") and change line 4 to be bug URL (https://bugs.webkit.org/show_bug.cgi?id=152625). > Source/WTF/ChangeLog:8 > + * wtf/DisallowCType.h Please add a colon character (:) at the end of this line to fix the style bot warning (*): ERROR: Source/WTF/ChangeLog:8: Need whitespace between colon and description [changelog/filechangedescriptionwhitespace] [5] (*) This error message is disingenuous. The actual error is that there is no colon character after the filename. We should teach the style bot to detect the omission of the ':' and provide a better error message. This work should be done in a separate bug. > Source/WTF/ChangeLog:10 > + Enable backtrace on linux when using glibc linux => Linux Please add a period to the end of this sentence. (These are very small issues. As part of addressing the bug title/description corrections I suggest we also make these changes). > Source/WTF/ChangeLog:11 > + We dont have backtrace() implemented on non-glibc libc's on Linux. dont => don't (This is a very small issue. As part of addressing the bug title/description corrections I suggest we also make this change). > Source/WTF/ChangeLog:13 > + * wtf/Assertions.cpp Please add a colon character (:) at the end of this line to fix the style bot warning (*): ERROR: Source/WTF/ChangeLog:13: Need whitespace between colon and description [changelog/filechangedescriptionwhitespace] [5] > Source/WTF/wtf/Assertions.cpp:71 > +#if OS(DARWIN) || (OS(LINUX) && defined(__GLIBC__) && !defined(__UCLIBC__)) For completeness, we must explicitly check for !defined(__UCLIBC__) (i.e. cannot check OS(LINUX) && defined(__GLIBC__)) because uClibc usually defines __GLIBC__ when being compiled per <https://git.uclibc.org/uClibc/tree/include/features.h?id=266bdc1f623fe6fe489e5115e0f8ef723705d949>. The criterion for defining __GLIBC__ and the motivation for doing so is described at <https://git.uclibc.org/uClibc/tree/include/features.h?id=266bdc1f623fe6fe489e5115e0f8ef723705d949#n81> and <https://git.uclibc.org/uClibc/tree/include/features.h?id=266bdc1f623fe6fe489e5115e0f8ef723705d949#n376>. On another note, the musl libc project does not expose any preprocessor macros to identify the use of the musl libc library during compilation as a matter of policy (http://wiki.musl-libc.org/wiki/FAQ#Q:_why_is_there_no_MUSL_macro_.3F).
Daniel Bates
Comment 8 2016-01-02 21:20:45 PST
Comment on attachment 268112 [details] patch v3 View in context: https://bugs.webkit.org/attachment.cgi?id=268112&action=review > Source/WebCore/ChangeLog:4 > + https://bugs.webkit.org/show_bug.cgi?id=152625 > + malloc_trim is glibc specific API so guard it with __GLIBC__. Similar to my remarks for the ChangeLog entry in Source/JavaScriptCore/ChangeLog and Source/WTF/ChangeLog, please move this description under the Reviewed by line, change line 3 to the the bug title ("WebKit fails to build with musl libc library") and change line 4 to be bug URL (https://bugs.webkit.org/show_bug.cgi?id=152625).
Khem Raj
Comment 9 2016-01-03 10:27:34 PST
(In reply to comment #7) > Comment on attachment 268112 [details] > patch v3 > > View in context: > https://bugs.webkit.org/attachment.cgi?id=268112&action=review > > > Source/JavaScriptCore/ChangeLog:4 > > + https://bugs.webkit.org/show_bug.cgi?id=152625 > > + qualify isnan() calls with std namespace. > > This ChangeLog entry does not conform to the format described in > <https://webkit.org/contributing-code/#changelogs>. In particular, these two > lines should be the bug title and bug URL in that order. The description > (line 4) should be placed under the Reviewed by line and begin with a > capital letter (Q). We should also explain in the description that the > motivation of this change is to fix the build when building with the musl > libc library on Linux. I also suggest that we omit the description of > Option::operator== (line 9) because this ChangeLog only describes a change > to a single function, Option::operator==, and the change description for > Option::operator== (line 9) is almost the same as the description (line 4). > Making the above changes, we have: > > 2016-01-02 Khem Raj <raj.khem@gmail.com> > > WebKit fails to build with musl libc library > https://bugs.webkit.org/show_bug.cgi?id=152625 > > Reviewed by Daniel Bates. > > Qualify isnan() calls with std namespace to fix the build when > building with the musl libc library on Linux. > > * runtime/Options.cpp: > (Option::operator==): > > > Source/WTF/ChangeLog:4 > > + Disable ctype.h check for musl C library on Linux. > > Similar to my remarks for the ChangeLog entry in > Source/JavaScriptCore/ChangeLog, please move this description under the > Reviewed by line, change line 3 to the the bug title ("WebKit fails to build > with musl libc library") and change line 4 to be bug URL > (https://bugs.webkit.org/show_bug.cgi?id=152625). > > > Source/WTF/ChangeLog:8 > > + * wtf/DisallowCType.h > > Please add a colon character (:) at the end of this line to fix the style > bot warning (*): > > ERROR: Source/WTF/ChangeLog:8: Need whitespace between colon and > description [changelog/filechangedescriptionwhitespace] [5] > > (*) This error message is disingenuous. The actual error is that there is no > colon character after the filename. We should teach the style bot to detect > the omission of the ':' and provide a better error message. This work should > be done in a separate bug. > > > Source/WTF/ChangeLog:10 > > + Enable backtrace on linux when using glibc > > linux => Linux > > Please add a period to the end of this sentence. > > (These are very small issues. As part of addressing the bug > title/description corrections I suggest we also make these changes). > > > Source/WTF/ChangeLog:11 > > + We dont have backtrace() implemented on non-glibc libc's on Linux. > > dont => don't > > (This is a very small issue. As part of addressing the bug title/description > corrections I suggest we also make this change). > > > Source/WTF/ChangeLog:13 > > + * wtf/Assertions.cpp > > Please add a colon character (:) at the end of this line to fix the style > bot warning (*): > > ERROR: Source/WTF/ChangeLog:13: Need whitespace between colon and > description [changelog/filechangedescriptionwhitespace] [5] > > > Source/WTF/wtf/Assertions.cpp:71 > > +#if OS(DARWIN) || (OS(LINUX) && defined(__GLIBC__) && !defined(__UCLIBC__)) > > For completeness, we must explicitly check for !defined(__UCLIBC__) (i.e. > cannot check OS(LINUX) && defined(__GLIBC__)) because uClibc usually defines > __GLIBC__ when being compiled per > <https://git.uclibc.org/uClibc/tree/include/features. > h?id=266bdc1f623fe6fe489e5115e0f8ef723705d949>. The criterion for defining > __GLIBC__ and the motivation for doing so is described at > <https://git.uclibc.org/uClibc/tree/include/features. > h?id=266bdc1f623fe6fe489e5115e0f8ef723705d949#n81> and > <https://git.uclibc.org/uClibc/tree/include/features. > h?id=266bdc1f623fe6fe489e5115e0f8ef723705d949#n376>. > > On another note, the musl libc project does not expose any preprocessor > macros to identify the use of the musl libc library during compilation as a > matter of policy > (http://wiki.musl-libc.org/wiki/FAQ#Q:_why_is_there_no_MUSL_macro_.3F). backtrace() is not implemented on uclibc as well. So this fix also fixes uclibc builds
Khem Raj
Comment 10 2016-01-03 10:47:27 PST
Created attachment 268143 [details] patch v4
WebKit Commit Bot
Comment 11 2016-01-03 12:26:23 PST
Comment on attachment 268143 [details] patch v4 Clearing flags on attachment: 268143 Committed r194518: <http://trac.webkit.org/changeset/194518>
WebKit Commit Bot
Comment 12 2016-01-03 12:26:29 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.