NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
Problem building shared library on MacOS X 10.2.6


Joined: 09 Sep 2003
Posts: 6
Reply with quote
I'm having some trouble installing an actual dbg.so file on MacOS X 10.2.6 with PHP 4.3.2 and DBG 2.11.23. All it is creating is dbg.a and dbg.la files in the <src>/modules directory. Is there anything specific to Mac OS X that I have to do to make the shared library? I'm following the INSTALL directions to the tee.

Thanks,

David
View user's profileFind all posts by dwstevensSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 7857
Reply with quote
please send me configure log.
View user's profileFind all posts by dmitriSend private messageVisit poster's website


Joined: 09 Sep 2003
Posts: 6
Reply with quote
Ok, I got the dbg.so created. I had to create a symbolic link to glibtoolize. That did the trick. Now I'm getting this in the php_error_log:

[10-Sep-2003 07:02:03] PHP Warning: Unknown(): Unable to load dynamic library '/usr/local/Zend/modules/dbg.so' - (null) in Unknown on line 0
[10-Sep-2003 07:02:03] PHP Warning: Unknown(): Unable to load dynamic library '/usr/local/Zend/modules/dbg.so' - (null) in Unknown on line 0


I added this to the php.ini file:

extension_dir = /usr/local/Zend/modules
extension=dbg.so

[Debugger]
debugger.enabled=on
debugger.profiler_enabled=on

[Zend]
zend_optimizer.optimization_level=15
zend_extension=/usr/local/Zend/modules/dbg.so
zend_extension=/usr/local/Zend/lib/Optimizer-2.1.0/php-4.3.2/ZendOptimizer.so

Any suggestions?

Thanks,

David
View user's profileFind all posts by dwstevensSend private message


Joined: 09 Sep 2003
Posts: 6
Reply with quote
Ok, installed PHP 4.3.3, recompiled DBG and now I'm getting this error:

[10-Sep-2003 07:27:11] PHP Warning: Unknown(): Unable to load dynamic library '/usr/local/Zend/modules/dbg.so' - not a Mach-O MH_BUNDLE file type in Unknown on line 0
[10-Sep-2003 07:27:11] PHP Warning: Unknown(): Unable to load dynamic library '/usr/local/Zend/modules/dbg.so' - not a Mach-O MH_BUNDLE file type in Unknown on line 0

I think I may be getting closer, any thoughts?

Thanks,

David
View user's profileFind all posts by dwstevensSend private message


Joined: 09 Sep 2003
Posts: 6
Reply with quote
Ok, read up on .so and .dylib in Mac OS X. I tried to create a dbg.dylib "dynamic library" using this command:

[gravelOne:~dwstevens/Desktop/dbg-2.11.23-src] dwstevens# libtool -install_name /usr/local/Zend/modules/dbg.dylib -dynamic -current_version 1.0.0 -compatibility_version 1.0.0 -dylib_file dbg.dylib:/usr/local/Zend/modules/dbg.dylib -lz -lc -o dbg.dylib dbg.o dbg_bp.o dbg_cmd.o dbg_net.o dbg_prof.o dbg_ser.o /usr/lib/libcc_dynamic.a

And I got this result:

ld: for architecture ppc
ld: Undefined symbols:
_OnUpdateInt
_OnUpdateString
__convert_to_string
__efree
__erealloc
__estrdup
__zend_bailout
_ap_php_snprintf
_compiler_globals
_display_ini_entries
_executor_globals
_php_info_print_table_end
_php_info_print_table_row
_php_info_print_table_start
_php_printf
_sapi_globals
_sapi_module
_zend_error_cb
_zend_extensions
_zend_get_extension
_zend_get_parameters
_zend_hash_find
_zend_hash_get_current_data_ex
_zend_hash_get_current_key_ex
_zend_hash_internal_pointer_reset_ex
_zend_hash_move_forward_ex
_zend_ini_boolean_displayer_cb
_zend_llist_add_element
_zend_llist_del_element
_zend_llist_destroy
_zend_llist_init
_zend_register_extension
_zend_register_ini_entries
_zend_unregister_ini_entries
_zend_wrong_param_count
__emalloc
__zval_copy_ctor
_convert_to_boolean
_zend_eval_string
__estrndup
__php_stream_open_wrapper_as_file
__zval_dtor
_get_active_function_name
_sapi_add_header_ex
_zend_get_compiled_filename
_zend_get_compiled_lineno
_zend_get_executed_filename
_zend_get_executed_lineno
_zend_is_compiling
_zend_is_executing
_zend_set_timeout
_zend_unset_timeout
__array_init
_convert_to_long
_zend_get_parameters_ex
_zend_hash_add_or_update
_zend_hash_index_update_or_next_insert
_zend_hash_destroy
_zend_hash_init
_zend_hash_num_elements
_zend_rsrc_list_get_rsrc_type
libtool: internal link edit command failed


Still looking...

Dave
View user's profileFind all posts by dwstevensSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 7857
Reply with quote
all these symbols are imported from the php engine which is either php executable or php4apache.so in case if you run apache module or whatsoever php SAPI module you use.
View user's profileFind all posts by dmitriSend private messageVisit poster's website


Joined: 09 Sep 2003
Posts: 6
Reply with quote
Has anyone used DBG on Mac OS X that you know of? I think the problem has something to do with how the shared object is created. I'm not positive, but I think Mac OS X needs .dylib files instead of .so.

I've been playing with the makefile in an attempt to generate a valid Mac OS X dynamic library.

Dave
View user's profileFind all posts by dwstevensSend private message


Joined: 09 Sep 2003
Posts: 6
Reply with quote
Ok, with a little hacking of the Makefile, I got it to compile a dbg.so file that worked with PHP 4.3.3 on Mac OS X.

Here is the Makefile:

Code:

srcdir = /Users/dwstevens/Desktop/dbg-2.11.23-src
builddir = /Users/dwstevens/Desktop/dbg-2.11.23-src
top_srcdir = /Users/dwstevens/Desktop/dbg-2.11.23-src
top_builddir = /Users/dwstevens/Desktop/dbg-2.11.23-src
SHLIB_SUFFIX_NAME = so
shared_objects_dbg = dbg.lo dbg_cmd.lo dbg_ser.lo dbg_prof.lo dbg_net.lo dbg_bp.lo
PHP_MODULES = $(phplibdir)/dbg.la
all_targets = $(PHP_MODULES)
install_targets = install-modules
prefix = /usr
exec_prefix = $(prefix)
libdir = ${exec_prefix}/lib
prefix = /usr
phplibdir = /Users/dwstevens/Desktop/dbg-2.11.23-src/modules
PHP_COMPILE =
CC = /usr/bin/gcc
CFLAGS = -g -O2 -dynamic
CFLAGS_CLEAN = -g -O2 -dynamic
CPP = /usr/bin/gcc -E
CPPFLAGS = -DHAVE_CONFIG_H -DHAVE_CONFIG_H
CXX =
DEFS =
EXTENSION_DIR = /usr/lib/php/extensions/no-debug-non-zts-20020429
EXTRA_LDFLAGS =
EXTRA_LIBS =
INCLUDES = -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/Zend -I/usr/include/php/TSRM
LEX =
LEX_OUTPUT_ROOT =
LFLAGS =
LDFLAGS =
SHARED_LIBTOOL =
LIBTOOL = $(SHELL) /usr/bin/glibtool
SHELL = /bin/sh
AWK = awk
mkinstalldirs = $(top_srcdir)/build/shtool mkdir -p
INSTALL = $(top_srcdir)/build/shtool install -c
INSTALL_DATA = $(INSTALL) -m 644

DEFS = -DPHP_ATOM_INC -I$(top_builddir)/include -I$(top_builddir)/main -I$(top_srcdir)
COMMON_FLAGS = $(DEFS) $(INCLUDES) $(EXTRA_INCLUDES) $(CPPFLAGS) $(PHP_FRAMEWORKPATH)


