在Windows上构建MLT框架时出错 [英] Error building MLT framework on Windows

查看:298
本文介绍了在Windows上构建MLT框架时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在此处中提供的官方建筑指南.我需要MLT来创建视频播放器,并且选择仅安装前4个库,如指南中所述(FFmpeg,SDL,dlfcn-win32和libXML).我还将QT用作我的应用程序的主要框架.

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

同时,由于感到困惑,我在$HOME/中有相同的文件夹(binlibincludeshare).

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

然后我有$HOME/src/mlt个mlt文件.

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

当我运行configure命令时,我得到了这个信息(我禁用了我没有安装的库以减少控制台上的输出):

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

我在文件夹上有ffmpeg和xml2库,但看起来脚本无法找到它们.我还在默认文件夹上安装了QT,但似乎也找不到它.

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?

谢谢您的时间.

我发现在创建pkgconfig文件夹时,我犯了一个命名错误,该更改解决了无法检测到xml2的问题.另外,我手动添加了ffmpeg和qt的路径,这似乎也解决了问题.因此,现在我得到的配置如下:

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

我已经将dlfcn-win32binlibinclude添加到了c:/Qt/Tools/mingw482_32中相应的binlibinclude文件夹中,这解决了我的问题.现在,我遇到了一个新错误,该错误似乎是类似的解决方案,但我看不到-lbz2是什么. 错误如下:

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

现在我遇到以下错误: 编译代码运行后(生成.o),我在avformat模块的每个文件中得到对'ffmpeg_function'的未定义引用".我注意到它可以正确找到包含文件,因此问题必须出在查找库文件上.

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.

我注意到在config.mak文件中,LDFLAGS如下所示:

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

标识文件而不是文件夹不是-l(小写)吗?还是期望每个库有一个文件夹?除了ffmpeg库以外,其他库的命名也不同(例如avformat-56.dll)

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)

为了进行测试,我将以下内容添加到了avformat模块的config.mak中:

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

dll位于该文件夹中.

The dlls are on that folder.

看来我终于设法编译了!我将LDFLAGS更改为以下内容:

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

它完成了而没有错误.

一直以来,谢谢Brian,并帮助您给了我!

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

推荐答案

确保已安装pkg-config:

Make sure you have pkg-config installed:

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

您应该能够从命令行运行pkg-config并获得良好的响应.例如:

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

如果从pkg-config收到的响应不佳,则可能需要将PKG_CONFIG_PATH设置为指向每个依赖项的.pc文件.

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.

此外,请仔细阅读pkg-config文档.对于Windows,可能需要考虑一些特殊的注意事项:

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

您还需要安装dlfcn-win32.根据MLT Windows说明:

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

  • 下载 dlfcn-win32
  • cd〜/src/dlfcn-win32-r19
  • ./configure --enable-shared完成所有安装
  • 要重新分发此文件,请将/mingw/bin/libdl.dll复制到您的构建目录中.
  • 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.

如果您确实遵循了这些说明,则可能需要找到一个放置libdl.dll的位置,以便链接程序可以找到它.

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

对于"-lbz2"错误,您似乎需要下载,编译和安装bzip2库,以与ffmpeg所针对的库相匹配: bzip2 1.0.6

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

查看下载的ffmpeg共享软件包随附的README.txt文件.编译ffmpeg的外部库很长. bzip2是第一个.您可能需要下载/编译/安装更多此类软件.

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.

您不应同时指定--avformat-shared和--avformat-static-它们是互斥的.您可以尝试不指定它们.或者,尝试设置--avformat-shared = $ HOME/build/

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/

我认为您无法链接的原因是因为Zeranoe构建不再包含pkg-config文件(.pc).

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

MLT配置脚本依靠pkg-config设置正确的链接器标志. MLT配置脚本可以扩展为允许用户指定正确的链接器标志.在此之前,我认为黑客config.mak(像您一样)将是使其在Windows上运行的唯一方法.

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!

这篇关于在Windows上构建MLT框架时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