From:             mukustr at yahoo dot com
Operating system: Centos - 2.6.18/x86_64
PHP version:      5.2.9
PHP Bug Type:     Unknown/Other Function
Bug description:  unable to compile static binary using php embed sapi 
(libphp5.a)

Description:
------------
I am trying hard to compile a statically linked binary using php embed
sapi, but it is impossible for me.

PHP Embed Sapi Configuration Options:
./configure --disable-all --with-libdir=lib64 --enable-embed=static

[r...@]# ls -al /usr/local/lib/libphp5.a
-rw-r--r-- 1 root root 15053670 Apr 30 02:11 /usr/local/lib/libphp5.a



Reproduce code:
---------------
nohello.c:
#include <sapi/embed/php_embed.h>

int main(int argc, char *argv[])
{
    PHP_EMBED_START_BLOCK(argc,argv)
    PHP_EMBED_END_BLOCK()

    return 0;
}

[r...@]# gcc -I/usr/local/include/php/ -I/usr/local/include/php/main
-I/usr/local/include/php/Zend -I/usr/local/include/php/TSRM
-I/usr/local/include/php/sapi/embed -L/usr/local/lib -Wall -Wextra
-lpthread -static -ggdb -o nohello nohello.c /usr/local/lib/libphp5.a

Expected result:
----------------
A statically linked binary: nohello

Actual result:
--------------
/usr/local/lib/libphp5.a(filestat.o): In function `php_do_chgrp':
/root/php529modified/ext/standard/filestat.c:420: warning: Using
'getgrnam' in statically linked applications requires at runtime the shared
libraries from $
/usr/local/lib/libphp5.a(fopen_wrappers.o): In function
`php_fopen_primary_script':
/root/php529modified/main/fopen_wrappers.c:369: warning: Using 'getpwnam'
in statically linked applications requires at runtime the shared libraries
from th$
/usr/local/lib/libphp5.a(safe_mode.o): In function
`php_get_current_user':
/root/php529modified/main/safe_mode.c:255: warning: Using 'getpwuid' in
statically linked applications requires at runtime the shared libraries
from the gli$
/usr/local/lib/libphp5.a(network.o): In function
`php_network_getaddresses':
/root/php529modified/main/network.c:204: warning: Using 'getaddrinfo' in
statically linked applications requires at runtime the shared libraries
from the gl$
/usr/local/lib/libphp5.a(dns.o): In function `php_gethostbyaddr':
/root/php529modified/ext/standard/dns.c:161: warning: Using
'gethostbyaddr' in statically linked applications requires at runtime the
shared libraries from $
/usr/local/lib/libphp5.a(dns.o): In function `php_gethostbyname':
/root/php529modified/ext/standard/dns.c:235: warning: Using
'gethostbyname' in statically linked applications requires at runtime the
shared libraries from $
/usr/local/lib/libphp5.a(basic_functions.o): In function
`zif_getprotobynumber':
/root/php529modified/ext/standard/basic_functions.c:6016: warning: Using
'getprotobynumber' in statically linked applications requires at runtime
the shared$
/usr/local/lib/libphp5.a(basic_functions.o): In function
`zif_getprotobyname':
/root/php529modified/ext/standard/basic_functions.c:5989: warning: Using
'getprotobyname' in statically linked applications requires at runtime the
shared l$
/usr/local/lib/libphp5.a(basic_functions.o): In function
`zif_getservbyname':
/root/php529modified/ext/standard/basic_functions.c:5938: warning: Using
'getservbyname' in statically linked applications requires at runtime the
shared li$
/usr/local/lib/libphp5.a(basic_functions.o): In function
`zif_getservbyport':
/root/php529modified/ext/standard/basic_functions.c:5963: warning: Using
'getservbyport' in statically linked applications requires at runtime the
shared li$
/usr/local/lib/libphp5.a(zend_operators.o): In function
`zend_string_to_double':
/root/php529modified/Zend/zend_operators.c:108: undefined reference to
`pow'
/usr/local/lib/libphp5.a(zend_API.o): In function `module_destructor':
/root/php529modified/Zend/zend_API.c:1947: undefined reference to
`dlclose'
/usr/local/lib/libphp5.a(zend_extensions.o): In function
`zend_load_extension':
/root/php529modified/Zend/zend_extensions.c:34: undefined reference to
`dlopen'
/root/php529modified/Zend/zend_extensions.c:44: undefined reference to
`dlsym'
/root/php529modified/Zend/zend_extensions.c:48: undefined reference to
`dlsym'
/root/php529modified/Zend/zend_extensions.c:79: undefined reference to
`dlclose'
/root/php529modified/Zend/zend_extensions.c:54: undefined reference to
`dlclose'
/root/php529modified/Zend/zend_extensions.c:46: undefined reference to
`dlsym'
/root/php529modified/Zend/zend_extensions.c:50: undefined reference to
`dlsym'
/root/php529modified/Zend/zend_extensions.c:37: undefined reference to
`dlerror'
/root/php529modified/Zend/zend_extensions.c:94: undefined reference to
`dlclose'
/root/php529modified/Zend/zend_extensions.c:67: undefined reference to
`dlclose'
/usr/local/lib/libphp5.a(zend_extensions.o): In function
`zend_extension_dtor':
/root/php529modified/Zend/zend_extensions.c:175: undefined reference to
`dlclose'
/usr/local/lib/libphp5.a(php_date.o): In function `date_format':
/root/php529modified/ext/date/php_date.c:810: undefined reference to
`floor'
/usr/local/lib/libphp5.a(php_date.o): In function
`php_do_date_sunrise_sunset':
/root/php529modified/ext/date/php_date.c:2457: undefined reference to
`floor'
----------
-------------------------
-----------------------------------------------
a bunch of "undefined reference to" error
-----------------------------------------------
-------------------------
----------
/usr/local/lib/libphp5.a(uuencode.o): In function `php_uuencode':
/root/php529modified/ext/standard/uuencode.c:74: undefined reference to
`ceil'
/root/php529modified/ext/standard/uuencode.c:84: undefined reference to
`floor'
/usr/local/lib/libphp5.a(uuencode.o): In function `php_uudecode':
/root/php529modified/ext/standard/uuencode.c:132: undefined reference to
`ceil'
/root/php529modified/ext/standard/uuencode.c:147: undefined reference to
`floor'
collect2: ld returned 1 exit status



-- 
Edit bug report at http://bugs.php.net/?id=48118&edit=1
-- 
Try a CVS snapshot (PHP 5.2):        
http://bugs.php.net/fix.php?id=48118&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):        
http://bugs.php.net/fix.php?id=48118&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):        
http://bugs.php.net/fix.php?id=48118&r=trysnapshot60
Fixed in CVS:                        
http://bugs.php.net/fix.php?id=48118&r=fixedcvs
Fixed in CVS and need be documented: 
http://bugs.php.net/fix.php?id=48118&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=48118&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=48118&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=48118&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=48118&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=48118&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=48118&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=48118&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=48118&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=48118&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=48118&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=48118&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=48118&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=48118&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=48118&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=48118&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=48118&r=mysqlcfg

Reply via email to