Compilation fails on Debian/Sid

The place to discuss linux version of MakeMKV
Post Reply
valerio
Posts: 8
Joined: Sat Apr 12, 2014 8:42 am

Compilation fails on Debian/Sid

Post by valerio »

Hello, probably Debian/unstable isn't supported but if someone could be so kind to give an help I'd be really happy and that would be very likely useful for the next stable release too.
The error is:

Code: Select all

libabi/src/ossl_ec.c: In function ‘OSSL_ECDSA_do_verify_rs’:
libabi/src/ossl_ec.c:204:15: error: storage size of ‘sig’ isn’t known ECDSA_SIG sig;
               ^~~
libabi/src/ossl_ec.c: In function ‘OSSL_ecdsa_sig_get_r’:
libabi/src/ossl_ec.c:222:56: error: dereferencing pointer to incomplete type ‘ECDSA_SIG {aka const struct ECDSA_SIG_st}’
     return (const OSSL_BIGNUM*) ((const ECDSA_SIG*)sig)->r;
                                                        ^~
libabi/src/sys_linux.c: In function ‘SYS_readdir’:
libabi/src/sys_linux.c:79:5: warning: ‘readdir64_r’ is deprecated [-Wdeprecated-declarations]
     err = readdir64_r(dirp,&data.ent,&pent);
     ^~~
In file included from libabi/src/sys_linux.c:24:0:
/usr/include/dirent.h:201:12: note: declared here
 extern int readdir64_r (DIR *__restrict __dirp,
            ^~~~~~~~~~~
libffabi/src/ffabi.c: In function ‘ffm_audio_decode_put_data’:
libffabi/src/ffabi.c:242:5: warning: ‘avcodec_decode_audio4’ is deprecated [-Wdeprecated-declarations]
     r = avcodec_decode_audio4(ctx->avctx,ctx->frame,&ctx->have_frame,&avpkt);
     ^
In file included from libffabi/src/ffabi.c:22:0:
/usr/include/x86_64-linux-gnu/libavcodec/avcodec.h:4762:5: note: declared here
 int avcodec_decode_audio4(AVCodecContext *avctx, AVFrame *frame,
     ^~~~~~~~~~~~~~~~~~~~~
libffabi/src/ffabi.c: In function ‘ffm_audio_encode_close’:
libffabi/src/ffabi.c:377:5: warning: ‘av_free_packet’ is deprecated [-Wdeprecated-declarations]
     av_free_packet(&ctx->pck);
     ^~~~~~~~~~~~~~
In file included from libffabi/src/ffabi.c:22:0:
/usr/include/x86_64-linux-gnu/libavcodec/avcodec.h:4472:6: note: declared here
 void av_free_packet(AVPacket *pkt);
      ^~~~~~~~~~~~~~
libffabi/src/ffabi.c: In function ‘ffm_audio_encode_put_frame’:
libffabi/src/ffabi.c:398:5: warning: ‘av_free_packet’ is deprecated [-Wdeprecated-declarations]
     av_free_packet(&ctx->pck);
     ^~~~~~~~~~~~~~
In file included from libffabi/src/ffabi.c:22:0:
/usr/include/x86_64-linux-gnu/libavcodec/avcodec.h:4472:6: note: declared here
 void av_free_packet(AVPacket *pkt);
      ^~~~~~~~~~~~~~
libffabi/src/ffabi.c:434:5: warning: ‘avcodec_encode_audio2’ is deprecated [-Wdeprecated-declarations]
     return avcodec_encode_audio2(ctx->avctx,&ctx->pck,frame,&ctx->have_packet);
     ^~~~~~
In file included from libffabi/src/ffabi.c:22:0:
/usr/include/x86_64-linux-gnu/libavcodec/avcodec.h:5283:5: note: declared here
 int avcodec_encode_audio2(AVCodecContext *avctx, AVPacket *avpkt,
     ^~~~~~~~~~~~~~~~~~~~~
Makefile:59: set di istruzioni per l'obiettivo "out/libmakemkv.so.1.full" non riuscito
make: *** [out/libmakemkv.so.1.full] Errore 1
Any idea?
malattia
Posts: 8
Joined: Sun Dec 01, 2013 2:59 am
Location: Tokyo, Japan

Re: Compilation fails on Debian/Sid

Post by malattia »

Ha, I didn't notice there was a post on this already and submitted another one (pending approval -- mike: feel free to drop it).

ECDSA_SIG became an opaque structure not allocatable on the stack some time ago[1]. I think it was never meant to be, in fact BIGNUM was made opaque longer ago[2] and I think the libabi code only works because it copies pointers to existing structures, since BIGNUMs have dynamically allocated members that one can't just hope they materialize...

In the meantime, you can restore the definition of ECDSA_SIG_st in the libabi/src/ossl_ec.c file using that structure (note that the position of the definition is important). It's a hack, not a solution in any way.

Code: Select all

--- libabi/src/ossl_ec.c.orig   2016-12-04 21:43:06.512191228 -0800
+++ libabi/src/ossl_ec.c        2016-12-04 21:44:02.699599751 -0800
@@ -22,6 +22,11 @@
 #include <openssl/opensslconf.h>
 #include <openssl/crypto.h>
 
+struct ECDSA_SIG_st {
+    BIGNUM *r;
+    BIGNUM *s;
+};
+
 #if defined(OPENSSL_FIPS) && defined(OPENSSL_HAVE_INIT)
 #define UGLY_FEDORA // always disables EC with key size < 256 bits
 #endif
[1]: https://github.com/openssl/openssl/comm ... 19ffdb7cf2
[2]: https://github.com/openssl/openssl/comm ... 6ac754983d
--
mattia
valerio
Posts: 8
Joined: Sat Apr 12, 2014 8:42 am

Re: Compilation fails on Debian/Sid

Post by valerio »

Nice work. I cannot tell if it's just an hack or workaround, but it solves my compilation problems and makemkv starts. Many many thanks. :D
niiler
Posts: 2
Joined: Fri Dec 30, 2016 6:05 pm

Re: Compilation fails on Debian/Sid

Post by niiler »

I too have had this problem. I'm running VectorLinux (essentially Slackware 14.1 x64). I wonder if I have applied this fix correctly:

Code: Select all

#include <lgpl/osslabi.h>
#include <openssl/opensslconf.h>
#include <openssl/bn.h>
#include <openssl/crypto.h>
#include <openssl/opensslv.h>

struct ECDSA_SIG_st {
    BIGNUM *r;
    BIGNUM *s;
};

#if defined(OPENSSL_FIPS) && defined(OPENSSL_HAVE_INIT)
#define UGLY_FEDORA // always disables EC with key size < 256 bits
#endif

However, I get the following error:
-Xlinker -soname=libmakemkv.so.1 -lc -lstdc++ -lcrypto -lz -lexpat -lavcodec -lavutil -lm -lrt
In file included from libabi/src/ossl_ec.c:40:0:
/usr/include/openssl/ecdsa.h:78:16: error: redefinition of 'struct ECDSA_SIG_st'
libabi/src/ossl_ec.c:27:8: note: originally defined here
make: *** [out/libmakemkv.so.1.full] Error 1
I have also tried with commenting out the #include <openssl/ecdsa.h> line below, but it seems that this is needed elsewhere. Any thoughts? Am I doing something boneheaded, or not implementing your fix correctly?

Thanks!
malattia
Posts: 8
Joined: Sun Dec 01, 2013 2:59 am
Location: Tokyo, Japan

Re: Compilation fails on Debian/Sid

Post by malattia »

You shouldn't need the patch with 1.10.4.
--
mattia
niiler
Posts: 2
Joined: Fri Dec 30, 2016 6:05 pm

Re: Compilation fails on Debian/Sid

Post by niiler »

Interestingly, when I went back to 1.10.3, I didn't need the patch (and it compiled without complaint!), but on 1.10.4, I can't seem to get it to compile no matter what. I've got to wonder if it isn't because we're still using OpenSSL 1.0.1 on VectorLinux 64bit (7.1). In any event, thanks for the reply.
malattia
Posts: 8
Joined: Sun Dec 01, 2013 2:59 am
Location: Tokyo, Japan

Re: Compilation fails on Debian/Sid

Post by malattia »

Ah, yes. If this is the error you get, you don't need the patch I suggested earlier:

Code: Select all

/usr/include/openssl/ecdsa.h:78:16: error: redefinition of 'struct ECDSA_SIG_st'
Not sure what error you get with 1.10.4, perhaps post that?
--
mattia
Post Reply