php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #66017 Linking fails when trying to use atomic_add_int and membar_producer
Submitted: 2013-11-01 21:46 UTC Modified: 2014-12-30 10:42 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: Pete_Wall at symantec dot com Assigned:
Status: No Feedback Package: Compile Failure
PHP Version: 5.4.21 OS: Solaris 10 SPARC
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2013-11-01 21:46 UTC] Pete_Wall at symantec dot com
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


Patches

php-5.4.21.patch.solaris_atomic (last revision 2013-11-04 14:57 UTC by Pete_Wall at Symantec dot com)

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-11-03 11:42 UTC] felipe@php.net
-Status: Open +Status: Feedback -Package: *Encryption and hash functions +Package: Compile Failure
 [2013-11-03 11:42 UTC] felipe@php.net
Please, provide a patch in an unified format. (diff -uwp)
 [2013-11-04 14:59 UTC] Pete_Wall at Symantec dot com
Uploaded a new version of the patch file in the unified diff format.
 [2014-12-30 10:42 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 12 17:01:34 2024 UTC