LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 05-29-2012, 05:17 PM   #1
eantoranz
Senior Member
 
Registered: Apr 2003
Location: Colombia
Distribution: Kubuntu, Debian, Knoppix
Posts: 1,982
Blog Entries: 1

Rep: Reputation: 83
where are apache symbols?


Hi!

I'm trying to build phc and I find that in the configuration process, there's an error when checking for something about zend strings.... because of missing symbols (related to apache). I hacked the configure script just to see what happened and it finished successfully... however, when I try to compile phc, I get the same problem with apache symbols:

Code:
/bin/bash ./libtool --tag=CXX   --mode=link g++ -Wextra -Wno-unused-parameter -Wno-write-strings -Wno-deprecated -g -O2 -export-dynamic  -o src/phc phc.o -lgc -lgccpp -lltdl -lboost_regex-mt libphc.la -lxerces-c  -lgccpp -lgc -lphp5 -L/usr/local/php/lib -ldl -lboost_regex
chmod 755 src/phc_compile_plugin
libtool: link: g++ -Wextra -Wno-unused-parameter -Wno-write-strings -Wno-deprecated -g -O2 -o src/.libs/phc phc.o -Wl,--export-dynamic  /usr/lib/i386-linux-gnu/libltdl.so -lboost_regex-mt ./.libs/libphc.so -L/usr/lib -L/usr/local/php/lib /usr/lib/libxerces-c.so -lnsl -lpthread -lgccpp -lgc -lphp5 -ldl -lboost_regex -Wl,-rpath -Wl,/usr/local/phc/lib
/usr/local/php/lib/libphp5.so: undefined reference to `ap_get_server_version'
/usr/local/php/lib/libphp5.so: undefined reference to `ap_sub_req_lookup_uri'
/usr/local/php/lib/libphp5.so: undefined reference to `ap_pass_brigade'
/usr/local/php/lib/libphp5.so: undefined reference to `apr_bucket_eos_create'
/usr/local/php/lib/libphp5.so: undefined reference to `ap_loaded_modules'
/usr/local/php/lib/libphp5.so: undefined reference to `apr_pool_cleanup_null'
/usr/local/php/lib/libphp5.so: undefined reference to `ap_rflush'
/usr/local/php/lib/libphp5.so: undefined reference to `ap_add_common_vars'
/usr/local/php/lib/libphp5.so: undefined reference to `ap_log_error'
/usr/local/php/lib/libphp5.so: undefined reference to `ap_update_mtime'
/usr/local/php/lib/libphp5.so: undefined reference to `ap_set_content_length'
/usr/local/php/lib/libphp5.so: undefined reference to `ap_run_sub_req'
/usr/local/php/lib/libphp5.so: undefined reference to `apr_pool_userdata_get'
/usr/local/php/lib/libphp5.so: undefined reference to `ap_add_version_component'
/usr/local/php/lib/libphp5.so: undefined reference to `apr_pool_userdata_set'
/usr/local/php/lib/libphp5.so: undefined reference to `apr_palloc'
/usr/local/php/lib/libphp5.so: undefined reference to `apr_brigade_flatten'
/usr/local/php/lib/libphp5.so: undefined reference to `apr_pstrdup'
/usr/local/php/lib/libphp5.so: undefined reference to `ap_mpm_query'
/usr/local/php/lib/libphp5.so: undefined reference to `ap_server_root_relative'
/usr/local/php/lib/libphp5.so: undefined reference to `ap_hook_child_init'
/usr/local/php/lib/libphp5.so: undefined reference to `ap_server_root'
/usr/local/php/lib/libphp5.so: undefined reference to `apr_brigade_create'
/usr/local/php/lib/libphp5.so: undefined reference to `apr_table_elts'
/usr/local/php/lib/libphp5.so: undefined reference to `apr_snprintf'
/usr/local/php/lib/libphp5.so: undefined reference to `ap_log_rerror'
/usr/local/php/lib/libphp5.so: undefined reference to `ap_auth_type'
/usr/local/php/lib/libphp5.so: undefined reference to `ap_add_cgi_vars'
/usr/local/php/lib/libphp5.so: undefined reference to `ap_hook_pre_config'
/usr/local/php/lib/libphp5.so: undefined reference to `apr_table_set'
/usr/local/php/lib/libphp5.so: undefined reference to `apr_table_unset'
/usr/local/php/lib/libphp5.so: undefined reference to `apr_brigade_cleanup'
/usr/local/php/lib/libphp5.so: undefined reference to `ap_set_content_type'
/usr/local/php/lib/libphp5.so: undefined reference to `apr_pool_cleanup_register'
/usr/local/php/lib/libphp5.so: undefined reference to `ap_hook_post_config'
/usr/local/php/lib/libphp5.so: undefined reference to `apr_pool_cleanup_run'
/usr/local/php/lib/libphp5.so: undefined reference to `apr_psprintf'
/usr/local/php/lib/libphp5.so: undefined reference to `ap_hook_handler'
/usr/local/php/lib/libphp5.so: undefined reference to `apr_table_add'
/usr/local/php/lib/libphp5.so: undefined reference to `apr_table_get'
/usr/local/php/lib/libphp5.so: undefined reference to `ap_set_last_modified'
/usr/local/php/lib/libphp5.so: undefined reference to `unixd_config'
/usr/local/php/lib/libphp5.so: undefined reference to `ap_get_brigade'
/usr/local/php/lib/libphp5.so: undefined reference to `ap_destroy_sub_req'
/usr/local/php/lib/libphp5.so: undefined reference to `ap_rwrite'
collect2: ld returned 1 exit status
make[2]: *** [src/phc] Error 1
make[2]: Leaving directory `/home/antoranz/Descargas/php/phc/phc-0.3.0.1'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/antoranz/Descargas/php/phc/phc-0.3.0.1'
make: *** [all] Error 2
Where are those symbols defined? Thanks in advance.
 
Old 05-29-2012, 05:33 PM   #2
eantoranz
Senior Member
 
Registered: Apr 2003
Location: Colombia
Distribution: Kubuntu, Debian, Knoppix
Posts: 1,982
Blog Entries: 1

Original Poster
Rep: Reputation: 83
Fairly interesting... the symbols are in libphp5 from the php5.2 I installed:

Code:
$ nm -gC /usr/local/php/lib/libphp5.so  | grep " apr"
         U apr_brigade_cleanup
         U apr_brigade_create
         U apr_brigade_flatten
         U apr_bucket_eos_create
         U apr_palloc
         U apr_pool_cleanup_null
         U apr_pool_cleanup_register
         U apr_pool_cleanup_run
         U apr_pool_userdata_get
         U apr_pool_userdata_set
         U apr_psprintf
         U apr_pstrdup
         U apr_snprintf
         U apr_table_add
         U apr_table_elts
         U apr_table_get
         U apr_table_set
         U apr_table_unset
Then why the hell can't the linker see it? Hell!
 
Old 05-29-2012, 05:37 PM   #3
eantoranz
Senior Member
 
Registered: Apr 2003
Location: Colombia
Distribution: Kubuntu, Debian, Knoppix
Posts: 1,982
Blog Entries: 1

Original Poster
Rep: Reputation: 83
Oh.... I see it.... U is for 'undefined'... so they must be defined somwehere else, ain't that right?
 
Old 05-29-2012, 05:43 PM   #4
eantoranz
Senior Member
 
Registered: Apr 2003
Location: Colombia
Distribution: Kubuntu, Debian, Knoppix
Posts: 1,982
Blog Entries: 1

Original Poster
Rep: Reputation: 83
I just checked all so files in my box and there are no symbols with those names anywhere.... what's the trick then?
 
Old 05-29-2012, 08:10 PM   #5
eantoranz
Senior Member
 
Registered: Apr 2003
Location: Colombia
Distribution: Kubuntu, Debian, Knoppix
Posts: 1,982
Blog Entries: 1

Original Poster
Rep: Reputation: 83
Reading this article shed some light on what's going on: http://blog.flameeyes.eu/2010/09/you...efined-symbols


So in phc's configure I'm defining those symbols as undefinded:

Code:
LDFLAGS="-u ap_hook_child_init -u apr_table_elts -u apr_table_unset -u apr_pool_cleanup_register -u ap_rflush -u ap_pass_brigade -u apr_brigade_create -u ap_sub_req_lookup_uri -u ap_server_root -u apr_pool_cleanup_null -u ap_destroy_sub_req -u ap_mpm_query -u ap_add_cgi_vars -u ap_set_last_modified -u ap_set_content_length -u ap_hook_post_config -u ap_get_server_version -u apr_pool_userdata_get -u ap_hook_handler -u ap_rwrite -u apr_psprintf -u apr_palloc -u apr_brigade_cleanup -u unixd_config -u apr_snprintf -u ap_get_brigade -u ap_add_common_vars -u apr_table_add -u apr_bucket_eos_create -u ap_add_version_component -u ap_log_error -u ap_hook_pre_config -u apr_pool_userdata_set -u apr_pool_cleanup_run -u apr_pstrdup -u ap_set_content_type -u apr_table_get -u ap_run_sub_req -u ap_loaded_modules -u ap_server_root_relative -u apr_table_set -u ap_update_mtime -u apr_brigade_flatten -u ap_log_rerror -u ap_auth_type" ./configure --with-php=/usr/local/php --prefix=/usr/local/phc
I'm facing a problem of another kind so when I finish compiling (or it fails), I'll let you know.
 
