When having PHP 7.4 installed with the php74-ftp package it fails to start: # /usr/local/php74/bin/php /usr/local/php74/lib/php/20190902/ftp.so: Undefined symbol "SSL_library_init" I guess it has to do with OpenSSL 1.1.1 and the deprecated "SSL_library_init". Comparing PHP7.3 (Built with OpenSSL 1.1.1) and PHP7.4: # readelf -a /usr/local/php74/lib/php/20190902/ftp.so | grep SSL_library_init 00000020f6f0 004c00000007 R_X86_64_JUMP_SLO 0000000000000000 SSL_library_init + 0 76: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND SSL_library_init 223: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND SSL_library_init # readelf -a /usr/local/php73/lib/php/20180731/ftp.so | grep OPENSSL_init 00000020eb30 004c00000007 R_X86_64_JUMP_SLO 0000000000000000 OPENSSL_init_ssl@OPENSSL_1_1_0 + 0 00000020ebb8 005d00000007 R_X86_64_JUMP_SLO 0000000000000000 OPENSSL_init_crypto@OPENSSL_1_1_0 + 0 76: 0000000000000000 238 FUNC GLOBAL DEFAULT UND OPENSSL_init_ssl@OPENSSL_1_1_0 (3) 93: 0000000000000000 962 FUNC GLOBAL DEFAULT UND OPENSSL_init_crypto@OPENSSL_1_1_0 (4) 232: 0000000000000000 238 FUNC GLOBAL DEFAULT UND OPENSSL_init_ssl@@OPENSSL 254: 0000000000000000 962 FUNC GLOBAL DEFAULT UND OPENSSL_init_crypto@@OPEN
I guess the problem is that the ftp module doesn't get built against the OpenSSL-Port version. Instead it's using the base version. That's the reason it choose the "SSL_library_init" instead of the new OpenSSL 1.1.1 "OPENSSL_init_ssl". I saw some changes in the Makefile of the 7.4 port compared to the 7.2/7.3...so I just added the ENV settings on as I see so far it works...not sure if it's a general problem? .if ${PHP_MODNAME} == "ftp" -CONFIGURE_ARGS+=--enable-ftp \ - --with-openssl-dir=${OPENSSLBASE} +CONFIGURE_ARGS+= --enable-ftp +CONFIGURE_ENV+= OPENSSL_CFLAGS="-I${OPENSSLINC}" \ + OPENSSL_LIBS="-L${OPENSSLLIB} -lssl -lcrypto" # /usr/local/php74/bin/php -v PHP 7.4.0RC4 (cli) (built: Oct 30 2019 15:17:50) ( NTS ) Copyright (c) The PHP Group Zend Engine v3.4.0-dev, Copyright (c) Zend Technologies with Zend OPcache v7.4.0RC4, Copyright (c), by Zend Technologies
I clearly fail to reproduce this error. Its possible that it is a general problem. This port had problems while porting it and another committer has helped me through the various SSL problems. So your change looks at least reasonable. But i can't reproduce the error with RC 4 nor RC 5. Which FreeBSD version do you use? Can you provide a full build log if the error persists with RC 5?
(In reply to Torsten Zuehlsdorff from comment #2) For sure it only happens with FreeBSD 11.X because it doesn't have OpenSSL 1.1.1 in the base like the 12.X Ok, I will test with the RC5 and will provide a build log if needed. But give me time until Wednesday, not in the office before this day 😉
Last time i tested it on 11.2, because i suspected the problem in the older version of the base system - like you already suspected ;) Today RC 6 was released. Let my work on this before you test it again. Thank you!
Ok, let me know if you need any logs, [...]
RC 6 is committed. Please test again. If it still fails, i need a build log from poudriere. And logs if the error manifests in another way than already described. Thank you! Torsten
(In reply to Torsten Zuehlsdorff from comment #6) With the changes, I've implemented in a previous comment: # /usr/local/php74/bin/php -v PHP 7.4.0RC6 (cli) (built: Nov 13 2019 00:21:29) ( NTS ) Copyright (c) The PHP Group Zend Engine v3.4.0-dev, Copyright (c) Zend Technologies with Zend OPcache v7.4.0RC6, Copyright (c), by Zend Technologies Default port: # /usr/local/php74/bin/php -v /usr/local/php74/lib/php/20190902/ftp.so: Undefined symbol "SSL_library_init"
Created attachment 209160 [details] Log of the RC6 ftp build
Created attachment 209161 [details] Log of the patched RC6 ftp build
Can you reproduce it with FB113 and OpenSSL 1.1.1? Or do you need some more logs with different build options?
Thank you, i do not need something at the moment. Except for time. Hopefully i will have some more next week, to finish the issue. :)
So, finally i cleared up some time this week, but still have problems to reproduce it: I used PHP 7.0 (not any RC): # readelf -a /usr/local/lib/php/20190902/ftp.so | grep SSL_library_init 00000020edd0 004800000007 R_X86_64_JUMP_SLOT 0000000000000000 SSL_library_init + 0 72: 0000000000000000 541 FUNC GLOBAL DEFAULT UND SSL_library_init So, year, there is something used. But: # php -v PHP 7.4.0 (cli) (built: Nov 28 2019 11:47:38) ( NTS ) Copyright (c) The PHP Group Zend Engine v3.4.0, Copyright (c) Zend Technologies Gives no error. How do you build it? With make? Because the log is relatively short in comparison to an poudriere log for example Greetings, Torsten
(In reply to Torsten Zuehlsdorff from comment #12) Against which OpenSSL Version have you built it? And what version of OpenSSL are you running on your machine? Because "SSL_library_init" is an 1.0.2 or below feature but exists as an compatibility macro... https://wiki.openssl.org/index.php/Library_Initialization But then why PHP 7.4.0 is using this old macro and PHP 7.3 is using OPENSSL_init_ssl@OPENSSL_1_1_0 + 0 as you can see in my initial bug report? Ehmm yes I've shorted the log a bit. Will provide you a full poudriere log on Wednesday
Created attachment 209724 [details] My full poudriere build log without reproducing the error I added my full poudriere build log. This is how i build it. With this "php -v" does not crash. Please have a look at the differences between our builds. Maybe the difference is also in lang/php74 options.
Created attachment 209752 [details] Build log (dont confuse by the portrevision 1) Hi, I've just compared our two build logs and they look quite identical. Except the output :D root@fb113-master-mariadb_ssl111:~ # /usr/local/php74/bin/php /usr/local/php74/lib/php/20190902/ftp.so: Undefined symbol "SSL_library_init" I'm just curious: are you really using OpenSSL 1.1.1 on your FreeBSD Host?
Just compared to the PHP73 build log where it works for me: PHP73: checking for pkg-config... no checking for OpenSSL version... >= 1.0.1 checking for CRYPTO_free in -lcrypto... yes checking for SSL_CTX_set_ssl_version in -lssl... yes PHP74: checking OpenSSL dir for FTP... /usr/local No check for >1.0.1
(In reply to Pascal Christen from comment #15) > I'm just curious: are you really using OpenSSL 1.1.1 on your FreeBSD Host? After double checking i can proudly say: no. :P But its a little bit confusing. I have a FreeBSD Host using 12.0. At it i have a poudriere jail using 11.3. To be sure i double checked both. The 12.0 host gives 1.1.1a as version. The 11.3 returns 1.0.2s. As you stated before the port is build against the base version of OpenSSL and not the port. I remember this was an issue when i ported 7.4. I switched it to use the openssl port, but this change was rolled back, because it will most likely break other ports. The default was always to be build against the base openssl. So you are using openssl from ports and when you build php74-ftp it will use this instead of the base version? Now i get an understand of the issue. I will check what to do about it.
(In reply to Torsten Zuehlsdorff from comment #17) Alright, let me know if you need anything...
I still fail to reproduce it. -.- I was so sure i got it. :D My setup now: FreeBSD 11.3 AMD64, installing security/openssl first, adding DEFAULT_VERSIONS=ssl=openssl to make.conf and than installed ftp/php74-ftp. But still: php -v does not segfault! What content do you have in /etc/make.conf and what does pkg info return? Does the error persists with 7.4.1. [I think so, readelf gives the same output] How did you setup everything? How can we continue to get this issue fixed? Greetings, Torsten
(In reply to Torsten Zuehlsdorff from comment #19) Ok, but what you did with: DEFAULT_VERSIONS=ssl=openssl is setting the OpenSSL Version to the default port openssl version but this one is still not 1.1.1 as you can see here: https://www.freshports.org/security/openssl/ compared to this one: https://www.freshports.org/security/openssl111/ So we have set the following in our make.conf: DEFAULT_VERSIONS+=ssl=openssl111 Could you try again with setting it with the OpenSSL 1.1.1 port version?
A commit references this bug: Author: tz Date: Mon Dec 23 22:31:00 UTC 2019 New revision: 520745 URL: https://svnweb.freebsd.org/changeset/ports/520745 Log: ftp/php74-ftp: Fix Undefined symbol "SSL_library_init" The ftp module always compiles against the base openssl, causes the error on FreeBSD 11.3. All other ports based on OpenSSL import the needed openssl from ports, if its not in base. Therefore we adjust the behaviour of the ftp module to match for example the imap module. PR: 241591 Submitted by: Pascal Christen <pascal.christen@hostpoint.ch> Changes: head/ftp/php74-ftp/Makefile head/lang/php74/Makefile.ext
Finally i understand the issue and was able to reproduce it. :) Also i came up with the same fix like you. So: sorry i took so long to understand the issue. It is fixed now :) I did not MFH it, since this will be done automatically in 8 or 9 days. Thank you for your patience! Torsten