[php-src] Issue #20992: Building ext/intl with `--enable-address-sanitizer --enable-undefined-sanitizer` fails to link

[email protected] (TimWolla)
Newsgroups php.bugs
Message-ID <[email protected]>
Issue: https://github.com/php/php-src/issues/20992
Author: TimWolla

### Description

The following code:

```php
env CC=clang CXX=clang++ ./configure --disable-all --enable-intl --enable-debug --enable-zend-test --enable-address-sanitizer --enable-undefined-sanitizer
make
```

Resulted in this output:
```
/bin/bash php-src/libtool --silent --preserve-dup-deps --tag=CC --mode=compile clang -Isapi/cgi/ -Iphp-src/sapi/cgi/ -Iphp-src/main -Iphp-src -Iphp-src/ext/date/lib -Iphp-src/ext/lexbor -Iphp-src/ext/uri/uriparser/include -Iphp-src/TSRM -Iphp-src/Zend  -D_GNU_SOURCE  -fno-common -Wstrict-prototypes -Wformat-truncation -Wall -Wextra -Wno-unused-parameter -Wno-sign-compare -g -ffp-contract=off -fvisibility=hidden -UNDEBUG -O0 -DZEND_SIGNALS -fsanitize=address -DZEND_TRACK_ARENA_ALLOC -fsanitize=undefined -fno-sanitize-recover=undefined -fno-sanitize=object-size -fno-sanitize=function -fno-omit-frame-pointer   -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -c php-src/sapi/cgi/cgi_main.c -o sapi/cgi/cgi_main.lo  -MMD -MF sapi/cgi/cgi_main.dep -MT sapi/cgi/cgi_main.lo
ext/opcache/jit/ir/minilua php-src/ext/opcache/jit/ir/dynasm/dynasm.lua  -D X64=1 -o ext/opcache/jit/ir/ir_emit_x86.h php-src/ext/opcache/jit/ir/ir_x86.dasc
ext/opcache/jit/ir/gen_ir_fold_hash < php-src/ext/opcache/jit/ir/ir_fold.h > ext/opcache/jit/ir/ir_fold_hash.h
/bin/bash php-src/libtool --silent --preserve-dup-deps --tag=CC --mode=compile clang -Iext/opcache/ -Iphp-src/ext/opcache/ -Iphp-src/main -Iphp-src -Iphp-src/ext/date/lib -Iphp-src/ext/lexbor -Iphp-src/ext/uri/uriparser/include -Iphp-src/TSRM -Iphp-src/Zend  -D_GNU_SOURCE  -fno-common -Wstrict-prototypes -Wformat-truncation -Wall -Wextra -Wno-unused-parameter -Wno-sign-compare -g -ffp-contract=off -fvisibility=hidden -UNDEBUG -O0 -DZEND_SIGNALS -fsanitize=address -DZEND_TRACK_ARENA_ALLOC -fsanitize=undefined -fno-sanitize-recover=undefined -fno-sanitize=object-size -fno-sanitize=function -fno-omit-frame-pointer   -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -Iext/opcache/jit/ir -DIR_TARGET_X64 -DIR_PHP -DIR_DEBUG -c php-src/ext/opcache/jit/ir/ir_emit.c -o ext/opcache/jit/ir/ir_emit.lo  -MMD -MF ext/opcache/jit/ir/ir_emit.dep -MT ext/opcache/jit/ir/ir_emit.lo
/bin/bash php-src/libtool --silent --preserve-dup-deps --tag=CC --mode=compile clang -Iext/opcache/ -Iphp-src/ext/opcache/ -Iphp-src/main -Iphp-src -Iphp-src/ext/date/lib -Iphp-src/ext/lexbor -Iphp-src/ext/uri/uriparser/include -Iphp-src/TSRM -Iphp-src/Zend  -D_GNU_SOURCE  -fno-common -Wstrict-prototypes -Wformat-truncation -Wall -Wextra -Wno-unused-parameter -Wno-sign-compare -g -ffp-contract=off -fvisibility=hidden -UNDEBUG -O0 -DZEND_SIGNALS -fsanitize=address -DZEND_TRACK_ARENA_ALLOC -fsanitize=undefined -fno-sanitize-recover=undefined -fno-sanitize=object-size -fno-sanitize=function -fno-omit-frame-pointer   -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -Iext/opcache/jit/ir -DIR_TARGET_X64 -DIR_PHP -DIR_DEBUG -c php-src/ext/opcache/jit/ir/ir.c -o ext/opcache/jit/ir/ir.lo  -MMD -MF ext/opcache/jit/ir/ir.dep -MT ext/opcache/jit/ir/ir.lo
/bin/bash php-src/libtool --silent --preserve-dup-deps --tag=CC --mode=link clang -export-dynamic -fno-common -Wstrict-prototypes -Wformat-truncation -Wall -Wextra -Wno-unused-parameter -Wno-sign-compare -g -ffp-contract=off -fvisibility=hidden -UNDEBUG -O0 -DZEND_SIGNALS -fsanitize=address -DZEND_TRACK_ARENA_ALLOC -fsanitize=undefined -fno-sanitize-recover=undefined -fno-sanitize=object-size -fno-sanitize=function -fno-omit-frame-pointer   -Wl,-zcommon-page-size=2097152 -Wl,-zmax-page-size=2097152   ext/date/php_date.o ext/date/lib/astro.o ext/date/lib/dow.o […] Zend/zend.o main/internal_functions_cli.o sapi/cli/php_cli.o sapi/cli/php_http_parser.o sapi/cli/php_cli_server.o sapi/cli/ps_title.o sapi/cli/php_cli_process_title.o -lstdc++ -lm -licuio -licui18n -licuuc -licudata  -o sapi/cli/php
/bin/bash php-src/libtool --silent --preserve-dup-deps --tag=CC --mode=link clang -export-dynamic -fno-common -Wstrict-prototypes -Wformat-truncation -Wall -Wextra -Wno-unused-parameter -Wno-sign-compare -g -ffp-contract=off -fvisibility=hidden -UNDEBUG -O0 -DZEND_SIGNALS -fsanitize=address -DZEND_TRACK_ARENA_ALLOC -fsanitize=undefined -fno-sanitize-recover=undefined -fno-sanitize=object-size -fno-sanitize=function -fno-omit-frame-pointer   -Wl,-zcommon-page-size=2097152 -Wl,-zmax-page-size=2097152   ext/date/php_date.o ext/date/lib/astro.o ext/date/lib/dow.o […] Zend/zend.o main/internal_functions_cli.o sapi/phpdbg/phpdbg_bp.o sapi/phpdbg/phpdbg_break.o sapi/phpdbg/phpdbg_btree.o sapi/phpdbg/phpdbg_cmd.o sapi/phpdbg/phpdbg_frame.o sapi/phpdbg/phpdbg_help.o sapi/phpdbg/phpdbg_info.o sapi/phpdbg/phpdbg_io.o sapi/phpdbg/phpdbg_lexer.o sapi/phpdbg/phpdbg_list.o sapi/phpdbg/phpdbg_out.o sapi/phpdbg/phpdbg_parser.o sapi/phpdbg/phpdbg_print.o sapi/phpdbg/phpdbg_prompt.o sapi/phpdbg/phpdbg_set.o sapi/phpdbg/phpdbg_sigsafe.o sapi/phpdbg/phpdbg_utils.o sapi/phpdbg/phpdbg_watch.o sapi/phpdbg/phpdbg.o -lstdc++ -lm -licuio -licui18n -licuuc -licudata -lpthread   -o sapi/phpdbg/phpdbg
/bin/bash php-src/libtool --silent --preserve-dup-deps --tag=CC --mode=link clang -export-dynamic -fno-common -Wstrict-prototypes -Wformat-truncation -Wall -Wextra -Wno-unused-parameter -Wno-sign-compare -g -ffp-contract=off -fvisibility=hidden -UNDEBUG -O0 -DZEND_SIGNALS -fsanitize=address -DZEND_TRACK_ARENA_ALLOC -fsanitize=undefined -fno-sanitize-recover=undefined -fno-sanitize=object-size -fno-sanitize=function -fno-omit-frame-pointer   -Wl,-zcommon-page-size=2097152 -Wl,-zmax-page-size=2097152   ext/date/php_date.o ext/date/lib/astro.o ext/date/lib/dow.o […] Zend/zend.o main/internal_functions_cli.o main/fastcgi.o sapi/cgi/cgi_main.o -lstdc++ -lm -licuio -licui18n -licuuc -licudata  -o sapi/cgi/php-cgi
/usr/bin/ld: ext/intl/intl_convertcpp.o: in function `intl_stringFromChar(icu_74::UnicodeString&, char*, unsigned long, UErrorCode*)':
php-src/ext/intl/intl_convertcpp.cpp:28:(.text+0x23f): undefined reference to `__ubsan_vptr_type_cache'
/usr/bin/ld: php-src/ext/intl/intl_convertcpp.cpp:28:(.text+0x263): undefined reference to `__ubsan_handle_dynamic_type_cache_miss_abort'
/usr/bin/ld: php-src/ext/intl/intl_convertcpp.cpp:36:(.text+0x363): undefined reference to `__ubsan_vptr_type_cache'
/usr/bin/ld: php-src/ext/intl/intl_convertcpp.cpp:36:(.text+0x384): undefined reference to `__ubsan_handle_dynamic_type_cache_miss_abort'
/usr/bin/ld: php-src/ext/intl/intl_convertcpp.cpp:39:(.text+0x4f1): undefined reference to `__ubsan_vptr_type_cache'
/usr/bin/ld: php-src/ext/intl/intl_convertcpp.cpp:39:(.text+0x50f): undefined reference to `__ubsan_handle_dynamic_type_cache_miss_abort'
/usr/bin/ld: php-src/ext/intl/intl_convertcpp.cpp:42:(.text+0x5f8): undefined reference to `__ubsan_vptr_type_cache'
/usr/bin/ld: php-src/ext/intl/intl_convertcpp.cpp:42:(.text+0x616): undefined reference to `__ubsan_handle_dynamic_type_cache_miss_abort'
/usr/bin/ld: php-src/ext/intl/intl_convertcpp.cpp:44:(.text+0x776): undefined reference to `__ubsan_vptr_type_cache'
/usr/bin/ld: php-src/ext/intl/intl_convertcpp.cpp:44:(.text+0x794): undefined reference to `__ubsan_handle_dynamic_type_cache_miss_abort'

[3000 lines and 4 MB later]

/usr/bin/ld: php-src/ext/intl/breakiterator/codepointiterator_internal.h:86:(.text._ZN3PHP22CodePointBreakIterator16getLastCodePointEv[_ZN3PHP22CodePointBreakIterator16getLastCodePointEv]+0xc4): undefined reference to `__ubsan_handle_dynamic_type_cache_miss_abort'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [Makefile:260: sapi/cli/php] Error 1
make: *** Waiting for unfinished jobs....
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [Makefile:277: sapi/phpdbg/phpdbg] Error 1
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [Makefile:303: sapi/cgi/php-cgi] Error 1
```

But I expected this output instead:

A successful build.

### PHP Version

```plain
git master @ e9e0fe45e512415c4ac44c76cc59ed03a9a01fc6
```

### Operating System

_No response_
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.