Old 05-29-2012, 09:59 PM   #6
eantoranz
Senior Member
 
Registered: Apr 2003
Location: Colombia
Distribution: Kubuntu, Debian, Knoppix
Posts: 1,982
Blog Entries: 1

Original Poster
Rep: Reputation: 83
Compilation was successful... but then it wasn't going to give itself away so easily, would it?

Code:
$ /usr/local/phc/bin/phc -c Hello.php -o hello-world
/usr/local/phc/bin/phc: symbol lookup error: /usr/local/php/lib/libphp5.so: undefined symbol: apr_pool_cleanup_null
So.... what can I try next?
 
Old 05-30-2012, 09:34 AM   #7
eantoranz
Senior Member
 
Registered: Apr 2003
Location: Colombia
Distribution: Kubuntu, Debian, Knoppix
Posts: 1,982
Blog Entries: 1

Original Poster
Rep: Reputation: 83
I think I almost nailed... though without the apache symbols.

The thing is that in order to build phc, I'll have to use php _without_ apache module support. But then, in order to build my phc-compiled shared library as a php module, I'll have to use php _with_ apache.... so how about having two separate compilations of PHP? One with apache and one without?

I just tried. I compiled phc against php without apache and it works fine. Then I compiled the c code generated against php with apache. Then, I modified php.ini to include this extension, then I restarted apache, I saw this in error.log

Code:
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/php/lib/php/extensions/no-debug-zts-20060613/helloworld.so' - /usr/local/php/lib/php/extensions/no-debug-zts-20060613/helloworld.so: undefined symbol: compiler_globals in Unknown on line 0
What am I missing now?
 
Old 05-30-2012, 10:28 AM   #8
eantoranz
Senior Member
 
Registered: Apr 2003
Location: Colombia
Distribution: Kubuntu, Debian, Knoppix
Posts: 1,982
Blog Entries: 1

Original Poster
Rep: Reputation: 83
Now, this is very interesting. I built and enabled the module in php full (meaning, with apache support).

When I ask php for information about this module it says the module can¿t be loaded because __MAIN__ is not defined.

Code:
$ /usr/local/php/bin/php --re helloworld
PHP Warning:  Internal error: Cannot find extension function __MAIN__ in global function table in Unknown on line 0
Extension [ <persistent> extension #24 helloworld version 1.0 ] {

  - Functions {
  }
}
There are some __MAIN__ symbols in the so:
Code:
$ nm -gC modules/helloworld.so | grep MAIN
00004180 B helloworld___MAIN___arg_info
000010b0 T zif___MAIN__
What did I miss now?
 
Old 05-30-2012, 11:34 AM   #9
eantoranz
Senior Member
 
Registered: Apr 2003
Location: Colombia
Distribution: Kubuntu, Debian, Knoppix
Posts: 1,982
Blog Entries: 1

Original Poster
Rep: Reputation: 83
This is very interesting.... I built a tiny extension following this example: http://devzone.zend.com/303/extensio...-php-and-zend/

Look at the symbols in the file:
Code:
$ nm -gC modules/hello.so
         w _Jv_RegisterClasses
000020c8 A __bss_start
         w __cxa_finalize@@GLIBC_2.1.3
         w __gmon_start__
000020c8 A _edata
000020d0 A _end
         U _estrndup
00000588 T _fini
000003a4 T _init
00000530 T get_module
00002040 D hello_module_entry
000004e0 T zif_hello_world
So... there's no __MAIN__ stuff or something like that... I thought that was kind of mandatory.... and that makes me think that probably the code generated by phc has a problem... what a crash course.

Last edited by eantoranz; 05-30-2012 at 11:37 AM. Reason: Forgot to include link
 
  


Reply

Tags
apache, missing, phc, shared object, symbols


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
'nm' lists all symbols - including static library symbols painulyarun Programming 4 04-06-2010 04:04 AM
Debugger selectively not using symbols in library with symbols Millenniumman Programming 5 03-25-2007 09:44 AM
Debugger selectively not using symbols in library with symbols Millenniumman Programming 1 03-03-2007 07:46 PM
vi symbols mean? curos Linux - Software 3 01-03-2007 07:35 PM


All times are GMT -5. The time now is 05:36 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration