Skip to content

Build fails with ICU 76+ due to missing toU16StringView in unistr.h #18831

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
thecaliskan opened this issue Jun 11, 2025 · 2 comments
Open

Comments

@thecaliskan
Copy link

thecaliskan commented Jun 11, 2025

Description

I'm encountering a build failure when trying to install PHP extensions (intl) on Alpine 3.22. The issue is caused by the toU16StringView function being used in ICU headers but missing from the current ICU version shipped with Alpine 3.22 (ICU 76+).

📄 Error Log

/usr/include/unicode/unistr.h: In function 'icu_76::UnicodeString icu_76::operator+(const UnicodeString&, const S&)':
/usr/include/unicode/unistr.h:4118:46: error: 'toU16StringView' is not a member of 'icu_76::internal'
4118 |   return unistr_internalConcat(s1, internal::toU16StringView(s2));
     |                                              ^~~~~~~~~~~~~~~
/usr/include/unicode/unistr.h:4118:10: error: there are no arguments to 'unistr_internalConcat' that depend on a template parameter, so a declaration of 'unistr_internalConcat' must be available [-fpermissive]

You can also reproduce this with a minimal Dockerfile using php:8.4-alpine3.22:

🐳 Docker Reproduction

FROM php:8.4-alpine3.22
RUN apk add --no-cache icu-dev g++     && docker-php-ext-install intl

✅ Works on:

  • Alpine 3.21 (with older ICU version)

❌ Fails on:

  • Alpine 3.22 (icu-76.1)

Thanks!

Reference Issue: GitHub Issue Link

Reference build failure: GitHub Action Link

PHP Version

8.4-alpine
8.3-alpine
8.2-alpine
8.1-alpine

Operating System

Alpine 3.22

@thecaliskan
Copy link
Author

Hi @nielsdos 👋

Would you happen to have any recommendations or insights on how this could be best addressed? 🙏
If this is something already being tracked elsewhere, I’d be happy to follow the right thread.

Thanks in advance!

pabzm added a commit to roundcube/roundcubemail-docker that referenced this issue Jun 11, 2025
The actual culprit is ICU 76.1-r0, which is included in alpine v3.22

Refs:
php/php-src#18831
mlocati/docker-php-extension-installer#1104
@nielsdos
Copy link
Member

The docker snippet you posted does not reproduce an issue. In fact, PHP 8.4 should not be affected by this issue.

The reason the build fails is because ICU versions higher than 74.0 must be compiled using the C++17 standard instead of C++11. They bumped their requirements.
This was fixed in PHP a while ago, but it looks like this was done at a time when PHP 8.1 was already out of bugfix support. So that would explain why the CI run that you linked fails on PHP 8.1. It should not fail on newer versions of PHP.

The fix was actually backported to PHP 8.1 about 2 months ago: 3fdd3ed. However, this hasn't made it into distros yet because PHP 8.1 only receives security updates. That means that the ICU compile fix will only land together for PHP 8.1 with the next PHP 8.1 security release.
As a solution until that time comes, you can apply that commit manually in your build I suppose.

Let me know if this worked for you.

In general, it happens from time to time that libraries make breaking changes after a PHP version has gone out of support. Sometimes after it even went out of security support (Looking at you libxml...). In those cases it's often better to stick with older versions of that library if possible because the reality is that those newer library versions were likely never battle tested against the older PHP versions. In this particular case, I think it should be fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants