Skip to content
This repository has been archived by the owner on Nov 18, 2022. It is now read-only.

Fails to compile on Alpine Linux 3.9 (OpenSSL no-comp option) #607

Closed
frebib opened this issue Feb 3, 2019 · 3 comments
Closed

Fails to compile on Alpine Linux 3.9 (OpenSSL no-comp option) #607

frebib opened this issue Feb 3, 2019 · 3 comments

Comments

@frebib
Copy link
Contributor

frebib commented Feb 3, 2019

Alpine Linux moved from LibreSSL to OpenSSL 1.1.1 for 3.9. As it stands, there are no commits that build.

g++ -DHAVE_CONFIG_H -I.  -I./daemon/connect -I./daemon/extension -I./daemon/feed -I./daemon/frontend -I./daemon/main -I./daemon/nntp -I./daemon/postprocess -I./daemon/queue -I./daemon/remote -I./daemon/util -I./daemon/nserv -I./lib/par2 -I./lib/yencode  -I/usr/include/libxml2     -g -O2 -c -o daemon/connect/TlsSocket.o daemon/connect/TlsSocket.cpp
daemon/connect/TlsSocket.cpp: In static member function 'static void TlsSocket::Final()':
daemon/connect/TlsSocket.cpp:208:2: error: 'COMP_zlib_cleanup' was not declared in this scope
  COMP_zlib_cleanup();
  ^~~~~~~~~~~~~~~~~
daemon/connect/TlsSocket.cpp:208:2: note: suggested alternative: 'EVP_PBE_cleanup'
  COMP_zlib_cleanup();
  ^~~~~~~~~~~~~~~~~
  EVP_PBE_cleanup
make[1]: *** [Makefile:1661: daemon/connect/TlsSocket.o] Error 1
make[1]: Leaving directory '/nzbget'
make: *** [Makefile:980: all] Error 2

I think I have narrowed it down to the fact that OpenSSL is built with the no-comp option on Alpine, which in contrast to another popular distro like Arch, it is not the case:
https://git.archlinux.org/svntogit/packages.git/tree/trunk/PKGBUILD?h=packages/openssl#n34
https://git.alpinelinux.org/aports/tree/main/openssl/APKBUILD?h=3.9-stable#n58

The following patch to fix the build is as follows, although I'm sure this is not entirely safe, and I have not tested this on any other systems, it simply allows compilation. (See no-comp here: https://wiki.openssl.org/index.php/Compilation_and_Installation)

diff --git a/daemon/connect/TlsSocket.cpp b/daemon/connect/TlsSocket.cpp
index 5ab31644..544bf685 100644
--- a/daemon/connect/TlsSocket.cpp
+++ b/daemon/connect/TlsSocket.cpp
@@ -204,7 +204,9 @@ void TlsSocket::Final()
 	//ENGINE_cleanup();
 	CONF_modules_free();
 	CONF_modules_unload(1);
+#ifndef OPENSSL_NO_COMP
 	COMP_zlib_cleanup();
+#endif
 	ERR_free_strings();
 	EVP_cleanup();
 	CRYPTO_cleanup_all_ex_data();
@hugbug
Copy link
Member

hugbug commented Feb 3, 2019

Looks good to me. Thank you.
Would you like to submit a pull request or should I commit the change myself?

@frebib
Copy link
Contributor Author

frebib commented Feb 3, 2019

I'm happy to make a PR. A quick grep shows that this is in fact the only instance of a COMP_ function from OpenSSL so it is probably safe to use. Let me quickly build and verify that this does in fact run and work as intended and I'll open a PR :)

@frebib
Copy link
Contributor Author

frebib commented Feb 3, 2019

root@87fcb35e29db /nzbget> grep -r COMP_ .
./daemon/connect/TlsSocket.cpp:	SSL_COMP_free_compression_methods();
./daemon/connect/TlsSocket.cpp:	COMP_zlib_cleanup();

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants