Skip to content

(php7) php: symbol lookup error: /usr/lib/php/20151012/mongodb.so: undefined symbol: _mongoc_host_list_destroy_all #219

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
jonathanpmartins opened this issue Feb 3, 2016 · 9 comments

Comments

@jonathanpmartins
Copy link

I dont know if this is the right place to put it but I have a problem. In my case Im using Lumen 5.2, PHP 7.0.2 - MongoDB 1.1.2 - Ubuntu 14.04... etc.

On my composer.json file

"illuminate/redis":"5.2.*",
"predis/predis": "^1.1@dev"

When i run my unit tests it results in this error:

.2016/02/03 15:35:03.0458: [ 1359]:    DEBUG:       client: Using custom stream initiator.
php: symbol lookup error: /usr/lib/php/20151012/mongodb.so: undefined symbol: _mongoc_host_list_destroy_all

The only reference on google whas this file: https://github.com/mongodb/mongo-c-driver/blob/master/src/mongoc/mongoc-uri.c

When I install everything in the server I use the ondrej/phprepository. You can look-up the setup installation script here: https://github.com/jonathanpmartins/ubuntusetup/blob/master/server/setup-php7-nginx-1.9.10-ubuntu-14.04.sh

Perhaps I should open a issue on another repository. Can someone help me out?

@jonathanpmartins jonathanpmartins changed the title undefined symbol: _mongoc_host_list_destroy_all php: symbol lookup error: /usr/lib/php/20151012/mongodb.so: undefined symbol: _mongoc_host_list_destroy_all Feb 3, 2016
@jonathanpmartins
Copy link
Author

after installing the last version of libmongoc the problem is gone!
http://api.mongodb.org/c/1.3.2/installing.html

@derickr
Copy link
Contributor

derickr commented Feb 4, 2016

Just curious on this side... did you compile this against a system provided libmongoc? If so, where did that come from? And which version did you have before? We'd probably like to fix this (ie, make sure you get a warning/error while compiling).

@derickr derickr reopened this Feb 4, 2016
@jonathanpmartins
Copy link
Author

@derickr

Before, when I type in:

$ php -i | grep mongo

mongodb
mongodb support => enabled
mongodb version => 1.1.2
mongodb stability => stable
libmongoc version => 1.3.0
mongodb.debug => no value => no value

Note that at this point in time I have only install mongo with apt-get: like so sudo apt-get install php-mongo. The machine setup script: https://github.com/jonathanpmartins/ubuntusetup/blob/master/server/setup-php7-nginx-1.9.10-ubuntu-14.04.sh

And after compiling libmongoc from scratch:

mongodb
mongodb support => enabled
mongodb version => 1.1.2
mongodb stability => stable
libmongoc version => 1.3.1-dev
mongodb.debug => no value => no value

Note that I use the 1.3.2 file: https://github.com/mongodb/mongo-c-driver/releases/download/1.3.2/mongo-c-driver-1.3.2.tar.gz. But the installed lib was 1.3.1-dev. Strange, but now its working fine.

After compile and install libmongoc again I need to type in:
$ pecl install mongodb
I think this was necessary to glue everything together!

After restart php everything works fine!

@jonathanpmartins
Copy link
Author

@derickr Sorry,
The old libmongoc, I think came from ondrej/phpPPA repository. But Im not sure...

@jonathanpmartins jonathanpmartins changed the title php: symbol lookup error: /usr/lib/php/20151012/mongodb.so: undefined symbol: _mongoc_host_list_destroy_all (php7) php: symbol lookup error: /usr/lib/php/20151012/mongodb.so: undefined symbol: _mongoc_host_list_destroy_all Feb 4, 2016
@jonathanpmartins
Copy link
Author

If you have more questions, feel free to ask. I feel very glad to help you guys...

@jonathanpmartins
Copy link
Author

@derickr I think this issue can be closed. mongodb/mongo-php-library#115 (comment)

@jmikola
Copy link
Member

jmikola commented Feb 9, 2016

@jonathanpmartins: If I read this correctly, the problem was originally with using the php-mongodb package from the ondrej/php apt repository. If you ultimately used pecl install mongodb to reinstall the extension, that would have used our bundled libmongoc and libbson libraries, where the private symbols line up. If you're comfortable with using the bundled libs with PECL, I'd suggest sticking with that.

This all seems due to our reliance on the private API in libmongoc, which we're actively working to fix (both in our PHP/HHVM drivers and libmongoc itself, where we need to create more public APIs -- no earlier than 1.4.0).

@jmikola jmikola closed this as completed Feb 9, 2016
@jonathanpmartins
Copy link
Author

@jmikola You are correct!

@oerdnj
Copy link

oerdnj commented Mar 14, 2016

JFTR you cannot mix and match libraries from PPA and package from PECL. The PPA version php-mongodb matches the libraries in the repository, and it has it's own copy of private symbols, so the symbol lookup should not happen. However errors might happen, so there might be some error.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants