Bug #68114 [Asn]: Build fails with gcc: Undefined symbols: ___extendsddf ___extendsfsd

From: Date: Fri, 14 Nov 2014 09:40:58 +0000
Subject: Bug #68114 [Asn]: Build fails with gcc: Undefined symbols: ___extendsddf ___extendsfsd
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-188591@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=68114&edit=1

 ID:                 68114
 User updated by:    php-bugs-2014 at ryandesign dot com
 Reported by:        php-bugs-2014 at ryandesign dot com
 Summary:            Build fails with gcc: Undefined symbols:
                     ___extendsddf ___extendsfsd
 Status:             Assigned
 Type:               Bug
 Package:            MySQL related
 Operating System:   OS X
 PHP Version:        5.5.17
 Assigned To:        keyur
 Block user comment: N
 Private report:     N

 New Comment:

Certainly; here is the compiled program:

http://ryandesign.com/tmp/php-bug-68114/snippet


Previous Comments:
------------------------------------------------------------------------
[2014-11-04 17:33:21] keyur@php.net

One last request: could you put the -O1 binary somewhere I could download from?

------------------------------------------------------------------------
[2014-11-04 05:58:26] php-bugs-2014 at ryandesign dot com

My assumption is that the fact that the configure test compiles and links is an error. Disabling
optimizations for the duration of the configure test works around that error and allows the
configure test to properly detect the absence of decimal fp support. Yes, this is papering over a
bug in the compiler and/or linker but that's the best we can hope for since Apple is not going
to be releasing any updated versions of the developer tools for the affected OS X versions because
they are several major versions old by now.

Inspecting the value of __APPLE_CC__ doesn't seem likely to help identify the broken compilers
in this situation. With an affected version of gcc from OS X 10.6 ("gcc version 4.2.1 (Apple
Inc. build 5666) (dot 3)"), the value of __APPLE_CC__ is "5666". However that OS X
version also includes the llvm-gcc compiler ("gcc version 4.2.1 (Based on Apple Inc. build
5658) (LLVM build 2335.6)") which is not affected by the problem and its __APPLE_CC__ value is
"5658". An early version of clang is also included ("Apple clang version 1.7
(tags/Apple/clang-77) (based on LLVM 2.9svn)"); it is not affected by the bug and its
__APPLE_CC__ value is "5621". The version of gcc-4.2 on OS X 10.5 ("gcc version 4.2.1
(Apple Inc. build 5577)") is affected; its __APPLE_CC__ value is 5577.

It doesn't seem necessary to identify the affected compilers in any way; just disable
optimizations for this configure test. This should not have any adverse effects on the test's
ability to detect the feature on other platforms nor would it have any effect on the final
executable's performance.

You previously asked me to compile and run a snippet. Here's the result on OS X 10.5:

$ gcc-4.2 snippet.c
Undefined symbols:
  "___extendsddf", referenced from:
      _main in ccODpbxz.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
$ gcc-4.2 -O1 snippet.c
$ ./a.out 
Expected: 99.49, Actual: 99.490000
$ echo $?
0
$

------------------------------------------------------------------------
[2014-11-04 03:56:50] keyur@php.net

The config.log for the (default) -O2 case shows the test compiles *and* links *and* runs *and* exits
with 0. So the same should happen for the main PHP executable...I don't understand why that
linking fails.

I am a bit hesitant to change the optimizer level since that seems just paper over the bug in the
compiler/linker. I'd rather add a check for 
#if defined(__APPLE__CC__) && __APPLE_CC__ > N

Can you tell me what the value of that macro is on your system?

------------------------------------------------------------------------
[2014-11-04 02:18:55] php-bugs-2014 at ryandesign dot com

Here is the config.log for php-5.6.3RC1 on OS X 10.6.8:

https://gist.github.com/ryandesign/4c4721cf740c014129e4

Here is the config.log after applying the patch I just attached, which fixes the problem as I
suggested earlier:

https://gist.github.com/ryandesign/4b2d1a5e082f3cb90994

------------------------------------------------------------------------
[2014-11-03 21:59:12] keyur@php.net

I don't have a Mac OS box, so I'm having the commands run by a friend. Here's the
config it works on: 
$ uname -a
Darwin 2414 13.4.0 Darwin Kernel Version 13.4.0: Sun Aug 17 19:50:11 PDT 2014;
root:xnu-2422.115.4~1/RELEASE_X86_64 x86_64

$ gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr
--with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 6.0 (clang-600.0.54) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin13.4.0
Thread model: posix

I see it is Clang. If you're available on IRC somewhere, let me know. We can work through this
faster.

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=68114


--
Edit this bug report at https://bugs.php.net/bug.php?id=68114&edit=1


Thread (40 messages)

« previous php.bugs (#188591) next »