ID: 48118 User updated by: mukustr at yahoo dot com Reported By: mukustr at yahoo dot com Status: Bogus Bug Type: Compile Failure Operating System: Centos - 2.6.18/x86_64 PHP Version: 5.2.9 New Comment:
I think this is about mysql is not compiled with "-lpthread". Whatever I am new to compiling as you see, php-emded thing must be more documented. Thank you very much. Previous Comments: ------------------------------------------------------------------------ [2009-05-02 10:23:29] mukustr at yahoo dot com Thank you, but the problem still exists; # gcc `/usr/local/bin/php-config --includes` `/usr/local/bin/php-config --ldflags` -Wall -Wextra -ggdb -static -static-libgcc -o sample hello.c -L/usr/local/lib -lphp5 -lpthread `/usr/local/bin/php-config --libs` /usr/lib64/mysql/libmysqlclient_r.a(my_thr_init.o): In function `my_thread_end': (.text+0x65): undefined reference to `pthread_cond_destroy' /usr/lib64/mysql/libmysqlclient_r.a(my_thr_init.o): In function `my_thread_end': (.text+0xb6): undefined reference to `pthread_cond_signal' /usr/lib64/mysql/libmysqlclient_r.a(my_thr_init.o): In function `my_thread_init': (.text+0x116): undefined reference to `pthread_cond_init' /usr/lib64/mysql/libmysqlclient_r.a(my_thr_init.o): In function `my_thread_global_end': (.text+0x1ba): undefined reference to `pthread_cond_timedwait' /usr/lib64/mysql/libmysqlclient_r.a(my_thr_init.o): In function `my_thread_global_end': (.text+0x1f1): undefined reference to `pthread_mutexattr_destroy' /usr/lib64/mysql/libmysqlclient_r.a(my_thr_init.o): In function `my_thread_global_end': (.text+0x1fb): undefined reference to `pthread_mutexattr_destroy' /usr/lib64/mysql/libmysqlclient_r.a(my_thr_init.o): In function `my_thread_global_end': (.text+0x28d): undefined reference to `pthread_mutexattr_destroy' /usr/lib64/mysql/libmysqlclient_r.a(my_thr_init.o): In function `my_thread_global_end': (.text+0x297): undefined reference to `pthread_mutexattr_destroy' /usr/lib64/mysql/libmysqlclient_r.a(my_thr_init.o): In function `my_thread_global_end': (.text+0x2fb): undefined reference to `pthread_cond_destroy' /usr/lib64/mysql/libmysqlclient_r.a(my_thr_init.o): In function `my_thread_global_init': (.text+0x3ad): undefined reference to `pthread_mutexattr_init' /usr/lib64/mysql/libmysqlclient_r.a(my_thr_init.o): In function `my_thread_global_init': ------------------------------------------------------------------------ [2009-05-01 19:37:05] [email protected] This is not any bug in PHP. When you build static stuff, the order of libraries is significant. This works fine: # gcc \ `/usr/local/bin/php-config --includes` `/usr/local/bin/php-config --ldflags` -Wall -Wextra -ggdb -static -o nohello nohello.c \ -L/usr/local/lib -lphp5 `/usr/local/bin/php-config --libs` ------------------------------------------------------------------------ [2009-04-29 22:43:49] mukustr at yahoo dot com 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 this bug report at http://bugs.php.net/?id=48118&edit=1
