-
Notifications
You must be signed in to change notification settings - Fork 7.9k
ext/intl: fix clang build. #18535
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
base: PHP-8.3
Are you sure you want to change the base?
ext/intl: fix clang build. #18535
Conversation
actually, with recent icu releases, this problem arises ``` checking whether clang++ supports C++17 features with -std=c++17... no checking whether clang++ supports C++17 features with +std=c++17... no checking whether clang++ supports C++17 features with -h std=c++17... no checking whether clang++ supports C++17 features with -std=c++1z... no checking whether clang++ supports C++17 features with +std=c++1z... no checking whether clang++ supports C++17 features with -h std=c++1z... no configure: error: *** A compiler with support for C++17 language features is required. ``` thus, proposing to falls into LLVM libc++ instead.
note it happens only when ubsan is enabled. |
so intl itself might be compiled with rtti however we compile c++ w/o exceptions nor rtti (lean binaries ?) so had to disable vptr sanitizer check. |
Sadly, I'm not very qualified to review this. 🙁 Maybe @petk can help? |
fair enough :) I suspect this might be one of the reasons @YuanchengJiang never build intl with clang (this PR fixes two distinct issues). |
Hello, I can't seem to reproduce exactly this kind issue (but a whole lots of other ones unrelated to this issue :D). I've checked master branch, clang 18 (with llvm installed and without), clang 19, ICU library 74, with this: CC=clang CXX=clang++ ./configure --enable-intl --enable-undefined-sanitizer I have no idea. Does perhaps installing |
@petk long time no see :) did you try to build ? indeed with my other machine configure part pass but I stumble across linkage issue and yes I have llvm-dev/llvm installed. I may retry in the other machine which has clang 20 for the other problem. Cheers. |
Here a taste of what I get /usr/bin/ld: /home/dcarlier/Contribs/php-src/ext/intl/breakiterator/codepointiterator_internal.cpp:226:(.text+0x5d6e): undefined reference to `__ubsan_vptr_type_cache'
/usr/bin/ld: /home/dcarlier/Contribs/php-src/ext/intl/breakiterator/codepointiterator_internal.cpp:226:(.text+0x5d8b): undefined reference to `__ubsan_handle_dynamic_type_cache_miss_abort'
/usr/bin/ld: /home/dcarlier/Contribs/php-src/ext/intl/breakiterator/codepointiterator_internal.cpp:226:(.text+0x5e57): undefined reference to `__ubsan_vptr_type_cache'
/usr/bin/ld: /home/dcarlier/Contribs/php-src/ext/intl/breakiterator/codepointiterator_internal.cpp:226:(.text+0x5e74): undefined reference to `__ubsan_handle_dynamic_type_cache_miss_abort'
/usr/bin/ld: /home/dcarlier/Contribs/php-src/ext/intl/breakiterator/codepointiterator_internal.cpp:226:(.text+0x5f87): undefined reference to `__ubsan_vptr_type_cache'
/usr/bin/ld: /home/dcarlier/Contribs/php-src/ext/intl/breakiterator/codepointiterator_internal.cpp:226:(.text+0x5fa4): undefined reference to `__ubsan_handle_dynamic_type_cache_miss_abort'
/usr/bin/ld: /home/dcarlier/Contribs/php-src/ext/intl/breakiterator/codepointiterator_internal.cpp:226:(.text+0x60e9): undefined reference to `__ubsan_vptr_type_cache'
/usr/bin/ld: /home/dcarlier/Contribs/php-src/ext/intl/breakiterator/codepointiterator_internal.cpp:226:(.text+0x6106): undefined reference to `__ubsan_handle_dynamic_type_cache_miss_abort'
/usr/bin/ld: /home/dcarlier/Contribs/php-src/ext/intl/breakiterator/codepointiterator_internal.cpp:228:(.text+0x616e): undefined reference to `__ubsan_vptr_type_cache'
/usr/bin/ld: /home/dcarlier/Contribs/php-src/ext/intl/breakiterator/codepointiterator_internal.cpp:228:(.text+0x618b): undefined reference to `__ubsan_handle_dynamic_type_cache_miss_abort'
/usr/bin/ld: ext/intl/breakiterator/codepointiterator_internal.o: in function `PHP::CodePointBreakIterator::refreshInputText(UText*, UErrorCode&)':
/home/dcarlier/Contribs/php-src/ext/intl/breakiterator/codepointiterator_internal.cpp:284:(.text+0x6687): undefined reference to `__ubsan_vptr_type_cache'
/usr/bin/ld: /home/dcarlier/Contribs/php-src/ext/intl/breakiterator/codepointiterator_internal.cpp:284:(.text+0x66a1): undefined reference to `__ubsan_handle_dynamic_type_cache_miss_abort'
/usr/bin/ld: /home/dcarlier/Contribs/php-src/ext/intl/breakiterator/codepointiterator_internal.cpp:285:(.text+0x66f6): undefined reference to `__ubsan_vptr_type_cache'
/usr/bin/ld: /home/dcarlier/Contribs/php-src/ext/intl/breakiterator/codepointiterator_internal.cpp:285:(.text+0x6710): undefined reference to `__ubsan_handle_dynamic_type_cache_miss_abort'
/usr/bin/ld: /home/dcarlier/Contribs/php-src/ext/intl/breakiterator/codepointiterator_internal.cpp:285:(.text+0x6774): undefined reference to `__ubsan_vptr_type_cache'
/usr/bin/ld: /home/dcarlier/Contribs/php-src/ext/intl/breakiterator/codepointiterator_internal.cpp:285:(.text+0x678e): undefined reference to `__ubsan_handle_dynamic_type_cache_miss_abort'
/usr/bin/ld: /home/dcarlier/Contribs/php-src/ext/intl/breakiterator/codepointiterator_internal.cpp:290:(.text+0x6857): undefined reference to `__ubsan_vptr_type_cache'
/usr/bin/ld: /home/dcarlier/Contribs/php-src/ext/intl/breakiterator/codepointiterator_internal.cpp:290:(.text+0x6871): undefined reference to `__ubsan_handle_dynamic_type_cache_miss_abort'
/usr/bin/ld: /home/dcarlier/Contribs/php-src/ext/intl/breakiterator/codepointiterator_internal.cpp:291:(.text+0x68c3): undefined reference to `__ubsan_vptr_type_cache'
/usr/bin/ld: /home/dcarlier/Contribs/php-src/ext/intl/breakiterator/codepointiterator_internal.cpp:291:(.text+0x68dd): undefined reference to `__ubsan_handle_dynamic_type_cache_miss_abort'
/usr/bin/ld: ext/intl/breakiterator/codepointiterator_internal.o: in function `PHP::CodePointBreakIterator::clearCurrentCharIter()':
/home/dcarlier/Contribs/php-src/ext/intl/breakiterator/codepointiterator_internal.h:96:(.text._ZN3PHP22CodePointBreakIterator20clearCurrentCharIterEv[_ZN3PHP22CodePointBreakIterator20clearCurrentCharIterEv]+0x76): undefined reference to `__ubsan_vptr_type_cache'
/usr/bin/ld: /home/dcarlier/Contribs/php-src/ext/intl/breakiterator/codepointiterator_internal.h:96:(.text._ZN3PHP22CodePointBreakIterator20clearCurrentCharIterEv[_ZN3PHP22CodePointBreakIterator20clearCurrentCharIterEv]+0x90): undefined reference to `__ubsan_handle_dynamic_type_cache_miss_abort'
/usr/bin/ld: /home/dcarlier/Contribs/php-src/ext/intl/breakiterator/codepointiterator_internal.h:96:(.text._ZN3PHP22CodePointBreakIterator20clearCurrentCharIterEv[_ZN3PHP22CodePointBreakIterator20clearCurrentCharIterEv]+0x11f): undefined reference to `__ubsan_vptr_type_cache'
/usr/bin/ld: /home/dcarlier/Contribs/php-src/ext/intl/breakiterator/codepointiterator_internal.h:96:(.text._ZN3PHP22CodePointBreakIterator20clearCurrentCharIterEv[_ZN3PHP22CodePointBreakIterator20clearCurrentCharIterEv]+0x139): undefined reference to `__ubsan_handle_dynamic_type_cache_miss_abort'
/usr/bin/ld: /home/dcarlier/Contribs/php-src/ext/intl/breakiterator/codepointiterator_internal.h:97:(.text._ZN3PHP22CodePointBreakIterator20clearCurrentCharIterEv[_ZN3PHP22CodePointBreakIterator20clearCurrentCharIterEv]+0x183): undefined reference to `__ubsan_vptr_type_cache'
/usr/bin/ld: /home/dcarlier/Contribs/php-src/ext/intl/breakiterator/codepointiterator_internal.h:97:(.text._ZN3PHP22CodePointBreakIterator20clearCurrentCharIterEv[_ZN3PHP22CodePointBreakIterator20clearCurrentCharIterEv]+0x19d): undefined reference to `__ubsan_handle_dynamic_type_cache_miss_abort'
/usr/bin/ld: /home/dcarlier/Contribs/php-src/ext/intl/breakiterator/codepointiterator_internal.h:98:(.text._ZN3PHP22CodePointBreakIterator20clearCurrentCharIterEv[_ZN3PHP22CodePointBreakIterator20clearCurrentCharIterEv]+0x1e6): undefined reference to `__ubsan_vptr_type_cache'
/usr/bin/ld: /home/dcarlier/Contribs/php-src/ext/intl/breakiterator/codepointiterator_internal.h:98:(.text._ZN3PHP22CodePointBreakIterator20clearCurrentCharIterEv[_ZN3PHP22CodePointBreakIterator20clearCurrentCharIterEv]+0x200): undefined reference to `__ubsan_handle_dynamic_type_cache_miss_abort'
/usr/bin/ld: ext/intl/breakiterator/codepointiterator_internal.o: in function `std::type_info::operator!=(std::type_info const&) const':
/usr/lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/typeinfo:114:(.text._ZNKSt9type_infoneERKS_[_ZNKSt9type_infoneERKS_]+0x7a): undefined reference to `__ubsan_vptr_type_cache'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/typeinfo:114:(.text._ZNKSt9type_infoneERKS_[_ZNKSt9type_infoneERKS_]+0x94): undefined reference to `__ubsan_handle_dynamic_type_cache_miss_abort'
/usr/bin/ld: ext/intl/breakiterator/codepointiterator_internal.o: in function `std::type_info::operator==(std::type_info const&) const':
this change fixes it. since we compile C++ with |
@devnexen I've experienced this issue in the past, and I believe linking with Clang++ fixes the issue, but I didn't know how to best achieve this in the build system. |
Yes, I see. Link step fails the same as yours, yes. And adding the |
I won t mind just pushing just the ubsan change, the other part might be a bit "heavy" as forcing to use llvm c++ runtime but I may retest this a bit later. |
actually, with recent icu releases, this problem arises
thus, proposing to falls into LLVM libc++ instead.