Page 1 of 1

MakeMKV 1.10.4 - Build Fails FFmpeg-3.2.2 (Ubuntu 15.10)

Posted: Sat Dec 31, 2016 5:00 pm
by macfreak84
Followed instructions at: http://www.makemkv.com/forum2/viewtopic.php?f=3&t=224

1. Downloaded FFmpeg from http://ffmpeg.org/releases/ffmpeg-3.2.2.tar.bz2
2. Configured with: ./configure --prefix=/tmp/ffmpeg --enable-static --disable-shared --enable-pic --disable-yasm --enable-libfdk-aac
3. Build Succeeded.

4. Configured makemkv-oss with: PKG_CONFIG_PATH=/tmp/ffmpeg/lib/pkgconfig ./configure
5. Configure failed with:
...
checking whether LIBAVCODEC_VERSION_MAJOR is declared... yes
checking LIBAVCODEC_VERSION_MAJOR... 57
checking for AVFrame.nb_samples... yes
checking whether AV_SAMPLE_FMT_U8P is declared... yes
checking for avcodec_encode_audio2... no
configure: error: The libavcodec library is too old. Please get a recent one from http://www.ffmpeg.org

I then commented out lines 4897-4899 because I believed them to be in error.

6. Reconfigured makemkv-oss with: PKG_CONFIG_PATH=/tmp/ffmpeg/lib/pkgconfig ./configure
7. Configure succeeded. Build failed with:
...
/usr/bin/ld: /usr/local/lib/libfdk-aac.a(aacdecoder_lib.o): relocation R_X86_64_32S against `channelMappingTableWAV' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libfdk-aac.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
Makefile:59: recipe for target 'out/libmakemkv.so.1.full' failed
make: *** [out/libmakemkv.so.1.full] Error 1

8. Used instructions from https://trac.ffmpeg.org/wiki/Compilatio ... libfdk-aac to recompile libfdk-aac from source.
9. Tried again to build makemkv-oss. Failed with:
...
In file included from libffabi/src/ffabi.c:22:0:
/tmp/ffmpeg/include/libavcodec/avcodec.h:5284:5: note: declared here
int avcodec_encode_audio2(AVCodecContext *avctx, AVPacket *avpkt,
^
/tmp/ffmpeg/lib/libavutil.a(hwcontext_vaapi.o): In function `vaapi_device_free':
/home/eliot/Documents/MakeMKV_Source/ffmpeg-3.2.2/libavutil/hwcontext_vaapi.c:829: undefined reference to `XCloseDisplay'
/tmp/ffmpeg/lib/libavutil.a(hwcontext_vaapi.o): In function `vaapi_device_create':
/home/eliot/Documents/MakeMKV_Source/ffmpeg-3.2.2/libavutil/hwcontext_vaapi.c:859: undefined reference to `XOpenDisplay'
/home/eliot/Documents/MakeMKV_Source/ffmpeg-3.2.2/libavutil/hwcontext_vaapi.c:864: undefined reference to `vaGetDisplay'
/home/eliot/Documents/MakeMKV_Source/ffmpeg-3.2.2/libavutil/hwcontext_vaapi.c:871: undefined reference to `XDisplayName'
/home/eliot/Documents/MakeMKV_Source/ffmpeg-3.2.2/libavutil/hwcontext_vaapi.c:861: undefined reference to `XDisplayName'
/home/eliot/Documents/MakeMKV_Source/ffmpeg-3.2.2/libavutil/hwcontext_vaapi.c:885: undefined reference to `vaGetDisplayDRM'
/home/eliot/Documents/MakeMKV_Source/ffmpeg-3.2.2/libavutil/hwcontext_vaapi.c:859: undefined reference to `XOpenDisplay'
/home/eliot/Documents/MakeMKV_Source/ffmpeg-3.2.2/libavutil/hwcontext_vaapi.c:861: undefined reference to `XDisplayName'
/home/eliot/Documents/MakeMKV_Source/ffmpeg-3.2.2/libavutil/hwcontext_vaapi.c:866: undefined reference to `XDisplayName'
/tmp/ffmpeg/lib/libavutil.a(hwcontext_vdpau.o): In function `vdpau_device_create':
/home/eliot/Documents/MakeMKV_Source/ffmpeg-3.2.2/libavutil/hwcontext_vdpau.c:432: undefined reference to `XOpenDisplay'
/home/eliot/Documents/MakeMKV_Source/ffmpeg-3.2.2/libavutil/hwcontext_vdpau.c:438: undefined reference to `XDisplayString'
/home/eliot/Documents/MakeMKV_Source/ffmpeg-3.2.2/libavutil/hwcontext_vdpau.c:440: undefined reference to `XDefaultScreen'
/home/eliot/Documents/MakeMKV_Source/ffmpeg-3.2.2/libavutil/hwcontext_vdpau.c:440: undefined reference to `vdp_device_create_x11'
/home/eliot/Documents/MakeMKV_Source/ffmpeg-3.2.2/libavutil/hwcontext_vdpau.c:434: undefined reference to `XDisplayName'
/tmp/ffmpeg/lib/libavutil.a(hwcontext_vdpau.o): In function `vdpau_device_free':
/home/eliot/Documents/MakeMKV_Source/ffmpeg-3.2.2/libavutil/hwcontext_vdpau.c:411: undefined reference to `XCloseDisplay'
collect2: error: ld returned 1 exit status
Makefile:59: recipe for target 'out/libmakemkv.so.1.full' failed
make: *** [out/libmakemkv.so.1.full] Error 1

UPDATE:

The problem was not with avcodec_encode_audio2 but was just a linking issue.

I compiled against the previous stable version of ffmpeg (3.1.6) and the configuration of makemkv-oss worked as expected.
To correct the linking problem change line 15 in the makemkv-oss Makefile (after configure) to:

FFMPEG_LIBS=-L/tmp/ffmpeg/lib -L/usr/local/lib -L/tmp/ffmpeg/lib -lavcodec -lva -lxcb -lxcb-shm -lxcb -lxcb-xfixes -lxcb-render -lxcb-shape -lxcb -lxcb-shape -lxcb -lasound -lSDL -lfdk-aac -llzma -lz -pthread -lswresample -lavutil -lX11 -lm -lvdpau -lva -lva-drm -lva-x11

SHOUT OUT: http://stackoverflow.com/questions/3899 ... 8#39217028

Happy New Year!

Re: MakeMKV 1.10.4 - Build Fails FFmpeg-3.2.2 (Ubuntu 15.10)

Posted: Thu Jan 05, 2017 7:53 am
by muddysteel
similar issues with MakeMKV 1.10.3 and for kicks, I regressed to 1.9.8.

Something with the dependency sequences in ffmpeg 3.2.2 will need addressing with ./configure. I backed up to ffmpeg 1.2.12 and the MakeMKV configure works.

For playing around with dependency isolation, look at the 'config.log'. Find where the 'avcodec_encode_audio2' is failing (should be around line 317). The next line will be the compile/link line that is used, which has the sequence of libraries being used. As your stackoverflow link states, the order matters!

If you pull that line out into its own shell script, you can tweak the thing until it compiles OK. That would be the order required.. (And the 'conftest.c' source code follows in the 'config.log' just after the indicated lines. Each line starts with, '|'. Just copy to another file/edit out the lead two chars (sed/awk/gvim regex/etc) and save as the 'conftest.c' file).

I found that the libraries -lX11, -lm , -lvdpau had to be moved to the last position.. Now to figure out how to mangle ./configure environment VARS to affect that bit (CCFLAGs, etc.).

Re: MakeMKV 1.10.4 - Build Fails FFmpeg-3.2.2 (Ubuntu 15.10)

Posted: Wed Jan 11, 2017 5:26 pm
by NullNix
macfreak84 wrote:checking for avcodec_encode_audio2... no
configure: error: The libavcodec library is too old. Please get a recent one from http://www.ffmpeg.org

I then commented out lines 4897-4899 because I believed them to be in error.

6. Reconfigured makemkv-oss with: PKG_CONFIG_PATH=/tmp/ffmpeg/lib/pkgconfig ./configure
7. Configure succeeded. Build failed with:
...
/usr/bin/ld: /usr/local/lib/libfdk-aac.a(aacdecoder_lib.o): relocation R_X86_64_32S against `channelMappingTableWAV' can not be used when making a shared object; recompile with -fPIC
These are almost certainly the same problem. Build shared libfdk-aac and ffmpeg, and the problem will go away. I strongly suspect your third problem will go away too.

FWIW makemkv-oss works fine for me with ffmpeg 3.2.1, built shared.