Error building MLT framework on Windows - c++

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!

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!

Related

How to fix 'cannot find -lgmp' build error on OMNeT++?

I have become aware that OverSim can be used with the newer versions of OMNeT++. I installed OMNeT++ 5.6.1 on Windows 10 by following the instructions in InstallGuide. Then, I imported INET 3.6.5 in OMNeT++ and built it, there were no errors. Finally, I imported OverSim-20190424 and when I build it I get the following error at the end of the build process:
make[1]: Entering directory '/c/omnet561/oversim-20190424/src'
Creating executable: ../out/gcc-debug/src/OverSim_dbg.exe
C:/omnet561/omnetpp-5.6.1/tools/win64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lgmp
collect2.exe: error: ld returned 1 exit status
make[1]: *** [Makefile:418: ../out/gcc-debug/src/OverSim_dbg.exe] Error 1
make[1]: Leaving directory '/c/omnet561/oversim-20190424/src'
make: *** [Makefile:11: all] Error 2
"make MODE=debug -j8 all" terminated with exit code 2. Build might be incomplete.
12:15:59 Build Failed. 3 errors, 0 warnings. (took 12s.448ms)
The other two errors are:
Description Resource Path Location Type
make: *** [Makefile:11: all] Error 2 OverSim C/C++ Problem
make[1]: *** [Makefile:418: ../out/clang-debug/src/OverSim_dbg.exe] Error 1 OverSim C/C++ Problem
Does anyone know how this error can be fixed? I have tried using OverSim on Windows 7 as well and tried using OMNeT++ 5.4.1 but the same error is still produced.
The libgmp libraries (libgmp-10.dll and libgmpxx-4.dll) are in the directory "C:/omnet561/omnetpp-5.6.1/tools/win64/mingw64/bin". I think the problem here might be that the software is using the wrong directory to search for the libraries but I'm not sure how to fix such an issue.
Try to add path to libgmp libraries using Makefrag.
Go to OverSim-20190424 Project Properties, choose OMNeT++ | Makemake | select src | Options | Custom | Makefrag and write:
LIBS += -L/c/libraries/libgmp
It is assumed that libgmp libraries (*.dll or *.a) are in C:\libraries\libgmp.
EDIT
Open Makefrag from oversim-20190424\src\ in a text editor, and then change LIBS and OMNETPP_LIBS to proper values:
LIBS += -L/sw/lib -L/c/omnet561/omnetpp-5.6.1/tools/win64/mingw64/bin
OMNETPP_LIBS += -lgmp
or
OMNETPP_LIBS += -lgmp-10
For anyone who encounters the same problem, I managed to solve it by using OMNeT++ 5.6.1 and Oversim 20190424 on Ubuntu 18.04. When I built Oversim, I got an error "Could not find gmp.h", to solve that error I installed libgmp3-dev - apt-get install libgmp3-dev. If somebody manages to get it to work on Windows 10 or has an idea of how it can be fixed, then please feel free to post.

How to correctly import freenect2 using cmake?

I have to use a kinect2 (ubuntu 16.04 LTS). So I installed several things :
OpenNi (https://github.com/OpenNI/OpenNI)
OpenNi2 (https://github.com/occipital/openni2
libfreenect, (because I used the first kinect before) (https://github.com/OpenKinect/libfreenect)
libfreenect2 (https://github.com/OpenKinect/libfreenect2)
PrimeSese (with the corresponding part of https://www.icyphy.org/accessors/wiki/Main/InstallingThePrimeSenseKinectSensorOnUbuntu)
OpenCV (https://github.com/opencv/opencv)
When I was using the first kinect I was able to import the libfreenect tools without an problem, but now way with libfreenect !
You can find my CMake here. There isn't any problem with the others libs in the CMake.
What I changed to install libfreenect2:
I clone the repository in my folder ~/sofware. (I put all my libs here)
Instead of
cmake .. -DCMAKE_INSTALL_PREFIX=$HOME/freenect2
I did
cmake .. -DCMAKE_INSTALL_PREFIX=$HOME/software/libfreenect2/freenect2
With my Cmake when I compile I got this:
CMakeFiles/Kinect2CaptureYM.dir/app/Kinect2CaptureYM.cpp.o: In function `Kinect2CaptureYM::Kinect2CaptureYM()':
Kinect2CaptureYM.cpp:(.text._ZN16Kinect2CaptureYMC1Ev[_ZN16Kinect2CaptureYMC1Ev]+0x108): undefined reference to `libfreenect2::Freenect2::Freenect2(void*)'
Kinect2CaptureYM.cpp:(.text._ZN16Kinect2CaptureYMC1Ev[_ZN16Kinect2CaptureYMC1Ev]+0x427): undefined reference to `libfreenect2::Freenect2::~Freenect2()'
CMakeFiles/Kinect2CaptureYM.dir/app/Kinect2CaptureYM.cpp.o: In function `Kinect2CaptureYM::~Kinect2CaptureYM()':
Kinect2CaptureYM.cpp:(.text._ZN16Kinect2CaptureYMD1Ev[_ZN16Kinect2CaptureYMD1Ev]+0xb8): undefined reference to `libfreenect2::Freenect2::~Freenect2()'
collect2: error: ld returned 1 exit status
CMakeFiles/Kinect2CaptureYM.dir/build.make:156: recipe for target 'Kinect2CaptureYM' failed
make[2]: *** [Kinect2CaptureYM] Error 1
CMakeFiles/Makefile2:190: recipe for target 'CMakeFiles/Kinect2CaptureYM.dir/all' failed
make[1]: *** [CMakeFiles/Kinect2CaptureYM.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
So my make isn't able to link the the freenec2 lib. But I don't understand why as I put this in my makefile:
FIND_PACKAGE(freenect2 REQUIRED)
LIST(APPEND INCLUDE_DIRS ${FREENECT2_INCLUDE_DIRS})
LIST(APPEND LIBRARIES ${FREENECT2_LIBRARIES})
Does someone know how to link it correctly ? I'm really stuck beacause of that :/
If you need anything else just ask, thx!
PS : The most important things in my code are (enough to make the make crash):
the include : #include <libfreenect2/libfreenect2.hpp>
the declaration : libfreenect2::Freenect2 freenect2;

Fedora 22 - compile - __atomic_is_lock_free

I am try to compile a software (SuperCollider) on Fedora 22 but I run into a problem:
libsupernova.a(server.cpp.o): In function `std::atomic<boost::lockfree::detail::tagged_index>::is_lock_free() const':
/usr/include/c++/5.1.1/atomic:212: undefined reference to `__atomic_is_lock_free'
collect2: error: ld returned 1 exit status
server/supernova/CMakeFiles/supernova.dir/build.make:96: recipe for target 'server/supernova/supernova' failed
make[2]: *** [server/supernova/supernova] Error 1
CMakeFiles/Makefile2:3383: recipe for target 'server/supernova/CMakeFiles/supernova.dir/all' failed
make[1]: *** [server/supernova/CMakeFiles/supernova.dir/all] Error 2
Makefile:146: recipe for target 'all' failed
make: *** [all] Error 2
It seems to me that this is a problem with libatomic. Is it possible that gcc does not link to libatomic?
Does someone have any idea on how to solve this problem?
Another idea would be to try to install -latomic, but I cannot find information about.
Instead I already installed libatomic. I don't know if they are the same.
i ran into the same issue, and yes you do need to link libatomic. the way to do this is to add to the line: set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -latomic") to the top level CMakeLists.txt file before running cmake.
the full flow might look like this:
git clone https://github.com/supercollider/supercollider.git
cd supercollider
add set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -latomic") to top level CMakeLists.txt
run ccmake . to configure the install
mkdir _build ; cd _build
cmake ..
make && <sudo> make install
you may or may not need sudo depending on where you have decided to install supercollider.
It seems to me that this is a problem with libatomic. Is it possible that gcc does not link to libatomic?
It only links to libatomic if you tell it to.
Does someone have any idea on how to solve this problem?
Link to libatomic.
Another idea would be to try to install -latomic, but I cannot find information about. Instead I already installed libatomic. I don't know if they are the same.
You can't "install -latomic" because -latomic is the compiler/linker option that says to link to libatomic, and you can't "install a linker option" because it's an option to a program, not a package.
You install libatomic, then you link to it with -latomic
(Aside: I hope to fix GCC so that you won't need to use -latomic explicitly for simple cases, only more complex ones, see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65913)

How to build Port Audio using mingw and msys?

I have problem building Port Audio on windows machine. I am following this tutorial: http://portaudio.com/docs/v19-doxydocs/compile_windows_mingw.html
Running make after ./configure runs build process and finally outputs this message and that is where build process stop.
/bin/sh ./libtool --mode=link gcc -shared -rpath /usr/local/lib -no-undefined -
export-symbols-regex "(Pa|PaMacCore|PaJack|PaAlsa|PaAsio|PaOSS)_.*" -version-inf
o 2:0:0 -o lib/libportaudio.la src/common/pa_allocation.lo src/common/pa_convert
ers.lo src/common/pa_cpuload.lo src/common/pa_dither.lo src/common/pa_debugprint
.lo src/common/pa_front.lo src/common/pa_process.lo src/common/pa_stream.lo src/
common/pa_trace.lo src/hostapi/skeleton/pa_hostapi_skeleton.lo src/hostapi/wmme/
pa_win_wmme.lo src/os/win/pa_win_hostapis.lo src/os/win/pa_win_util.lo src/os/wi
n/pa_win_waveformat.lo -lwinmm
*** Warning: linker path does not have real file for library -lwinmm.
*** I have the capability to make that library automatically link in when
*** you link to this library. But I can only do this if you have a
*** shared version of the library, which you do not appear to have
*** because I did check the linker path looking for a file starting
*** with libwinmm but no candidates were found. (...for file magic test)
*** The inter-library dependencies that have been dropped here will be
*** automatically added whenever a program is linked with this library
*** or is declared to -dlopen it.
*** Since this library must not contain undefined symbols,
*** because either the platform does not support them or
*** it was explicitly requested with -no-undefined,
*** libtool will only create a static version of it.
libtool: link: lib -OUT:lib/.libs/libportaudio.lib src/common/pa_allocation.o s
rc/common/pa_converters.o src/common/pa_cpuload.o src/common/pa_dither.o src/com
mon/pa_debugprint.o src/common/pa_front.o src/common/pa_process.o src/common/pa_
stream.o src/common/pa_trace.o src/hostapi/skeleton/pa_hostapi_skeleton.o src/ho
stapi/wmme/pa_win_wmme.o src/os/win/pa_win_hostapis.o src/os/win/pa_win_util.o s
rc/os/win/pa_win_waveformat.o
./libtool: line 1115: lib: command not found
make: *** [lib/libportaudio.la] Error 127
I am newbie in building libraries so i dont understand what is wrong here.
Any help is appreciated.

Building Boost with ICU using MinGW

I downloaded the last ICU release (49) binaries and add the following arg to b2:
-sICU_PATH="D:\lib64\icu"
I got
gcc.link D:\boost\1.51.0\boost\boost\bin.v2\libs\locale\build\gcc-mingw-4.7.1\debug\has_icu64.exe
d:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.7.1/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -licui18n
d:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.7.1/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -licudata
collect2.exe: error: ld returned 1 exit status
There were not such libicui18n, libicudata among icu binaries.
So I tried to build it myself. I got this error
PATH=../../lib:../../stubdata:../../tools/ctestfw:$PATH ../../bin/genrb -e UTF-8 -s resources -d uconvmsg root.txt
Makefile:173: recipe for target `uconvmsg/root.res' failed
make[2]: *** [uconvmsg/root.res] Error 127
Could somebody suggest me how I should build Boost with ICU using MinGW?
1.) the libraries in the package you downloaded are named icuin49.dll, icudt49.dll. We build regularly with mingw (and many other platforms) to test, but don't post those binaries.
2.) uconv is just an extra. You can disable it with --disable-extras on the configure line. (not enough info there to tell me why it failed.)