New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

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

Comments

Projects
None yet
2 participants
@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

This comment has been minimized.

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

This comment has been minimized.

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

This comment has been minimized.

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();

@hugbug hugbug closed this in #608 Feb 3, 2019

hugbug added a commit that referenced this issue Feb 3, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment