php / php/php-src

Building ext/intl with `--enable-address-sanitizer --enable-undefined-sanitizer` fails to link

Open
#20,992 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Bug Category: Build System Status: Verified
Dominant language
C
Stars
40.4k
Forks
8.1k
Avg merge
2d 13h
Merged PRs (30d)
96

Description

Description

The following code:

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

git master @ e9e0fe45e512415c4ac44c76cc59ed03a9a01fc6

Operating System

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with the shown configure command and inspect the link failure from ext/intl/intl_convertcpp.cpp and breakiterator/codepointiterator_internal.h. Compare the sanitizer flags used for C and C++ objects and the Makefile link targets. Done means make completes successfully for the configured PHP build.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
build-system, internationalization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.