From:
Operating system: Linux
PHP version: 5.3.8
Package: Compile Failure
Bug Type: Bug
Bug description:undefined reference to `__sync_fetch_and_add_4'
Description:
------------
I tried to cross-compile php-5.3.8 for a Coldfire/m68k V4e target and
failed at the linking stage:
php_crypt_r.c:(.text+0x54): undefined reference to
`__sync_fetch_and_add_4'
collect2: ld returned 1 exit status
make: *** [sapi/cgi/php-cgi] Error 1
I'm using the Codesourcery toolchain
freescale-coldfire-m68k-linux-gnu-2011.03-98 with gcc-4.5.2.
Bug #55231 deals with the same
problem on HPUX. When I changed the following condition in php_crypt_r.c:99
from
#elif (defined(__GNUC__) && !defined(__hpux) && (__GNUC__ > 4 || \
(__GNUC__ == 4 && (__GNUC_MINOR__ > 1 || (__GNUC_MINOR__ == 1 &&
__GNUC_PATCHLEVEL__ > 1)))))
to
#elif (defined(__GNUC__) && !defined(__m68k__) && !defined(__hpux) &&
(__GNUC__ > 4 || \
(__GNUC__ == 4 && (__GNUC_MINOR__ > 1 || (__GNUC_MINOR__ == 1 &&
__GNUC_PATCHLEVEL__ > 1)))))
everything works fine. You might be interested in the fact that I
encountered the same problem using the boost C++ library on the same
platform. They offer a macro "DISABLE_FENCED_BLOCKING" (or similar) that
when defined prevents the usage of these gcc builtins, see:
http://lists.boost.org/boost-users/2010/09/62566.php
Maybe introducing a #define that allows for disabling the usage of these
gcc builtins is a better solution than growing up that condition? Just a
thought here...
--
Edit bug report at https://bugs.php.net/bug.php?id=60328&edit=1
--
Try a snapshot (PHP 5.4):
https://bugs.php.net/fix.php?id=60328&r=trysnapshot54
Try a snapshot (PHP 5.3):
https://bugs.php.net/fix.php?id=60328&r=trysnapshot53
Try a snapshot (trunk):
https://bugs.php.net/fix.php?id=60328&r=trysnapshottrunk
Fixed in SVN:
https://bugs.php.net/fix.php?id=60328&r=fixed
Fixed in SVN and need be documented:
https://bugs.php.net/fix.php?id=60328&r=needdocs
Fixed in release:
https://bugs.php.net/fix.php?id=60328&r=alreadyfixed
Need backtrace:
https://bugs.php.net/fix.php?id=60328&r=needtrace
Need Reproduce Script:
https://bugs.php.net/fix.php?id=60328&r=needscript
Try newer version:
https://bugs.php.net/fix.php?id=60328&r=oldversion
Not developer issue:
https://bugs.php.net/fix.php?id=60328&r=support
Expected behavior:
https://bugs.php.net/fix.php?id=60328&r=notwrong
Not enough info:
https://bugs.php.net/fix.php?id=60328&r=notenoughinfo
Submitted twice:
https://bugs.php.net/fix.php?id=60328&r=submittedtwice
register_globals:
https://bugs.php.net/fix.php?id=60328&r=globals
PHP 4 support discontinued:
https://bugs.php.net/fix.php?id=60328&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=60328&r=dst
IIS Stability:
https://bugs.php.net/fix.php?id=60328&r=isapi
Install GNU Sed:
https://bugs.php.net/fix.php?id=60328&r=gnused
Floating point limitations:
https://bugs.php.net/fix.php?id=60328&r=float
No Zend Extensions:
https://bugs.php.net/fix.php?id=60328&r=nozend
MySQL Configuration Error:
https://bugs.php.net/fix.php?id=60328&r=mysqlcfg