2

I've been following the official building guide provided here. I need MLT to create a video player and I opted to only install the first 4 libraries, as stated on the guide (FFmpeg, SDL, dlfcn-win32, and libXML). I'm also using QT as my main framework for my application.

I'm a bit confused as far as this guide goes because I find the instructions for where the libraries should go a bit confusing. This is my current folder structure:

$HOME = C:\MinGW\msys\1.0\home\TKB (TKB is my user)
$HOME/build/lib -> libraries
$HOME/build/bin -> binaries
$HOME/build/include -> includes
$HOME/build/share/ffmpeg -> for the "presets" folder

At the same time, because I was confused, I have the same folders (bin, lib, include, share) inside $HOME/.

Then I have $HOME/src/mlt with the mlt files.

When I run the configure command I get this (I disabled the libraries I didn't install to reduce the output on the console):

Command: ./configure --prefix=$HOME/build --target-os=MinGW --enable-gpl --disable-decklink --disable-frei0r --disable-gtk2 --disable-sox --disable-jackrack --disable-swfdec --disable-resample

Configuring framework:
Configuring modules:
Configuring modules/avformat:
- libavformat not found: disabling
Configuring modules/core:
Configuring modules/feeds:
Configuring modules/kdenlive:
Configuring modules/linsys:
- does not build on OS X or Windows:disabling
Configuring modules/lumas:
Configuring modules/motion_est:
Configuring modules/normalize:
Configuring modules/oldfilm:
Configuring modules/opengl:
- movit not found: disabling
Configuring modules/plus:
Configuring modules/plusgpl:
Configuring modules/qt:
- Libexif not found, disabling exif features (auto rotate)
- Qt not found: disabling
Configuring modules/rtaudio:
Configuring modules/sdl:
Configuring modules/vid.stab:
- vid.stab not found: disabling
Configuring modules/videostab:
Configuring modules/vmfx:
Configuring modules/xine:
Configuring modules/xml:
- xml2 not found: disabling xml module
Configuring mlt++:
Configuring swig:
GPLv2 license used; GPLv3 components disabled

I have ffmpeg and the xml2 libraries on the folders but it looks like the script is not able to find them. I also have QT installed on the default folder and it also doesn't seem to find it.

I tried installing anyway (make all install) and I get the following error:

c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: cannot find -ldl
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: cannot find -lpthread
collect2.exe: error: ld returned 1 exit status
make[1]: *** [libmlt-6.dll] Error 1
make[1]: Leaving directory '/home/TKB/src/mlt-0.9.6/src/framework'
make: *** [all] Error 1

Can anyone help me with these errors?

Thank you for your time.

EDIT: I found out that I made a naming mistake when creating the pkgconfig folder, changing that solved the xml2 not being detected problem. Also, I've added the paths for ffmpeg and qt manually and that also seemed to solve the problem. So now what I get with the configure is the following:

./configure --prefix=/home/TKB/build --enable-gpl --disable-decklink --disable-frei0r --disable-gtk2 --disable-sox --disable-jackrack --disable-swfdec --disable-resample --qt-libdir=C:/Qt/5.3/mingw482_32/lib --qt-includedir=C:/Qt/5.3/mingw482_32/include --avformat-shared=/home/TKB/share/ffmpeg --avformat-static=/home/TKB/bin

Configuring framework:
Configuring modules:
Configuring modules/avformat:
Configuring modules/core:
Configuring modules/feeds:
Configuring modules/kdenlive:
Configuring modules/linsys:
- does not build on OS X or Windows:disabling
Configuring modules/lumas:
Configuring modules/motion_est:
Configuring modules/normalize:
Configuring modules/oldfilm:
Configuring modules/opengl:
- movit not found: disabling
Configuring modules/plus:
Configuring modules/plusgpl:
Configuring modules/qt:
- Libexif not found, disabling exif features (auto rotate)
- Qt version 5.x detected
- Include directory: C:/Qt/5.3/mingw482_32/include
Configuring modules/rtaudio:
Configuring modules/sdl:
Configuring modules/vid.stab:
- vid.stab not found: disabling
Configuring modules/videostab:
Configuring modules/vmfx:
Configuring modules/xine:
Configuring modules/xml:
Configuring mlt++:
Configuring swig:
GPLv2 license used; GPLv3 components disabled

When I run make all install I still get an error, which is the following:

c:/Qt/Tools/mingw482_32/bin/../lib/gcc/i68-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -ldl
collect2.exe: error: ld returned 1 exit status
make[1]: *** [libmlt-6.dll] Error 1
make[1]: Leaving directory '/home/TKB/src/mlt/src/framework'
make: *** [all] Error 1

EDIT2: I have added dlfcn-win32's bin, lib and include to the respective bin, lib and include folders in c:/Qt/Tools/mingw482_32, which solved my problem. Now I am getting a new error, which seems of similar solution but I don't see what -lbz2 is. The error follows below:

c:/Qt/Tools/mingw482_32/bin/../lib/gcc/i68-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lbz2
collect2.exe: error: ld returned 1 exit status
make[2]: *** [../libmltavformat.dll] Error 1
make[2]: Leaving directory '/home/TKB/src/mlt/src/modules/avformat'
make[1]: *** [all] Error 1
make[1]: Leaving directory '/home/TKB/src/mlt/src/modules'
make: *** [all] Error 1

EDIT3: Right now I'm getting the following error: After the compile code runs (it generates the .o) I get "undefined reference to 'ffmpeg_function'" in every file of the avformat module. I've noticed that it locates the includes correctly, so the problem must be in finding the libs.

I've noticed that on the config.mak file the LDFLAGS are like this:

LDFLAGS+=-L/home/TKB/bin/libavformat -L/home/TKB/bin/libavcodec -L/home/TKB/bin/libavutil
LDFLAGS+=-L/home/TKB/bin/libswscale
LDFLAGS+=-L/home/TKB/bin/libavdevice

Shouldn't it be -l (lower case) to identify a file instead of a folder? Or is it expecting one folder per lib? Besides the ffmpeg libs are named differently (e.g. avformat-56.dll)

EDIT4: To test things out I have added the following to the config.mak of the avformat module:

LDFLAGS+=-l/home/TKB/bin/avformat-56 -l/home/TKB/bin/avcodec-56 -l/home/TKB/bin/avutil-54
LDFLAGS+=-l/home/TKB/bin/swscale-3
LDFLAGS+=-l/home/TKB/bin/avdevice-56

The previous error disappeared but now I am getting the following one:

c:/Qt/Tools/mingw482_32/bin/../lib/gcc/i68-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lC:/MinGW/mysys/1.0/home/TKB/bin/avformat-56
c:/Qt/Tools/mingw482_32/bin/../lib/gcc/i68-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lC:/MinGW/mysys/1.0/home/TKB/bin/avcodec-56
c:/Qt/Tools/mingw482_32/bin/../lib/gcc/i68-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lC:/MinGW/mysys/1.0/home/TKB/bin/avutil-54
c:/Qt/Tools/mingw482_32/bin/../lib/gcc/i68-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lC:/MinGW/mysys/1.0/home/TKB/bin/swscale-3
c:/Qt/Tools/mingw482_32/bin/../lib/gcc/i68-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lC:/MinGW/mysys/1.0/home/TKB/bin/avdevice-56
collect2.exe: error: ld returned 1 exit status
make[2]: *** [../libmltavformat.dll] Error 1
make[2]: Leaving directory '/home/TKB/src/mlt/src/modules/avformat'
make[1]: *** [all] Error 1
make[1]: Leaving directory '/home/TKB/src/mlt/src/modules'
make: *** [all] Error 1

The dlls are on that folder.

EDIT5: It seems I finally managed to compile! I changed the LDFLAGS to the following:

LDFLAGS+=-L/home/TKB/bin
LDFLAGS+=-lavformat-56 -lavcodec-56 -lavutil-54
LDFLAGS+=-lswscale-3
LDFLAGS+=-lavdevice-56

And it finished without errors.

Thank you Brian for all the time and help you gave me!

Solidus
  • 698
  • 1
  • 9
  • 23
  • Hi!... I'm trying to build MLT framework on Windows too. And I have doubts about the process. Can you please tell me what is the $HOME folder?. I will really appreciate if you can give me the steps you follow because I agree with you: Guide is confusing. Thank you so much – Angie Quijano Oct 22 '16 at 23:18
  • Unfortunately I did this a while ago in a laptop that belonged to my previous employee. The home folder should be the directory that leads to your username folder. – Solidus Nov 01 '16 at 15:25

1 Answers1

2

Make sure you have pkg-config installed:

http://www.mltframework.org/pub/Shotcut/SetupWindowsDev/pkg-config.exe

You should be able to run pkg-config from the command line and get a good response. e.g:

# pkg-config --modversion libxml-2.0
2.9.1
# pkg-config --modversion QtGui
4.8.6

If you don't get a good response from pkg-config, you may need to set PKG_CONFIG_PATH to point at the .pc files for each of the dependencies.

Also, have a good look at the pkg-config documentation. There are some special considerations you may need to make for Windows:

http://linux.die.net/man/1/pkg-config

You also need to install dlfcn-win32. From the MLT Windows instructions:

  • Download dlfcn-win32
  • cd ~/src/dlfcn-win32-r19
  • ./configure --enable-shared make all install
  • To make this redistributable, copy /mingw/bin/libdl.dll to your build directory.

If you did follow those instructions, perhaps you need to find a place to put libdl.dll so that the linker finds it.

For the "-lbz2" error, it looks like you need to download, compile and install the bzip2 library to match the one that ffmpeg was compiled against: bzip2 1.0.6

Have a look at the README.txt file that came with the ffmpeg-shared package you downloaded. There is a long list of external libraries that ffmpeg was compiled against. bzip2 is the first one. You might need to download/compile/install more of those.

EDIT 3:

You should not specify both --avformat-shared and --avformat-static - they are mutually exclusive. You could try specifying neither of them. Or, try setting --avformat-shared=$HOME/build/

EDIT 4:

I think the reason that you are having trouble linking is because the Zeranoe builds no longer include pkg-config files (.pc).

http://ffmpeg.zeranoe.com/forum/viewtopic.php?f=7&t=532&hilit=pkg+config

The MLT configure script relies on pkg-config to set the correct linker flags. The MLT configure script could be extended to allow the user to specify the correct linker flags. Until that happens, I think that hacking config.mak (like you did) will be the only way to make it work on Windows.

I'm glad you got it to work. Cheers!

Brian
  • 1,200
  • 6
  • 8
  • I have added the PKG_CONFIG_PATH as it says on the instructions: export PKG_CONFIG_PATH=$HOME/lib/pkgconfig Just now I noticed that my folder for pkg was wrong (pkg-config) and that solved the xml2 problem on configure. I also added new lines to the command that solved me the QT and ffmpeg detection (--qt-libdir=C:/Qt/5.3/mingw482_32/lib --qt-includedir=C:/Qt/5.3/mingw482_32/include --avformat-shared=/home/TKB/share/ffmpeg --avformat-static=/home/TKB/bin). I still got a similar error when doing make install. I'll add it in my question as in a comment it's hard to show the error. – Solidus Apr 06 '15 at 15:28
  • Also, running the commands you told me I get: 2.6.22 for libxml-2.0 and 5.3.1 for Qt5Gui – Solidus Apr 06 '15 at 15:40
  • Looks like the linker can't find libdl.dll. I edited my answer. – Brian Apr 06 '15 at 18:11
  • I added the files to the c:/Qt/Tools/mingw482_32 bin, lib and include folders which solved the issue, but now I'm getting a new one, which seems similar to the previous one. I have edited it on my question – Solidus Apr 06 '15 at 18:47
  • ffmpeg was linked against bzip2 (and probably other libraries) that you will need to download and install. I edited my answer. – Brian Apr 06 '15 at 19:20
  • Thank you once again for the help. I've solved the problem but the errors seem to never stop :S. Now I'm getting an error on the "mlt av files" (e.g. producer_avformat). Every call to a ffmpeg function gives undefined reference error. I'm finding this strange as I gave the location in configure and it was detected. – Solidus Apr 06 '15 at 20:17
  • The MLT configure script checks for its dependencies, but it assumes that those dependencies are installed correctly. In other words, it doesn't check for its dependencies' dependencies. When you run ffmpeg, does it work correctly? – Brian Apr 06 '15 at 20:30
  • Does it help if you add: "--target-os=MinGW --target-arch=i686" – Brian Apr 06 '15 at 21:06
  • Yes, ffmpeg seems to run correctly. Adding those to configure, right? I still get the same error. – Solidus Apr 07 '15 at 11:45
  • I've updated my question with that, I believe I have found the problem. The error I'm getting after the compile code runs (it generates the .o) is "undefined reference to 'ffmpeg_function' in every file of the avformat module. I've noticed that it locates the includes correctly, the problem is finding the libs and I've noticed on config.mak that the LDFLAGS are like this: L/home/TKB/bin/libavformat -L/home/TKB/bin/libavcodec -L/home/TKB/bin/libavutil. Shouldn't it be -l for the file? Or is it expecting every lib on a different folder? The names are also not like that. – Solidus Apr 07 '15 at 15:06
  • Seems that I finally managed to build the framework! I've updated the final solution on my question. Thank you for everything Brian! – Solidus Apr 07 '15 at 16:32