2015-06-24 18 views
7

Ich versuche, PHP 5.6.10 von der Quelle zu kompilieren, und ich gestoßen folgendes Problem:Wie kompiliere ich PHP mit OpenSSL unter OS X 10.9?

Undefined symbols for architecture x86_64: 
    "_PKCS5_PBKDF2_HMAC", referenced from: 
     _zif_openssl_pbkdf2 in openssl.o 
    "_TLSv1_1_client_method", referenced from: 
     _php_openssl_setup_crypto in xp_ssl.o 
    "_TLSv1_1_server_method", referenced from: 
     _php_openssl_setup_crypto in xp_ssl.o 
    "_TLSv1_2_client_method", referenced from: 
     _php_openssl_setup_crypto in xp_ssl.o 
    "_TLSv1_2_server_method", referenced from: 
     _php_openssl_setup_crypto in xp_ssl.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 

OpenSSL über Brew installiert ist. In PHP enthalten wie --with-openssl=/usr/local/Cellar/openssl/1.0.2c

P.S. Vor versucht, nur /usr für OpenSSL zu verwenden, bekam aber den gleichen Fehler.

+0

Könnten Sie geben Ihnen Plateform Details und Compiler Informationen? – Cyrbil

+0

@cyrbil was genau brauchst du? – user1692333

+0

Ihre OS-Version 'uname -smorv' und Ihren Compiler' gcc -version' (vorausgesetzt, Sie verwenden gcc ...) – Cyrbil

Antwort

8

Das Makefile hat eine Linie mit EXTRA_LIBS, so etwas wie:

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

entfernen alle Vorkommen von -lssl und -lcrypto und fügen Sie den vollständigen Pfad zu libssl.dylib und libcrypto.dylib(Gebräu Links OpenSSL nach/usr/local/opt/openssl/lib /)

EXTRA_LIBS = -lresolv -lmcrypt /usr/local/opt/openssl/lib/libssl.dylib /usr/local/opt/openssl/lib/libcrypto.dylib -lltdl -liconv-lm -lxml2 -lcurl 
+0

Dies funktioniert auch für El Capitan 10.11. Danke –

+1

Auch für El Capitan 10.11.4 mit PHP 7.0.5 + OpenSSL 1.0.2g, manuelle Installation (kein Brühen, keine Ports). – expora

2

auf Antwort Bob Fangers folgen (die auf os x 10.11.3) perfekt für mich gearbeitet, hier ist ein li ttle-Skript, das Sie innerhalb des Build-Verzeichnisses ausführen können, das die Makefile-Änderungen vornimmt:

#!/usr/bin/php 
<?php 
if (true != copy('Makefile', 'Makefile.sav')) 
    die("** cannot copy 'Makefile' to 'Makefile.sav'\n"); 
$lines = file('Makefile'); 
if (false == $lines) 
    die("** connot read 'Makefile'\n"); 
$output = fopen('Makefile', 'wb'); 
if (false == $output) 
    die("** unable to open 'Makefile'\n"); 
foreach ($lines as $line) { 
    if (preg_match('/^EXTRA_LIBS\s+=\s+/', $line)) { 
     $line = preg_replace('/^EXTRA_LIBS\s+=\s+/', 'EXTRA_LIBS = /usr/local/opt/openssl/lib/libssl.dylib /usr/local/opt/openssl/lib/libcrypto.dylib', $line); 
     $line = preg_replace(['/-lssl/', '/-lcrypto/'], [], $line); 
    } 
    if (false === fwrite($output, $line)) 
     die("** writing line to 'Makefile' failed\n"); 
} 
fclose($output); 
echo "Success - your Makefile is set for ssl\n"; 

Genießen Sie!

0

wenn Sie phpbrew auf OSX El Capitan mit sind müssen Sie den vollständigen Pfad Ihrer OpenSSL zur Verfügung zu stellen:

phpbrew install php-7.0.4 +openssl=/usr/local/Cellar/openssl/[YOUR OPEN SSL VERSION]

Verwandte Themen