php driver on Mac OS X Lion against php 5.4

115 views
Skip to first unread message

Scott Aubrey

unread,
Aug 8, 2011, 6:56:45 AM8/8/11
to mongodb-dev
Hi Guys

I hope someone will be able to help me, though i realise I'm asking
for trouble trying to build against 5.4. I also have *no* experience
with C programming, making this harder I'm sure ;)

So, when i try to build 1.2.2 driver against php 5.4 (a branch
revision, not a alpha release), I get the following error:

cc -I./util -I. -I/Users/scottaubrey/src/mongo-php-driver -
DPHP_ATOM_INC -I/Users/scottaubrey/src/mongo-php-driver/include -I/
Users/scottaubrey/src/mongo-php-driver/main -I/Users/scottaubrey/src/
mongo-php-driver -I/Users/scottaubrey/.usr//include/php -I/Users/
scottaubrey/.usr//include/php/main -I/Users/scottaubrey/.usr//include/
php/TSRM -I/Users/scottaubrey/.usr//include/php/Zend -I/Users/
scottaubrey/.usr//include/php/ext -I/Users/scottaubrey/.usr//include/
php/ext/date/lib -I/Users/scottaubrey/src/mongo-php-driver/util -
DHAVE_CONFIG_H -arch x86_64 -arch i386 -arch x86_64 -arch ppc -arch
ppc64 -c /Users/scottaubrey/src/mongo-php-driver/mongo.c -DPIC
In file included from /Users/scottaubrey/src/mongo-php-driver/mongo.c:
46:
/Users/scottaubrey/src/mongo-php-driver/php_mongo.h:487: error:
expected declaration specifiers or ‘...’ before ‘list_entry’
/Users/scottaubrey/src/mongo-php-driver/mongo.c:138: error: expected
‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘mongo_functions’
/Users/scottaubrey/src/mongo-php-driver/mongo.c:144: error: expected
‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘mongo_methods’
/Users/scottaubrey/src/mongo-php-driver/mongo.c:178: error:
‘mongo_functions’ undeclared here (not in a function)
/Users/scottaubrey/src/mongo-php-driver/mongo.c:267: error: expected
declaration specifiers or ‘...’ before ‘list_entry’
/Users/scottaubrey/src/mongo-php-driver/mongo.c: In function
‘kill_cursor’:
/Users/scottaubrey/src/mongo-php-driver/mongo.c:277: error: ‘le’
undeclared (first use in this function)
/Users/scottaubrey/src/mongo-php-driver/mongo.c:277: error: (Each
undeclared identifier is reported only once
/Users/scottaubrey/src/mongo-php-driver/mongo.c:277: error: for each
function it appears in.)
/Users/scottaubrey/src/mongo-php-driver/mongo.c:277: error: too many
arguments to function ‘php_mongo_free_cursor_node’
/Users/scottaubrey/src/mongo-php-driver/mongo.c:310: error: too many
arguments to function ‘php_mongo_free_cursor_node’
/Users/scottaubrey/src/mongo-php-driver/mongo.c: At top level:
/Users/scottaubrey/src/mongo-php-driver/mongo.c:313: error: expected
declaration specifiers or ‘...’ before ‘list_entry’
/Users/scottaubrey/src/mongo-php-driver/mongo.c: In function
‘php_mongo_free_cursor_node’:
/Users/scottaubrey/src/mongo-php-driver/mongo.c:338: error: ‘le’
undeclared (first use in this function)
/Users/scottaubrey/src/mongo-php-driver/mongo.c: In function
‘php_mongo_free_cursor_le’:
/Users/scottaubrey/src/mongo-php-driver/mongo.c:348: error:
‘list_entry’ undeclared (first use in this function)
/Users/scottaubrey/src/mongo-php-driver/mongo.c:348: error: ‘le’
undeclared (first use in this function)
/Users/scottaubrey/src/mongo-php-driver/mongo.c:365: error: too many
arguments to function ‘kill_cursor’
/Users/scottaubrey/src/mongo-php-driver/mongo.c:371: error: too many
arguments to function ‘kill_cursor’
/Users/scottaubrey/src/mongo-php-driver/mongo.c: In function
‘php_mongo_create_le’:
/Users/scottaubrey/src/mongo-php-driver/mongo.c:386: error:
‘list_entry’ undeclared (first use in this function)
/Users/scottaubrey/src/mongo-php-driver/mongo.c:386: error: ‘le’
undeclared (first use in this function)
/Users/scottaubrey/src/mongo-php-driver/mongo.c:437: error: expected
‘;’ before ‘new_le’
/Users/scottaubrey/src/mongo-php-driver/mongo.c:438: error: ‘new_le’
undeclared (first use in this function)
/Users/scottaubrey/src/mongo-php-driver/mongo.c: In function
‘php_mongo_link_new’:
/Users/scottaubrey/src/mongo-php-driver/mongo.c:741: error:
‘zend_class_entry’ has no member named ‘default_properties’
/Users/scottaubrey/src/mongo-php-driver/mongo.c: In function
‘mongo_init_Mongo’:
/Users/scottaubrey/src/mongo-php-driver/mongo.c:748: error:
‘mongo_methods’ undeclared (first use in this function)
/Users/scottaubrey/src/mongo-php-driver/mongo.c: In function
‘php_mongo_get_reply’:
/Users/scottaubrey/src/mongo-php-driver/mongo.c:2407: error:
‘list_entry’ undeclared (first use in this function)
/Users/scottaubrey/src/mongo-php-driver/mongo.c:2407: error: ‘le’
undeclared (first use in this function)
/Users/scottaubrey/src/mongo-php-driver/mongo.c:2417: error: too many
arguments to function ‘php_mongo_free_cursor_node’
/Users/scottaubrey/src/mongo-php-driver/mongo.c:2469: error: too many
arguments to function ‘php_mongo_free_cursor_node’
In file included from /Users/scottaubrey/src/mongo-php-driver/mongo.c:
46:
/Users/scottaubrey/src/mongo-php-driver/php_mongo.h:487: error:
expected declaration specifiers or ‘...’ before ‘list_entry’
/Users/scottaubrey/src/mongo-php-driver/mongo.c:138: error: expected
‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘mongo_functions’
/Users/scottaubrey/src/mongo-php-driver/mongo.c:144: error: expected
‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘mongo_methods’
/Users/scottaubrey/src/mongo-php-driver/mongo.c:178: error:
‘mongo_functions’ undeclared here (not in a function)
/Users/scottaubrey/src/mongo-php-driver/mongo.c:267: error: expected
declaration specifiers or ‘...’ before ‘list_entry’
/Users/scottaubrey/src/mongo-php-driver/mongo.c: In function
‘kill_cursor’:
/Users/scottaubrey/src/mongo-php-driver/mongo.c:277: error: ‘le’
undeclared (first use in this function)
/Users/scottaubrey/src/mongo-php-driver/mongo.c:277: error: (Each
undeclared identifier is reported only once
/Users/scottaubrey/src/mongo-php-driver/mongo.c:277: error: for each
function it appears in.)
/Users/scottaubrey/src/mongo-php-driver/mongo.c:277: error: too many
arguments to function ‘php_mongo_free_cursor_node’
/Users/scottaubrey/src/mongo-php-driver/mongo.c:310: error: too many
arguments to function ‘php_mongo_free_cursor_node’
/Users/scottaubrey/src/mongo-php-driver/mongo.c: At top level:
/Users/scottaubrey/src/mongo-php-driver/mongo.c:313: error: expected
declaration specifiers or ‘...’ before ‘list_entry’
/Users/scottaubrey/src/mongo-php-driver/mongo.c: In function
‘php_mongo_free_cursor_node’:
/Users/scottaubrey/src/mongo-php-driver/mongo.c:338: error: ‘le’
undeclared (first use in this function)
/Users/scottaubrey/src/mongo-php-driver/mongo.c: In function
‘php_mongo_free_cursor_le’:
/Users/scottaubrey/src/mongo-php-driver/mongo.c:348: error:
‘list_entry’ undeclared (first use in this function)
/Users/scottaubrey/src/mongo-php-driver/mongo.c:348: error: ‘le’
undeclared (first use in this function)
/Users/scottaubrey/src/mongo-php-driver/mongo.c:365: error: too many
arguments to function ‘kill_cursor’
/Users/scottaubrey/src/mongo-php-driver/mongo.c:371: error: too many
arguments to function ‘kill_cursor’
/Users/scottaubrey/src/mongo-php-driver/mongo.c: In function
‘php_mongo_create_le’:
/Users/scottaubrey/src/mongo-php-driver/mongo.c:386: error:
‘list_entry’ undeclared (first use in this function)
/Users/scottaubrey/src/mongo-php-driver/mongo.c:386: error: ‘le’
undeclared (first use in this function)
/Users/scottaubrey/src/mongo-php-driver/mongo.c:437: error: expected
‘;’ before ‘new_le’
/Users/scottaubrey/src/mongo-php-driver/mongo.c:438: error: ‘new_le’
undeclared (first use in this function)
/Users/scottaubrey/src/mongo-php-driver/mongo.c: In function
‘php_mongo_link_new’:
/Users/scottaubrey/src/mongo-php-driver/mongo.c:741: error:
‘zend_class_entry’ has no member named ‘default_properties’
/Users/scottaubrey/src/mongo-php-driver/mongo.c: In function
‘mongo_init_Mongo’:
/Users/scottaubrey/src/mongo-php-driver/mongo.c:748: error:
‘mongo_methods’ undeclared (first use in this function)
/Users/scottaubrey/src/mongo-php-driver/mongo.c: In function
‘php_mongo_get_reply’:
/Users/scottaubrey/src/mongo-php-driver/mongo.c:2407: error:
‘list_entry’ undeclared (first use in this function)
/Users/scottaubrey/src/mongo-php-driver/mongo.c:2407: error: ‘le’
undeclared (first use in this function)
/Users/scottaubrey/src/mongo-php-driver/mongo.c:2417: error: too many
arguments to function ‘php_mongo_free_cursor_node’
/Users/scottaubrey/src/mongo-php-driver/mongo.c:2469: error: too many
arguments to function ‘php_mongo_free_cursor_node’
llvm-gcc-4.2: error trying to exec '/usr/bin/../llvm-gcc-4.2/bin/
powerpc-apple-darwin11-llvm-gcc-4.2': execvp: No such file or
directory
llvm-gcc-4.2: error trying to exec '/usr/bin/../llvm-gcc-4.2/bin/
powerpc-apple-darwin11-llvm-gcc-4.2': execvp: No such file or
directory
lipo: can't figure out the architecture type of: /var/folders/_n/
_rb2rbhs5255c_8683qnh0700000gn/T//ccXMMB2u.out
make: *** [mongo.lo] Error 1

