Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to compile PHP 5.5.19 with OpenSSL 1.0.1 on OS X

I've installed OpenSSL 1.0.1j to /usr/local/ssl and now I'm trying to compile PHP 5.5.19 using this version of OpenSSL. Here is my procedure to configure...

export CFLAGS="-arch x86_64"
export CXXFLAGS="-arch x86_64"
export LDFLAGS="-L/usr/local/ssl/lib"
export CPPFLAGS="-I/usr/local/ssl/include"
./configure \
--prefix=/usr/local/php5 \
--mandir=/usr/share/man \
--infodir=/usr/share/info \
--sysconfdir=/etc \
--with-config-file-path=/etc \
--with-zlib \
--with-zlib-dir=/usr \
--with-apxs2=/usr/sbin/apxs \
--with-openssl=/usr/local/ssl \
--without-iconv \
--enable-cli \
--enable-exif \
--enable-ftp \
--enable-mbstring \
--enable-mbregex \
--enable-sockets \
--with-mysql=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-mysqli=mysqlnd \
--with-gd \
--with-jpeg-dir=/usr/local/lib \
--with-png-dir=/usr/X11R6 \
--with-freetype-dir=/usr/X11R6 \
--with-xpm-dir=/usr/X11R6 \
--with-mcrypt \
--with-curl

The configure process appears to work fine, but when I run make, I get this:

Undefined symbols for architecture x86_64:
"_PKCS5_PBKDF2_HMAC", referenced from:
_zif_openssl_pbkdf2 in openssl.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [libs/libphp5.bundle] Error 1

If I run the same configure options, but point openssl to the system version /usr

...
--with-openssl=/usr
...

Then make runs without a problem and php installs fine, but with an old version of OpenSSL. How can I get it to use my newer version of OpenSSL?

like image 933
climbd Avatar asked Oct 20 '22 21:10

climbd


1 Answers

The Makefile has a line with EXTRA_LIBS, something like:

EXTRA_LIBS = -lresolv -lmcrypt -lltdl -liconv-lm -lxml2 -lcurl  -lssl -lcrypto

Remove all occurrences of -lssl and -lcrypto and add the full path to libssl.dylib and libcrypto.dylib

EXTRA_LIBS = -lresolv -lmcrypt /usr/local/ssl/lib/libssl.dylib /usr/local/ssl/lib/libcrypto.dylib -lltdl -liconv-lm -lxml2 -lcurl
like image 181
Bob Fanger Avatar answered Oct 23 '22 17:10

Bob Fanger