<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>278858</bug_id>
          
          <creation_ts>2024-08-29 07:46:39 -0700</creation_ts>
          <short_desc>[GTK] [2.45.91] Fails to build in armhf: expected identifier before numeric constant</short_desc>
          <delta_ts>2025-02-26 02:11:45 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebKitGTK</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Alberto Garcia">berto</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>bugs-noreply</cc>
    
    <cc>cgarcia</cc>
    
    <cc>dpino</cc>
    
    <cc>mcatanzaro</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2056258</commentid>
    <comment_count>0</comment_count>
    <who name="Alberto Garcia">berto</who>
    <bug_when>2024-08-29 07:46:39 -0700</bug_when>
    <thetext>This is the error message:

In file included from /usr/include/X11/Xlib.h:44,
                 from Source/WebKit/UIProcess/gtk/PointerLockManagerX11.cpp:32:
build-soup3/bmalloc/Headers/bmalloc/EligibilityResult.h:35:5: error: expected identifier before numeric constant
   35 |     Success,
      |     ^~~~~~~
build-soup3/bmalloc/Headers/bmalloc/EligibilityResult.h:35:5: error: expected ‘}’ before numeric constant


I think that the &apos;Success&apos; macro in X11/X.h conflicts with the same value in the EligibilityKind enum:

https://gitlab.freedesktop.org/xorg/proto/xorgproto/-/blob/xorgproto-2024.1/include/X11/X.h?ref_type=tags#L350

https://github.com/WebKit/WebKit/blob/webkitgtk-2.45.91/Source/bmalloc/bmalloc/EligibilityResult.h#L35

I haven&apos;t investigated yet why this is not happening in other architectures.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2056545</commentid>
    <comment_count>1</comment_count>
    <who name="Alberto Garcia">berto</who>
    <bug_when>2024-08-30 06:58:52 -0700</bug_when>
    <thetext>FWIW I can work around this by using the system malloc in this build.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2061455</commentid>
    <comment_count>2</comment_count>
    <who name="Alberto Garcia">berto</who>
    <bug_when>2024-09-19 07:43:15 -0700</bug_when>
    <thetext>Disabling bmalloc seems to be causing problems on armhf, see bug 279883

I managed to fix the build by changing the order of the Xlib.h include, but I still haven&apos;t checked why other architectures are not affected:

--- a/Source/WebKit/UIProcess/gtk/PointerLockManagerX11.cpp
+++ b/Source/WebKit/UIProcess/gtk/PointerLockManagerX11.cpp
@@ -29,10 +29,10 @@
 #if PLATFORM(X11)
 
 #include &quot;WebPageProxy.h&quot;
-#include &lt;X11/Xlib.h&gt;
 #include &lt;gtk/gtk.h&gt;
 #include &lt;wtf/TZoneMallocInlines.h&gt;
 #include &lt;wtf/glib/GRefPtr.h&gt;
+#include &lt;X11/Xlib.h&gt;
 
 #if USE(GTK4)
 #include &lt;gdk/x11/gdkx.h&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2061461</commentid>
    <comment_count>3</comment_count>
    <who name="Alberto Garcia">berto</who>
    <bug_when>2024-09-19 08:01:21 -0700</bug_when>
    <thetext>And this is almost certainly the commit that introduced this build failure:

https://commits.webkit.org/282294@main

(the changes to PointerLockManagerX11.cpp)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2064163</commentid>
    <comment_count>4</comment_count>
    <who name="Diego Pino">dpino</who>
    <bug_when>2024-09-29 23:44:49 -0700</bug_when>
    <thetext>This a common error that happens when a header defining &apos;Success&apos; collides with &apos;Xlib.h&apos;, which includes &apos;X11/X.h&apos; which defines Success.
 
One way of solving is undefining &apos;Success&apos; before including &apos;Xlib.h&apos;:

```
#ifdef Success
#undef Success
#endif
```