so I updated to the latest commit in the mongo-php-driver repo and
tried again, and got:

cc -I./util -I. -I/Users/scottaubrey/src/mongo-php-driver -
DPHP_ATOM_INC -I/Users/scottaubrey/src/mongo-php-driver/include -I/
Users/scottaubrey/src/mongo-php-driver/main -I/Users/scottaubrey/src/
mongo-php-driver -I/Users/scottaubrey/.usr//include/php -I/Users/
scottaubrey/.usr//include/php/main -I/Users/scottaubrey/.usr//include/
php/TSRM -I/Users/scottaubrey/.usr//include/php/Zend -I/Users/
scottaubrey/.usr//include/php/ext -I/Users/scottaubrey/.usr//include/
php/ext/date/lib -I/Users/scottaubrey/src/mongo-php-driver/util -
DHAVE_CONFIG_H -arch x86_64 -arch i386 -arch x86_64 -arch ppc -arch
ppc64 -c /Users/scottaubrey/src/mongo-php-driver/mongo.c -DPIC
/Users/scottaubrey/src/mongo-php-driver/mongo.c: In function
‘php_mongo_link_new’:
/Users/scottaubrey/src/mongo-php-driver/mongo.c:180: error:
‘zend_class_entry’ has no member named ‘default_properties’
/Users/scottaubrey/src/mongo-php-driver/mongo.c: In function
‘php_mongo_link_new’:
/Users/scottaubrey/src/mongo-php-driver/mongo.c:180: error:
‘zend_class_entry’ has no member named ‘default_properties’