all: dbg.la
   @echo
   @echo "Build complete."
   @echo "(It is safe to ignore warnings about tempnam and tmpnam)."
   @echo
   
build-modules: $(PHP_MODULES)

clean:
   find . -name \*.lo | xargs rm -f
   find . -name \*.o | xargs rm -f
   find . -name \*.la | xargs rm -f
   find . -name \*.a | xargs rm -f
   find . -name \*.so | xargs rm -f
   find . -name .libs -a -type d|xargs rm -rf
   rm -f libphp4.la $(SAPI_CLI_PATH) $(OVERALL_TARGET) modules/* libs/*

distclean: clean
   rm -f config.cache config.log config.status Makefile.objects Makefile.fragments libtool main/php_config.h stamp-h php4.spec sapi/apache/libphp4.module buildmk.stamp
   egrep define'.*include/php' configure|sed 's/.*>//'|xargs rm -f
   find . -name Makefile | xargs rm -f


.PHONY: all clean install distclean test
.NOEXPORT:
dbg.lo: /Users/dwstevens/Desktop/dbg-2.11.23-src/dbg.c
   $(CC)  -I. -I/Users/dwstevens/Desktop/dbg-2.11.23-src $(COMMON_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) -c /Users/dwstevens/Desktop/dbg-2.11.23-src/dbg.c -o dbg.lo
dbg_cmd.lo: /Users/dwstevens/Desktop/dbg-2.11.23-src/dbg_cmd.c
   $(CC)  -I. -I/Users/dwstevens/Desktop/dbg-2.11.23-src $(COMMON_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) -c /Users/dwstevens/Desktop/dbg-2.11.23-src/dbg_cmd.c -o dbg_cmd.lo
dbg_ser.lo: /Users/dwstevens/Desktop/dbg-2.11.23-src/dbg_ser.c
   $(CC)  -I. -I/Users/dwstevens/Desktop/dbg-2.11.23-src $(COMMON_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) -c /Users/dwstevens/Desktop/dbg-2.11.23-src/dbg_ser.c -o dbg_ser.lo
dbg_prof.lo: /Users/dwstevens/Desktop/dbg-2.11.23-src/dbg_prof.c
   $(CC)  -I. -I/Users/dwstevens/Desktop/dbg-2.11.23-src $(COMMON_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) -c /Users/dwstevens/Desktop/dbg-2.11.23-src/dbg_prof.c -o dbg_prof.lo
dbg_net.lo: /Users/dwstevens/Desktop/dbg-2.11.23-src/dbg_net.c
   $(CC)  -I. -I/Users/dwstevens/Desktop/dbg-2.11.23-src $(COMMON_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) -c /Users/dwstevens/Desktop/dbg-2.11.23-src/dbg_net.c -o dbg_net.lo
dbg_bp.lo: /Users/dwstevens/Desktop/dbg-2.11.23-src/dbg_bp.c
   $(CC)  -I. -I/Users/dwstevens/Desktop/dbg-2.11.23-src $(COMMON_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) -c /Users/dwstevens/Desktop/dbg-2.11.23-src/dbg_bp.c -o dbg_bp.lo

./dbg.la: $(shared_objects_dbg) $(DBG_SHARED_DEPENDENCIES)
   $(CC) -bundle -flat_namespace -undefined suppress -o dbg.so dbg.lo dbg_bp.lo  dbg_cmd.lo  dbg_net.lo  dbg_prof.lo  dbg_ser.lo





That did the trick! Next just copy the dbg.so file out of the main dbg source directory to your module directory and follow the rest of the install instructions!

Cool stuff.

Dave
View user's profileFind all posts by dwstevensSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 7857
Reply with quote
Please contact Sascha Schumann <sascha AT schumann DOT cx>
or better contact php group in php.internals forum and tell them what you did and what you patched to compile php extension under MacOSX.
Hope they will include necessary fixes in the next php release.
Thanks.
View user's profileFind all posts by dmitriSend private messageVisit poster's website
Problem building shared library on MacOS X 10.2.6
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic