From: Pete_Wall at symantec dot com
Operating system: Solaris 10 SPARC
PHP version: 5.4.21
Package: *Encryption and hash functions
Bug Type: Bug
Bug description:Linking fails when trying to use atomic_add_int and
membar_producer
Description:
------------
I'm trying to build PHP 5.4.21 on my Solaris 10 SPARC box, but it's
failing when it tries to link in atomic_add_int and membar_producer.
Both of those functions are used in ext/standard/php_crypt_r.c:
80 void _crypt_extended_init_r(void)
81 {
82 #ifdef PHP_WIN32
83 LONG volatile initialized = 0;
84 #elif defined(HAVE_ATOMIC_H) /* Solaris 10 defines atomic API within
*/
85 volatile unsigned int initialized = 0;
86 #else
87 static volatile sig_atomic_t initialized = 0;
88 #endif
89
90 #ifdef ZTS
91 tsrm_mutex_lock(php_crypt_extended_init_lock);
92 #endif
93
94 if (!initialized) {
95 #ifdef PHP_WIN32
96 InterlockedIncrement(&initialized);
97 #elif defined(HAVE_SYNC_FETCH_AND_ADD)
98 __sync_fetch_and_add(&initialized, 1);
99 #elif defined(HAVE_ATOMIC_H) /* Solaris 10 defines atomic API within
*/
100 membar_producer();
101 atomic_add_int(&initialized, 1);
102 #endif
103 _crypt_extended_init();
104 }
105 #ifdef ZTS
106 tsrm_mutex_unlock(php_crypt_extended_init_lock);
107 #endif
108 }
On my version of glibc, atomic_add_int() and membar_producer aren't
defined.
$ nm -g /lib/libc.so.1 | grep atomic_add_int
$ nm -g /lib/libc.so.1 | grep membar_producer
Compiler and configuration info:
CFLAGS=""
CPPFLAGS=" -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
./configure --disable-cgi --enable-cli --prefix="/path/to/php"
--with-libxml-dir="/path/to/libxml"
--with-openssl=shared,"/path/to/openssl"
--with-zlib="/path/to/zlib" --with-curl=shared,"/path/to/curl"
--with-config-file-path=/path/to/cfgfile --with-layout=GNU
--with-regex=php --with-tsrm-pthreads --disable-rpath
--disable-sysvsem --disable-sysvshm
--disable-sysvmsg --disable-bcmath --disable-ctype --disable-exif
--disable-spl --disable-ftp
--disable-shmop --enable-tokenizer --disable-static
--enable-posix=shared --enable-session=shared
--enable-sockets=shared --enable-xml=shared --enable-pcntl=shared
--enable-dom --without-mm
--without-gettext --without-iconv --without-sqlite
--without-mime-magic --without-mysql --without-sybase-ct
--without-gdbm --without-db4 --without-cdb --without-pear
--without-xsl --disable-debug
--with-pcre-dir="/path/to/pcre" --with-pcre-regex
$ gcc -v
Reading specs from /usr/local/lib/gcc/sparc-sun-solaris2.10/3.4.6/specs
Configured with: ../configure --with-as=/usr/ccs/bin/as
--with-ld=/usr/ccs/bin/ld --enable-shared --enable-languages=c,c++,f77
Thread model: posix
gcc version 3.4.6
$ uname -a
SunOS grampa 5.10 Generic sun4u sparc SUNW,Sun-Fire-V210
Snippet from configure output:
checking atomic.h usability... yes
checking atomic.h presence... yes
checking for atomic.h... yes
Expected result:
----------------
Successful linking
Actual result:
--------------
Undefined first referenced
symbol in file
atomic_add_int ext/standard/.libs/php_crypt_r.o
membar_producer ext/standard/.libs/php_crypt_r.o
ld: fatal: Symbol referencing errors. No output written to sapi/cli/php
collect2: ld returned 1 exit status
make: *** [sapi/cli/php] Error 1
--
Edit bug report at https://bugs.php.net/bug.php?id=66017&edit=1
--
Try a snapshot (PHP 5.4):
https://bugs.php.net/fix.php?id=66017&r=trysnapshot54
Try a snapshot (PHP 5.5):
https://bugs.php.net/fix.php?id=66017&r=trysnapshot55
Try a snapshot (trunk):
https://bugs.php.net/fix.php?id=66017&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=66017&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=66017&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=66017&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=66017&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=66017&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=66017&r=support
Expected behavior: https://bugs.php.net/fix.php?id=66017&r=notwrong
Not enough info:
https://bugs.php.net/fix.php?id=66017&r=notenoughinfo
Submitted twice:
https://bugs.php.net/fix.php?id=66017&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=66017&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=66017&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=66017&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=66017&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=66017&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=66017&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=66017&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=66017&r=mysqlcfg