I applied a patch based on a patch for rrd I found on the web,
adjusting for the mongo driver code (sorry this may be a crude
assumption that it should work).

diff --git a/mongo_types.c b/mongo_types.c
--- a/mongo_types.c
+++ b/mongo_types.c
@@ -175,15 +175,11 @@
memset(intern, 0, sizeof(mongo_id));

zend_object_std_init(&intern->std, class_type TSRMLS_CC);
- zend_hash_copy(intern->std.properties,
- &class_type->default_properties,
- (copy_ctor_func_t) zval_add_ref,
- (void *) &tmp,
- sizeof(zval *));
+ object_properties_init(&intern->std, class_type);

retval.handle = zend_objects_store_put(intern,
(zend_objects_store_dtor_t) zend_objects_destroy_object,
- php_mongo_id_free, NULL TSRMLS_CC);
+ (zend_objects_free_object_storage_t)php_mongo_id_free, NULL
TSRMLS_CC);
retval.handlers = &mongo_id_handlers;

return retval;
diff --git a/php_mongo.h b/php_mongo.h
--- a/php_mongo.h
+++ b/php_mongo.h
@@ -157,15 +157,11 @@
memset(intern, 0, sizeof(mongo_obj)); \
\
zend_object_std_init(&intern->std, class_type TSRMLS_CC); \
- zend_hash_copy(intern->std.properties, \
- &class_type->default_properties, \
- (copy_ctor_func_t) zval_add_ref, \
- (void *) &tmp, \
- sizeof(zval *)); \
+ object_properties_init(&intern->std, class_type); \
\
retval.handle = zend_objects_store_put(intern, \
(zend_objects_store_dtor_t) zend_objects_destroy_object, \
- php_##mongo_obj##_free, NULL TSRMLS_CC); \
+ (zend_objects_free_object_storage_t)php_##mongo_obj##_free, NULL
TSRMLS_CC); \
retval.handlers = &mongo_default_handlers; \
\
return retval;


