php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #77996 Build fails with --enable-intl
Submitted: 2019-05-09 09:47 UTC Modified: 2021-07-29 10:37 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: daniel at imhimmel dot net Assigned: cmb (profile)
Status: Closed Package: *Compile Issues
PHP Version: 7.3.5 OS: macOS Mojave (10.14.4)
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: daniel at imhimmel dot net
New email:
PHP Version: OS:

 

 [2019-05-09 09:47 UTC] daniel at imhimmel dot net
Description:
------------
Linking libphp7.so fails with the following error:
Undefined symbols for architecture x86_64:
  "thread-local wrapper routine for _tsrm_ls_cache", referenced from:
      _zim_IntlDateFormatter___construct in dateformat_create.o
      _timezone_convert_to_datetimezone in timezone_class.o
      _zif_intlcal_from_date_time in calendar_methods.o
      _zif_intlcal_to_date_time in calendar_methods.o
      _php_intlgregcal_constructor_body(_zend_execute_data*, _zval_struct*, unsigned char) in gregoriancalendar_methods.o

As a workaround one may build php without intl extension (--disable-intl) and build intl as a separate extension, although I'm not sure if it might fail on some condition.
For now my tests using datefmt_create and IntlDateFormatter did work just fine.



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-05-20 12:14 UTC] tmlmvp at gmail dot com
Hi, I had the same problem when i `build and make` php(7.3.5) with zts. And my macOS version is 10.12.6.

clang: warning: argument unused during compilation: '-pthread' [-Wunused-command-line-argument]
Undefined symbols for architecture x86_64:
  "thread-local wrapper routine for _tsrm_ls_cache", referenced from:
      _zim_IntlDateFormatter___construct in dateformat_create.o
      _timezone_convert_to_datetimezone in timezone_class.o
      _zif_intlcal_from_date_time in calendar_methods.o
      _zif_intlcal_to_date_time in calendar_methods.o
      _php_intlgregcal_constructor_body(_zend_execute_data*, _zval_struct*, unsigned char) in gregoriancalendar_methods.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [sapi/cli/php] Error 1
 [2019-09-05 11:53 UTC] chris at cretaforce dot gr
I try to create a static PHP 7.1 binary with intl support:

./configure --prefix=/home/username --enable-static --enable-cli --disable-cgi --enable-mysqlnd --with-mysql --with-mysqli --with-curl --with-zlib --enable-mbstring --enable-calendar --with-gd --with-bz2 --enable-sockets --enable-ftp --with-gettext --with-xmlrpc --with-xsl --with-pdo-mysql --enable-mbregex --enable-exif --enable-bcmath --with-mhash --enable-zip --with-mcrypt --enable-soap --with-openssl
./configure --prefix=/home/www/cretaftp/php --enable-static --enable-cli --disable-cgi --enable-mysqlnd --with-mysqli --with-curl --with-zlib --enable-mbstring --enable-calendar --with-gd --with-bz2 --enable-sockets --enable-ftp --with-gettext --with-xmlrpc --with-xsl --with-pdo-mysql --enable-mbregex --enable-exif --enable-bcmath --with-mhash --enable-zip --with-mcrypt --enable-soap --with-openssl --enable-intl --with-layout=GNU

But when I run:

make

I get this:

ld: error: undefined symbol: std::__throw_length_error(char const*)
>>> referenced by stl_vector.h:1756 (/usr/local/lib/gcc9/include/c++/bits/stl_vector.h:1756)
>>> ext/intl/msgformat/.libs/msgformat_helpers.o:(std::vector<icu::Formattable, std::allocator<icu::Formattable> >::_M_default_append(unsigned long))

ld: error: undefined symbol: std::__throw_length_error(char const*)
>>> referenced by stl_vector.h:1756 (/usr/local/lib/gcc9/include/c++/bits/stl_vector.h:1756)
>>> ext/intl/msgformat/.libs/msgformat_helpers.o:(std::vector<icu::UnicodeString, std::allocator<icu::UnicodeString> >::_M_default_append(unsigned long))
cc: error: linker command failed with exit code 1 (use -v to see invocation)
*** Error code 1

Stop.

If I remove --enable-intl from the ./configure command the issue doesn't exist.
 [2019-09-05 11:55 UTC] chris at cretaforce dot gr
I forgot to write that I use FreeBSD.
 [2020-01-18 23:01 UTC] bobben at wigilius dot se
I'm having the same issue trying to compile php 7.2.26 with intl (also tried 7.3.13) on MacOS 10.11.6.
Php 7.1.33 with intl compiles just fine.

The problem seems to be that MacOS and/or its compiler software doesn't fully support "thread_local", so the php developers need to update the TSRM/TSRM.h file and add an ifdef thing for darwin/macos that disables the use of the "thread_local" function on MacOS.

Changed this code in the file TSRM/TSRM.h:

#if defined(__cplusplus) && __cplusplus > 199711L
# define TSRM_TLS thread_local
#else
# ifdef TSRM_WIN32
#  define TSRM_TLS __declspec(thread)
# else
#  define TSRM_TLS __thread
# endif
#endif

to this:

#ifdef TSRM_WIN32
# define TSRM_TLS __declspec(thread)
#else
# define TSRM_TLS __thread
#endif

so now it's the same as in 7.1.33 and now it compiles just fine!
 [2021-07-29 10:37 UTC] cmb@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: cmb
 [2021-07-29 10:37 UTC] cmb@php.net
This has already been fixed[1] for PHP 7.4.

[1] <https://github.com/php/php-src/commit/69190ce5c053a9bf97983932bd702137895b18df>
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Dec 02 21:01:30 2024 UTC