Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Cannot find OpenSSL's libraries when I try to install #138

Closed
pocketmax opened this issue Nov 13, 2015 · 24 comments
Closed

Cannot find OpenSSL's libraries when I try to install #138

pocketmax opened this issue Nov 13, 2015 · 24 comments

Comments

@pocketmax
Copy link

sudo pecl install mongodb-beta
...
checking configuring libmongoc... ...
checking Use system libmongoc... no
checking for pkg-config... no
configure: error: Cannot find OpenSSL's libraries

I've tried with/without sudo. I've tried to just install the mongodb lib without the -beta. I have all the openssl libs and dev libs installed and it still gives me this message. I'm using ubuntu utopic

@pocketmax
Copy link
Author

fixed it...

sudo apt-get install clibcurl4-openssl-dev pkg-config libssl-dev libsslcommon2-dev

@bjori
Copy link
Contributor

bjori commented Nov 15, 2015

Do you know if you had libbsl-dev installed, or if installing pkg-config fixed it?

Using pkg-config is generally preferable, but the fallback should work -- but you'll need to provide:
--with-openssl-dir=/path/to/openssl

@bjori
Copy link
Contributor

bjori commented Nov 15, 2015

(also "-beta" is no longer needed -- the 1.0.0-stable has been released :))

@pocketmax
Copy link
Author

I already had libssl-dev and pkg-config installed already. After I installed those packages, I did a normal "sudo pecl install mogodb" and it worked without a problem.

@bjori
Copy link
Contributor

bjori commented Nov 16, 2015

The configure output said you were missing pkg-config

checking for pkg-config... no

Anyway, glad everything worked out. Let us know if you find any other issues!

@bjori bjori closed this as completed Nov 16, 2015
@pocketmax
Copy link
Author

ug, sorry. I was thinking of a different VM I was testing with. omg, it's the very next line BEFORE the openssl error line and I didn't notice it. Sorry, ID-10T issue.

@warrenca
Copy link

warrenca commented Feb 3, 2016

I'm running in OSX and tried the following commands

$ brew reinstall pkg-config
$ brew link openssl --force
$ sudo pecl install mongodb
....
install ok: channel://pecl.php.net/mongodb-1.1.2
configuration option "php_ini" is not set to php.ini location
You should add "extension=mongodb.so" to php.ini

@necromant2005
Copy link

Ubuntu 16.10
after installing:
sudo apt-get install libssl-dev
sudo apt-get install libcurl4-openssl-dev
sudo apt-get install clibcurl4-openssl-dev pkg-config libssl-dev libsslcommon2-dev

sudo pecl install mongodb
configure: error: Cannot find OpenSSL's libraries
ERROR: `/tmp/pear/temp/mongodb/configure' failed

@derickr
Copy link
Contributor

derickr commented Feb 16, 2016

@necromant2005 Can you post your "config.log" somewhere (pastebin.com)? And provide a link here?

@necromant2005
Copy link

I fixed the issue by installing extra libraries, the whole list
sudo apt-get install -y autoconf g++ make openssl libssl-dev libcurl4-openssl-dev
sudo apt-get install -y libcurl4-openssl-dev pkg-config
sudo apt-get install -y libsasl2-dev

@zakhttp
Copy link

zakhttp commented Mar 12, 2016

@pocketmax i did the same and it worked! thanks!

@Devidian
Copy link

@necromant2005 Thanks, worked for me on Debian 8.3 too!

@ghost
Copy link

ghost commented Jun 1, 2016

On Ubuntu 16.04 I removed libcurl14-openssl-dev and works too

@ostojicmilica
Copy link

I am on Ubuntu 14.10 and I get same error but when I try to run everything that @necromant2005 said I get errors:

E: Package 'pkg-config' has no installation candidate
E: Unable to locate package libsasl2-dev

@jmikola
Copy link
Member

jmikola commented Jun 1, 2016

@ostojicmilica: Those look like apt-get errors. Both of those packages should certainly exist in 14.04:

If you're unable to get those installed, you may want to inquire in an Ubuntu support forum.

AFAIK, our config.m4 only relies on pkg-config for locating the system libbson or libmongoc libraries. PHP core also uses it for locating SSL libraries in PHP_SETUP_OPENSSL(); however, they fall back to searching common system paths if pkg-config is not available. For SASL, which is specific to the driver, we merely search some common system paths (i.e. pkg-config is not used).

Explicit paths for both OpenSSL and SASL may be set with the --with-openssl-dir=/path/to/ssl and --with-mongodb-sasl=/path/to/sasl options to the configure script, respectively. In that case, pkg-config would not be needed for detecting OpenSSL.

@ostojicmilica
Copy link

ostojicmilica commented Jun 1, 2016

Maybe the problem is because I dont use 14.04, but 14.10 Ubuntu .

And can you tell me how to find these paths? @jmikola

@jmikola
Copy link
Member

jmikola commented Jun 1, 2016

And can you tell me how to find these paths?

The OpenSSL library path will contain include/openssl/evp.h within it. The SASL library path should contain include/sasl/sasl.h within it. I'm discerning this by walking through the search logic in PHP_SETUP_OPENSSL() and this extensions' config.m4 file; however, I do not have a specific answer for your environment.

Maybe the problem is because I dont use 14.04, but 14.10 Ubuntu .

My mistake for misreading your last post. The packages are still present in 14.10, though:

I should reiterate that if you are receiving the following errors:

E: Package 'pkg-config' has no installation candidate
E: Unable to locate package libsasl2-dev

...that really hints at a problem with your operating system's package manager and is likely outside the scope of this PHP extension.

@zhukovra
Copy link

pecl install mongodb successfully builds with pkg-config and libssl-dev packages on Jessie. No additional packages like libcurl4-openssl-dev libcurl4-openssl-dev libsasl2-dev is required.

@Syrok
Copy link

Syrok commented Oct 5, 2016

last solution:
sudo apt-get install pkg-config libssl-dev

@nmeegama
Copy link

nmeegama commented Mar 4, 2017

Small correction for this command (in 2nd comment ) that I came across on Ubuntu 16.04
sudo apt-get install clibcurl4-openssl-dev pkg-config libssl-dev libsslcommon2-dev
Error : Unable to locate package clibcurl4-openssl-dev

So I tried
sudo apt-get install pkg-config libssl-dev libsslcommon2-dev
And this still worked

@geoherna
Copy link

geoherna commented Sep 3, 2017

@necromant2005 solution worked perfectly for me. Thanks ! 🍻

@berzavlu
Copy link

berzavlu commented Jul 12, 2018

u r god! @necromant2005

@jmikola
Copy link
Member

jmikola commented Jul 13, 2018

I've created PHPC-1237 so we can improve the installation notes on PHP.net to list a number of packages from #138 (comment). The current documentation is OS-agnostic, but I realize it'd be more helpful to list package names for the most common Linux distributions (e.g. Debian/Ubuntu and perhaps Fedora/CentOS).

@josergc
Copy link

josergc commented Feb 11, 2019

sudo apt-get install clibcurl4-openssl-dev pkg-config libssl-dev libsslcommon2-dev

in xenial

sudo apt-get install  pkg-config libssl-dev libsslcommon2-dev 

fixed my problem. apt was complaining about clibcurl4-openssl-dev package is not found...

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

No branches or pull requests