I am attempting to rebuild Apache from source and am encountering an issue I have not faced before.
I have built Apache version 2.4.57 from source many times in the past and have had no issues during the make stage.
I grabbed Apache:
wget https://archive.apache.org/dist/httpd/httpd-2.4.57.tar.gz
Configure it:
./configure --prefix=/path/to/server --with-ssl=/opt/openssl/bin
And attempt to build:
make
But then I receive this error:
/usr/share/apr-1.0/build/libtool --silent --mode=link x86_64-linux-gnu-gcc -pthread \
-o ab ab.lo /usr/lib/x86_64-linux-gnu/libaprutil-1.la /usr/lib/x86_64-linux-gnu/libapr-1.la -lm -lssl -lcrypto
/usr/bin/ld: ab.o: in function `ssl_print_cert_info':
ab.c:(.text+0xa94): undefined reference to `EVP_PKEY_get_bits'
/usr/bin/ld: ab.o: in function `ssl_print_info':
ab.c:(.text+0xc6c): undefined reference to `SSL_get1_peer_certificate'
/usr/bin/ld: ab.o: in function `ssl_proceed_handshake':
ab.c:(.text+0xe0c): undefined reference to `SSL_get1_peer_certificate'
/usr/bin/ld: ab.c:(.text+0xe2b): undefined reference to `EVP_PKEY_get_bits'
/usr/bin/ld: ab.c:(.text+0xefc): undefined reference to `EVP_PKEY_get_id'
/usr/bin/ld: ab.c:(.text+0xf2d): undefined reference to `EVP_PKEY_get_bits'
/usr/bin/ld: ab.c:(.text+0xf62): undefined reference to `EVP_PKEY_get_bits'
/usr/bin/ld: ab.c:(.text+0xff5): undefined reference to `EVP_PKEY_get_bits'
/usr/bin/ld: ab.c:(.text+0x102f): undefined reference to `EVP_PKEY_get_bits'
/usr/bin/ld: ab.c:(.text+0x103d): undefined reference to `EVP_PKEY_get_id'
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:73: ab] Error 1
make[2]: Leaving directory '/srv/apache/httpd-2.4.57/support'
make[1]: *** [/srv/apache/httpd-2.4.57/build/rules.mk:75: all-recursive] Error 1
make[1]: Leaving directory '/srv/apache/httpd-2.4.57/support'
make: *** [/srv/apache/httpd-2.4.57/build/rules.mk:75: all-recursive] Error 1
Attempts at a solution
I have recently been playing with postfix, and encountered issues with an openssl version there. In attempting to solve that issue, I seem to have altered my systems openssl libraries and now apache won't build.
Attempting to fix Openssl, I suspected the issue could be my openssl version was too modern (3.2.1) for apache version 2.4.57, so, following this post:
https://askubuntu.com/questions/1126893/how-to-install-openssl-1-1-1-and-libssl-package
I downgraded to version 1.1.1. I configured apache to build with this version. Unfortunately, no luck.
Despite searching online, I cannot find any solution to this specific issue. I am also having difficulty finding reference to what version of OpenSSL apache requires, or if it is possible to configure apache to build without these libraries. Possibly by a ./configure flag ? I do not mind building without SSL support.
If anyone can shed light on this situation either with a specific solution, or possible hints regarding the versions httpd requires, I would be most grateful.
Update
I repeated the Openssl instructions listed in the stackoverflow post referenced above for openssl version 3.0.2, as suggested in the comments. When running make test, some tests are failed:
Test Summary Report
-------------------
25-test_verify.t (Wstat: 512 Tests: 160 Failed: 2)
Failed tests: 157-158
Non-zero exit status: 2
80-test_cms.t (Wstat: 1792 Tests: 12 Failed: 7)
Failed tests: 2-6, 9, 12
Non-zero exit status: 7
80-test_ssl_new.t (Wstat: 256 Tests: 30 Failed: 1)
Failed test: 12
Non-zero exit status: 1
Files=242, Tests=3284, 433 wallclock secs ( 8.33 usr 0.51 sys + 391.95 cusr 46.46 csys = 447.25 CPU)
Result: FAIL
Despite these test errors, I continued installing Openssl. When I then configure apache with:
./configure --with-ssl=/opt/openssl
there is no error - problem solved.
I am not clear what the make test errors refer to - if anyone can shine light on this, I would be grateful.
Thanks to @steeldriver in the comments, and confirmation in practice, I know that httpd-2.4.57 works with openssl-3.0.2 - I am not clear how to go about finding the dependency requirements of httpd. If someone can point me in the right direction, again, I would be most thankful.
--with-opensslbe pointing at/opt/opensslinstead of/opt/openssl/bin?/opt/opensslwithout luck. With openssl version 3.0.2, the problem is solved. Here, I again configured with/opt/openssland building is successful.