Another way of solving it is by adding the .c source file that triggers the inclusion of headers until the collide happens as no-unify. In this case, the file would be &apos;UIProcess/gtk/PointerLockManagerX11.cpp&apos;, but that file is already marked as no-unify: https://github.com/webkit/webkit/blob/main/Source/WebKit/SourcesGTK.txt#L283, so this solution won&apos;t work in your case.

It seems that right now there&apos;s no code in WebKit codebase that uses the former solution (undefining Success). So, if rearranging the order of the header fixes the issue I would go for that solution. Perhaps adding a comment explaining why &apos;Xlib.h&apos; has to go after &apos;TZoneMallocInlines.h&apos;.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2070032</commentid>
    <comment_count>5</comment_count>
      <attachid>473016</attachid>
    <who name="Alberto Garcia">berto</who>
    <bug_when>2024-10-23 03:30:46 -0700</bug_when>
    <thetext>Created attachment 473016
Patch

FYI this is the patch that I&apos;m using downstream in Debian, I don&apos;t have time to create a merge request right now but feel free to take this patch if you think it&apos;s appropriate.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2098192</commentid>
    <comment_count>6</comment_count>
    <who name="Alberto Garcia">berto</who>
    <bug_when>2025-02-26 02:11:45 -0800</bug_when>
    <thetext>This doesn&apos;t seem to be necessary anymore in 2.47.90, so we can close this issue.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>473016</attachid>
            <date>2024-10-23 03:30:46 -0700</date>
            <delta_ts>2024-10-23 03:30:46 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>278858.diff</filename>
            <type>text/plain</type>
            <size>672</size>
            <attacher name="Alberto Garcia">berto</attacher>
            
              <data encoding="base64">ZGlmZiAtLWdpdCBhL1NvdXJjZS9XZWJLaXQvVUlQcm9jZXNzL2d0ay9Qb2ludGVyTG9ja01hbmFn
ZXJYMTEuY3BwIGIvU291cmNlL1dlYktpdC9VSVByb2Nlc3MvZ3RrL1BvaW50ZXJMb2NrTWFuYWdl
clgxMS5jcHAKaW5kZXggZTFkMzVkNGEzODA4Li5iMzZhNTQxN2RhYmQgMTAwNjQ0Ci0tLSBhL1Nv
dXJjZS9XZWJLaXQvVUlQcm9jZXNzL2d0ay9Qb2ludGVyTG9ja01hbmFnZXJYMTEuY3BwCisrKyBi
L1NvdXJjZS9XZWJLaXQvVUlQcm9jZXNzL2d0ay9Qb2ludGVyTG9ja01hbmFnZXJYMTEuY3BwCkBA
IC0yOSwxMSArMjksMTQgQEAKICNpZiBQTEFURk9STShYMTEpCiAKICNpbmNsdWRlICJXZWJQYWdl
UHJveHkuaCIKLSNpbmNsdWRlIDxYMTEvWGxpYi5oPgogI2luY2x1ZGUgPGd0ay9ndGsuaD4KICNp
bmNsdWRlIDx3dGYvVFpvbmVNYWxsb2NJbmxpbmVzLmg+CiAjaW5jbHVkZSA8d3RmL2dsaWIvR1Jl
ZlB0ci5oPgogCisvLyBTb21lIG9mIHRoZSBtYWNyb3MgaW4gWDExL1guaCBjb25mbGljdCB3aXRo
IGRlZmluaXRpb25zIGluIHRoZQorLy8gYm1hbGxvYyBjb2RlIHNvIHRoaXMgaW5jbHVkZSBtdXN0
IGNvbWUgYWZ0ZXIgdGhlbSAoIzI3ODg1OCkuCisjaW5jbHVkZSA8WDExL1hsaWIuaD4KKwogI2lm
IFVTRShHVEs0KQogI2luY2x1ZGUgPGdkay94MTEvZ2RreC5oPgogI2Vsc2UK
</data>

          </attachment>
      

    </bug>

</bugzilla>