Bug #66017 [Fbk->NoF]: Linking fails when trying to use atomic_add_int and membar_producer

From: Date: Tue, 30 Dec 2014 10:42:06 +0000
Subject: Bug #66017 [Fbk->NoF]: Linking fails when trying to use atomic_add_int and membar_producer
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-189438@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=66017&edit=1

 ID:               66017
 Updated by:       php-bugs@lists.php.net
 Reported by:      Pete_Wall at symantec dot com
 Summary:          Linking fails when trying to use atomic_add_int and
                   membar_producer
-Status:           Feedback
+Status:           No Feedback
 Type:             Bug
 Package:          Compile Failure
 Operating System: Solaris 10 SPARC
 PHP Version:      5.4.21
 Private report:   N

 New Comment:

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.


Previous Comments:
------------------------------------------------------------------------
[2013-11-04 14:59:04] Pete_Wall at Symantec dot com

Uploaded a new version of the patch file in the unified diff format.

------------------------------------------------------------------------
[2013-11-03 11:42:09] felipe@php.net

Please, provide a patch in an unified format. (diff -uwp)

------------------------------------------------------------------------
[2013-11-01 21:46:20] 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



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



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


Thread (4 messages)

« previous php.bugs (#189438) next »