and now I get :


/bin/sh /Users/scottaubrey/src/mongo-php-driver/libtool --mode=link cc
-DPHP_ATOM_INC -I/Users/scottaubrey/src/mongo-php-driver/include -I/
Users/scottaubrey/src/mongo-php-driver/main -I/Users/scottaubrey/src/
mongo-php-driver -I/Users/scottaubrey/.usr//include/php -I/Users/
scottaubrey/.usr//include/php/main -I/Users/scottaubrey/.usr//include/
php/TSRM -I/Users/scottaubrey/.usr//include/php/Zend -I/Users/
scottaubrey/.usr//include/php/ext -I/Users/scottaubrey/.usr//include/
php/ext/date/lib -I/Users/scottaubrey/src/mongo-php-driver/util -
DHAVE_CONFIG_H -arch x86_64 -arch i386 -arch x86_64 -mmacosx-version-
min=10.5 -arch x86_64 -o mongo.la -export-dynamic -avoid-version -
prefer-pic -module -rpath /Users/scottaubrey/src/mongo-php-driver/
modules php_mongo.lo mongo.lo mongo_types.lo bson.lo cursor.lo
collection.lo db.lo gridfs.lo util/hash.lo util/connect.lo util/
pool.lo util/rs.lo util/link.lo util/server.lo util/log.lo util/io.lo
util/parse.lo
cc ${wl}-flat_namespace ${wl}-undefined ${wl}suppress -o .libs/
mongo.so -bundle .libs/php_mongo.o .libs/mongo.o .libs/
mongo_types.o .libs/bson.o .libs/cursor.o .libs/collection.o .libs/
db.o .libs/gridfs.o util/.libs/hash.o util/.libs/connect.o util/.libs/
pool.o util/.libs/rs.o util/.libs/link.o util/.libs/server.o
util/.libs/log.o util/.libs/io.o util/.libs/parse.o -arch x86_64 -
arch i386 -arch x86_64 -mmacosx-version-min=10.5 -arch x86_64
ld: duplicate symbol _mongo_default_handlers in .libs/mongo.o
and .libs/php_mongo.o for architecture x86_64
collect2: ld returned 1 exit status
ld: duplicate symbol _mongo_default_handlers in .libs/mongo.o
and .libs/php_mongo.o for architecture i386
collect2: ld returned 1 exit status
lipo: can't open input file: /var/folders/_n/
_rb2rbhs5255c_8683qnh0700000gn/T//ccFu6IEA.out (No such file or
directory)
make: *** [mongo.la] Error 1


Anybody with more experience with this driver give any help here?

Tim Hawkins

unread,
Aug 11, 2011, 2:14:53 AM8/11/11
to mongo...@googlegroups.com
I would also be greatly interested in this, we are trying to bring up a 5.4 environment for dev work, because of the introduction of "Traits".  

-- 
Tim Hawkins
Sent with Sparrow
--
You received this message because you are subscribed to the Google Groups "mongodb-dev" group.
To post to this group, send email to mongo...@googlegroups.com.
To unsubscribe from this group, send email to mongodb-dev...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mongodb-dev?hl=en.

Kristina Chodorow

unread,
Aug 11, 2011, 10:43:55 AM8/11/11
to mongo...@googlegroups.com
The PHP API changes every point release and the driver hasn't been updated for the 5.4 release, yet.  There's a bug you can follow, if you're interested: https://jira.mongodb.org/browse/PHP-246.

I need to do a little bit of research, as the struct for object guts changed for 5.4 and I need to make sure that the driver is handling that correctly.
Reply all
Reply to author
Forward
0 new messages