Bug 1414348 - undefined symbol: __cxa_throw_bad_array_new_length
Summary: undefined symbol: __cxa_throw_bad_array_new_length
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Developer Toolset
Classification: Red Hat
Component: gcc
Version: DTS 6.1 RHEL 7
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: alpha
: 6.1
Assignee: Jakub Jelinek
QA Contact: Martin Cermak
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-01-18 10:23 UTC by Remi Collet
Modified: 2017-01-18 11:53 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-01-18 11:34:07 UTC
Target Upstream Version:


Attachments (Terms of Use)
info.txt (124.98 KB, text/plain)
2017-01-18 10:23 UTC, Remi Collet
no flags Details
build.log.gz (345.62 KB, application/x-gzip)
2017-01-18 11:10 UTC, Remi Collet
no flags Details

Description Remi Collet 2017-01-18 10:23:28 UTC
Created attachment 1242110 [details]
info.txt

Description of problem:
Undefined symbol trying to run PHP build against GCC 6.2

Version-Release number of selected component (if applicable):
6.2.1-3.1.el7

How reproducible:


Steps to Reproduce:
1. build PHP 7.1 with devtoolset-6-toolchain installed
2. run php -v
3.

Actual results:
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/intl.so' - /usr/lib64/php/modules/intl.so: undefined symbol: __cxa_throw_bad_array_new_length in Unknown on line 0

Expected results:
No error

Additional info:
See attachement (with diff of missing symbols between 4.8 and 6.2 build), so __cxa_throw_bad_array_new_length seems to be the only missing one.

Comment 1 Jakub Jelinek 2017-01-18 10:37:40 UTC
That symbol is provided in libstdc++_nonshared.a, so the above looks like a bug in how the intl.so plugin is linked.  Are you sure you are linking it with g++ ... -shared ... rather than say ld -shared?

Comment 2 Remi Collet 2017-01-18 11:10:14 UTC
Created attachment 1242113 [details]
build.log.gz

Full build.log

Comment 3 Remi Collet 2017-01-18 11:13:42 UTC
From above output, link uses libtool command: 

/bin/sh /builddir/build/BUILD/php-7.1.1/build-cgi/libtool --silent --preserve-dup-deps --mode=link cc ...

Comment 4 Jakub Jelinek 2017-01-18 11:34:07 UTC
-mode=link cc ...
that is of course a bug, if the module is written in C++, it should have been c++ or g++ instead of cc.

Comment 5 Remi Collet 2017-01-18 11:53:16 UTC
Great thanks for given information which helps a lot on this issue, which indeed should be fixed in PHP.



Simple patch:

--- a/ext/intl/config.m4
+++ b/ext/intl/config.m4
@@ -86,7 +86,7 @@ if test "$PHP_INTL" != "no"; then
     breakiterator/codepointiterator_methods.cpp \
     uchar/uchar.c \
     idn/idn.c \
-    $icu_spoof_src, $ext_shared,,$ICU_INCS -Wno-write-strings -D__STDC_LIMIT_MACROS -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
+    $icu_spoof_src, $ext_shared,,$ICU_INCS -Wno-write-strings -D__STDC_LIMIT_MACROS -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1,cxx)
   PHP_ADD_BUILD_DIR($ext_builddir/collator)
   PHP_ADD_BUILD_DIR($ext_builddir/converter)
   PHP_ADD_BUILD_DIR($ext_builddir/common)


Going to report/fix it upstream


Note You need to log in before you can comment on or make changes to this bug.