You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When building Chromium for 32-bit platforms (including x86 and armv7) using Clang 20 (llvmorg-20-init-1009-g7088a5ed-10), Clang reports errors in the hardware_buffer.h header provided by NDK:
../../third_party/llvm-build/Release+Asserts/bin/clang++ ... --target=i686-linux-android24 -m32 -mfpmath=sse -msse3 -std=c++20 --sysroot=../../third_party/android_toolchain/ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot -c ../../base/android/scoped_hardware_buffer_handle.cc
In file included from ../../base/android/scoped_hardware_buffer_handle.cc:7:
In file included from ../../base/android/android_hardware_buffer_compat.h:8:
../../third_party/android_toolchain/ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/android/hardware_buffer.h:322:42: error: expression is not an integral constant expression
322 | AHARDWAREBUFFER_USAGE_FRONT_BUFFER = 1UL << 32,
| ^~~~~~~~~
../../third_party/android_toolchain/ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/android/hardware_buffer.h:322:46: note: shift count 32 >= width of type 'unsigned long' (32 bits)
322 | AHARDWAREBUFFER_USAGE_FRONT_BUFFER = 1UL << 32,
| ^
1 error generated.
Clang 19 did not report this error, but as it stands the code 1UL << 32 is indeed invalid for 32-bit architectures.
Clang no longer reports errors once I patched it to 1ULL << 32.
Affected versions
r27
Canary version
No response
Host OS
Linux
Host OS version
Debian trixie/sid
Affected ABIs
armeabi-v7a, x86
Build system
Other (specify below)
Other build system
No response
minSdkVersion
24
Device API level
No response
The text was updated successfully, but these errors were encountered:
(see also the UINT*_C() and INT*_C() macros in <stdint.h> [https://pubs.opengroup.org/onlinepubs/009696899/basedefs/stdint.h.html] if you want simple advice for the API reviewers and/or want to stick with UL for LP64 and only change ILP32 to ULL in this case.)
This has already been fixed in Android, just not in r27, because r27 doesn't have a clang that new. Updating the sysroot after release is a pretty risky thing, and because of #2081 we know it would break things, so we can't do that.
This is only a problem for projects that are using a ToT clang without also using a ToT Android sysroot. If you need to do that, you should also be using an up-to-date sysroot. You can get one of those from ci.android.com. The "ndk" target of the "aosp-main" branch has an artifact named "ndk_platform.tar.bz2". You need to use that instead of the NDK if you're not using the NDK's Clang.
Description
When building Chromium for 32-bit platforms (including x86 and armv7) using Clang 20 (
llvmorg-20-init-1009-g7088a5ed-10
), Clang reports errors in the hardware_buffer.h header provided by NDK:Clang 19 did not report this error, but as it stands the code
1UL << 32
is indeed invalid for 32-bit architectures.Clang no longer reports errors once I patched it to
1ULL << 32
.Affected versions
r27
Canary version
No response
Host OS
Linux
Host OS version
Debian trixie/sid
Affected ABIs
armeabi-v7a, x86
Build system
Other (specify below)
Other build system
No response
minSdkVersion
24
Device API level
No response
The text was updated successfully, but these errors were encountered: