freeswitch icon indicating copy to clipboard operation
freeswitch copied to clipboard

FS does not compile with openssl 3.x

Open ROBERT-MCDOWELL opened this issue 2 years ago • 1 comments

Describe the bug some functions are deprecated generating errors like src/switch_apr.c: In function 'switch_md5': src/switch_apr.c:1176:9: error: 'MD5_Init' is deprecated: Since OpenSSL 3.0 [-Werror=deprecated-declarations] 1176 | MD5_Init(&md5_context); | ^~~~~~~~ In file included from src/switch_apr.c:79: /usr/include/openssl/md5.h:49:27: note: declared here 49 | OSSL_DEPRECATEDIN_3_0 int MD5_Init(MD5_CTX *c); | ^~~~~~~~ src/switch_apr.c:1177:9: error: 'MD5_Update' is deprecated: Since OpenSSL 3.0 [-Werror=deprecated-declarations] 1177 | MD5_Update(&md5_context, input, inputLen); | ^~~~~~~~~~ /usr/include/openssl/md5.h:50:27: note: declared here 50 | OSSL_DEPRECATEDIN_3_0 int MD5_Update(MD5_CTX *c, const void *data, size_t len); | ^~~~~~~~~~ src/switch_apr.c:1178:9: error: 'MD5_Final' is deprecated: Since OpenSSL 3.0 [-Werror=deprecated-declarations] 1178 | MD5_Final(digest, &md5_context); | ^~~~~~~~~ /usr/include/openssl/md5.h:51:27: note: declared here 51 | OSSL_DEPRECATEDIN_3_0 int MD5_Final(unsigned char *md, MD5_CTX *c);

To Reproduce Steps to reproduce the behavior: compile FS with openssl 3.x

ROBERT-MCDOWELL avatar Aug 14 '22 19:08 ROBERT-MCDOWELL

I had the same problem compiling on ubuntu 22.04 using openssl 3.0. I've raised pull request #1767 to avoid the error messages by using openssl's high-level api.

jpfox156 avatar Aug 21 '22 12:08 jpfox156

Cannot compile on ubuntu 22.04:

src/switch_rtp.c: In function ‘switch_rtp_add_dtls’:
src/switch_rtp.c:3719:9: error: ‘PEM_read_bio_DHparams’ is deprecated: Since OpenSSL 3.0 [-Werror=deprecated-declarations]
 3719 |         dh = PEM_read_bio_DHparams(bio, NULL, NULL, NULL);
      |         ^~
In file included from ./src/include/switch_ssl.h:40,
                 from src/switch_rtp.c:50:
/usr/include/openssl/pem.h:469:1: note: declared here
  469 | DECLARE_PEM_rw_attr(OSSL_DEPRECATEDIN_3_0, DHparams, DH)
      | ^~~~~~~~~~~~~~~~~~~
src/switch_rtp.c:3723:17: error: ‘DH_free’ is deprecated: Since OpenSSL 3.0 [-Werror=deprecated-declarations]
 3723 |                 DH_free(dh);
      |                 ^~~~~~~
In file included from /usr/include/openssl/dsa.h:51,
                 from /usr/include/openssl/x509.h:37,
                 from /usr/include/openssl/pem.h:23,
                 from ./src/include/switch_ssl.h:40,
                 from src/switch_rtp.c:50:
/usr/include/openssl/dh.h:200:28: note: declared here
  200 | OSSL_DEPRECATEDIN_3_0 void DH_free(DH *dh);
      |                            ^~~~~~~
cc1: all warnings being treated as errors
make[1]: *** [Makefile:2572: src/libfreeswitch_la-switch_rtp.lo] Error 1
make[1]: Leaving directory '/usr/src/freeswitch'
make: *** [Makefile:1433: all] Error 2

Slonik avatar Jan 13 '23 18:01 Slonik

any progress on this besides editing makefiles to remove -Werror?

PripyatAutomations avatar May 28 '23 15:05 PripyatAutomations

Seeing the same issue. These manual tweaks got it installed for me on Ubuntu 22 Jammy.

Less than ideal, but in case it helps someone else:

# Downgrade to GCC 10
apt install gcc-10 g++-10 cpp-10 -y 
ln -s /usr/bin/gcc-10 /usr/bin/gcc 
ln -s /usr/bin/g++-10 /usr/bin/g++
# Downgrade to OpenSSL V1
mkdir -p /opt/openssl 
wget https://www.openssl.org/source/openssl-1.1.1q.tar.gz --no-check-certificate -P /opt/openssl/
tar -xzvf /opt/openssl/openssl-1.1.1q.tar.gz -C /opt/openssl/ 
cd /opt/openssl/openssl-1.1.1q
./config 
make install
cp /usr/local/bin/openssl /usr/bin/openssl

After this, no further issues. Hope there's a stable fix in the works.

Credit to Soufiane Bouchaara. Found these suggestions in a post: https://soufianebouchaa.medium.com/freeswitch-ci-cd-on-ubuntu-22-04-debian-11-part-1-75fb1be97316

ryanrussell avatar Jun 01 '23 07:06 ryanrussell

Noting that Debian:bookworm is also impacted.

jackdpeterson avatar Jul 06 '23 17:07 jackdpeterson

https://github.com/signalwire/freeswitch/pull/1767

andywolk avatar Jul 24 '23 18:07 andywolk