jcorporation / myMPD

myMPD is a standalone and mobile friendly web mpd client with a tiny footprint and advanced features.
https://jcorporation.github.io/myMPD/
GNU General Public License v3.0
418 stars 65 forks source link

Build error in debian jessie #215

Closed parkmino closed 4 years ago

parkmino commented 4 years ago

myMPD version: 6.0.1

Describe the bug

Tried to build debian jessie for armel, however it failed with the following message.

[100%] Building C object CMakeFiles/mympd.dir/src/cert.c.o
/root/myMPD-6.0.1/src/cert.c: In function 'add_extension':
/root/myMPD-6.0.1/src/cert.c:301:62: error: passing argument 4 of 'X509V3_EXT_conf_nid' discards 'const' qualifier from pointer target type [-Werror]
     X509_EXTENSION *ex = X509V3_EXT_conf_nid(NULL, ctx, nid, value);
                                                              ^
In file included from /root/myMPD-6.0.1/src/cert.c:23:0:
/usr/include/openssl/x509v3.h:616:17: note: expected 'char *' but argument is of type 'const char *'
 X509_EXTENSION *X509V3_EXT_conf_nid(LHASH_OF(CONF_VALUE) *conf,
                 ^
/root/myMPD-6.0.1/src/cert.c: In function 'generate_selfsigned_cert':
/root/myMPD-6.0.1/src/cert.c:422:81: error: passing argument 4 of 'X509V3_EXT_conf_nid' discards 'const' qualifier from pointer target type [-Werror]
     X509_EXTENSION *ex = X509V3_EXT_conf_nid(NULL, &ctx, NID_basic_constraints, "CA:true");
                                                                                 ^
In file included from /root/myMPD-6.0.1/src/cert.c:23:0:
/usr/include/openssl/x509v3.h:616:17: note: expected 'char *' but argument is of type 'const char *'
 X509_EXTENSION *X509V3_EXT_conf_nid(LHASH_OF(CONF_VALUE) *conf,
                 ^
cc1: all warnings being treated as errors
CMakeFiles/mympd.dir/build.make:2101: recipe for target 'CMakeFiles/mympd.dir/src/cert.c.o' failed
make[2]: *** [CMakeFiles/mympd.dir/src/cert.c.o] Error 1
CMakeFiles/Makefile2:60: recipe for target 'CMakeFiles/mympd.dir/all' failed
make[1]: *** [CMakeFiles/mympd.dir/all] Error 2
Makefile:117: recipe for target 'all' failed
make: *** [all] Error 2
parkmino commented 4 years ago

I build it successfully with ENABLE_SSL="OFF". Is it related to the version of openssl ?

jcorporation commented 4 years ago

Yes, it seems the openssl version in jessy is to old. There are API changes in openssl 1.1.0 and jessie ships a 1.0.x version.

parkmino commented 4 years ago

ENABLE_SSL="OFF" does not work for 'pkgdebian' option. Is there any work around?

jcorporation commented 4 years ago

All packaging options don‘t respect the environment variables. But removing the libssl-dev package should do the trick.

I think the best way is to improve the cmake script.

jcorporation commented 4 years ago

Check openssl version >= 1.1.0

if(<variable|string> VERSION_GREATER <variable|string>) Component-wise integer version number comparison (version format is major[.minor[.patch[.tweak]]]).

OPENSSL_VERSION This is set to $major.$minor.$revision$patch (e.g. 0.9.8s).

BenjaminDebeerst commented 4 years ago

I also stumbled upon this while trying to compile on an old debian, and I worked around it by having warnings not treated as errors, by removing the -Werror flags here: https://github.com/jcorporation/myMPD/blob/master/CMakeLists.txt#L120-L123

That's not a great solution in general, but allowed me to compile and test quickly.

parkmino commented 4 years ago

This work around works, thanks!

I also stumbled upon this while trying to compile on an old debian, and I worked around it by having warnings not treated as errors, by removing the -Werror flags here: https://github.com/jcorporation/myMPD/blob/master/CMakeLists.txt#L120-L123

That's not a great solution in general, but allowed me to compile and test quickly.

jcorporation commented 4 years ago

Works SSL with this hack or you don‘t enabled ssl anyway?

parkmino commented 4 years ago

It builds showing the error message with ssl enabled.

jcorporation commented 4 years ago

My question was: with this hack, runs the binary with ssl flawless?

parkmino commented 4 years ago

Yes, it shows the error message though.

BenjaminDebeerst commented 4 years ago

Same here, I just went back to that test setup and enabled SSL and it works. The browser shows the "unknown issuer" SSL error warning, but I guess that is expected.

jcorporation commented 4 years ago

The "unknown issuer" warning is ok, if you not imported the myMPD CA. The build should now disable SSL if OpenSSL version is smaller than 1.1.0. Can you give it a try?

BenjaminDebeerst commented 4 years ago

No, this doesn't seem to work entirely, I just built from the devel branch (6a80ea2f0), yielding first this (and I was already writing that it worked :-) ):

Searching for openssl
-- Found OpenSSL: /usr/lib/arm-linux-gnueabihf/libssl.so;/usr/lib/arm-linux-gnueabihf/libcrypto.so (found version "1.0.1t") 
Openssl is disabled

But the build later fails with the same warnings as reported above.

jcorporation commented 4 years ago

Last commit should fix the issue definitely. Don't hesitate to reopen the issue, if it don't works for you.

parkmino commented 4 years ago

Yes, it now builds flawlessly. Thanks !