安装mingw+msys问题之三——其他环境问题

来源:互联网 发布:云天明 知乎 编辑:程序博客网 时间:2024/06/03 17:45

configure的库检查依赖于pkg-config,而其又依赖于glib,则两者必须安装。如果需要编译ffplay,有需要依赖SDL-devel。

这样就够了吗?不是。编译的过程中,出现了一个莫名其妙的问题,/home/keith/staged/mingw32/lib/libiconv.la: No such file or directory

一个外国哥们和我遇到同样的问题,当时下面有人解释了的,我觉得挺有道理的。

http://stackoverflow.com/questions/23637991/why-does-building-liblzma-fail-with-cannot-find-the-library

以下为英文摘录:

According to this bug report, there is something wrong with the latest gettext package (gettext-0.18.3.2).

I've tried the following 2 ways. It seems both working well.

  • Remove bad files

    pushd /mingw/lib/ && rm libasprintf.la libgettextlib.la libgettextpo.la libgettextsrc.la libintl.la && popd

    Or you can just rename them. In fact, you will see /home/keith/... in these *.la files if you open them with text editors.

  • Use gettext-0.18.3.1 package

    Close MSYS and run the following command to use the older version: mingw-get upgrade "gettext=0.18.3.1-1*" , with PATH=C:\mingw\bin;%PATH%, of course.

这个哥们的意思就是,gettext-0.18.3.2的版本是有问题,两种方法解决,第一种略过,第二种简单就是用之前版本的gettext。我按照他的方法做了,果然解决了这个问题。当然,要卸载了gettext,在bin目录下自己考进去一个gettext

再一次configure make,又出现了问题。c:\mingw\include\unistd.h:79:1: error: expected ',' or ';' before 'int' int

看了一个博客,他说 http://blog.csdn.net/u013699869/article/details/45894083

libavutil\file.c
libavutil\file_open.c
libavutil\log.c
libavutil\random_seed.c
libavutil\time.c
libavformat\cache.c
libavformat\dashenc.c
libavformat\file.c
libavformat\hdsenc.c
libavformat\smoothstreamingenc.c
libavformat\hlsenc.c
libavcodec\libxvid.c
libavcodec\libxvid_rc.c
ffmpeg.c

都有这个错误。其实是没有找到 _EXTERN_C _cdecl __MINGW_NOTHROW ,其在 window.h 中。

解决办法:在以上文件中, #include <unistd.h> 之前加上 #include <windows.h>

他的方法我没试过,但直觉觉得应该有用,只是太麻烦了,而且我觉得改了ffmpeg的源码之后,问题会越来越多,于是尝试了下面一个博客的办法。

http://blog.csdn.net/dancing_night/article/details/44831085#0-renren-1-41719-98fde57bb3d39343db0f272b38411f3e

将unistd.h文件修改,

解决方案:

把unistd.h里的内容替换为:

#ifndef _UNISTD_H
/*
 * This file is part of the Mingw32 package.
 *
 * unistd.h maps (roughly) to io.h
 * Other headers included by unistd.h may be selectively processed;
 * __UNISTD_H_SOURCED__ enables such selective processing.
 */
#define _UNISTD_H
#define __UNISTD_H_SOURCED__ 1


#include <io.h>
#include <process.h>
#include <getopt.h>


/* These are also defined in stdio.h. */
#ifndef SEEK_SET
#define SEEK_SET 0
#endif


#ifndef SEEK_CUR
#define SEEK_CUR 1
#endif


#ifndef SEEK_END
#define SEEK_END 2
#endif


#ifdef __cplusplus
extern "C" {
#endif


#if !defined __NO_ISOCEXT
#include <sys/types.h> /* For useconds_t. */


int __cdecl __MINGW_NOTHROW usleep(useconds_t useconds);
#endif  /* Not __NO_ISOCEXT */


/* This is defined as a real library function to allow autoconf
   to verify its existence. */
int ftruncate(int, off_t);
#ifndef __NO_INLINE__
__CRT_INLINE int ftruncate(int __fd, off_t __length)
{
  return _chsize (__fd, __length);
}
#endif


#ifdef __cplusplus
}
#endif


#undef __UNISTD_H_SOURCED__
#endif /* _UNISTD_H */

再次编译,通过了。make完成。make install。但是用ffmpeg.exe进行转码的时候,会缺少依赖库,得装faac,fdk-aac,x264(编码h264)

忘了说一个yasm的问题,ffmpeg为了加快编译的速度,使用了汇编代码,因此编译时会出现找不到yasm asm之类的问题,两种方式解决,一种通过编译选项--disable-asm,不使用汇编代码,另一种下载yasm.exe,放在bin目录之下,命名必须是yasm.exe


0 0
原创粉丝点击