使用zeranoe的自动化脚本mingw-w64-build-3.6.4在ubutun14.04_64bit上交叉编译ffmpeg 2.5

编译期间,碰到的两个大问题,是环境变量设置问题.

先列出执行脚本是碰到的两个问题,后面给出解决方法并记录执行的命令步骤.

问题1: 编译binutils 2.5出错

------------------------------
错误信息:
make[4]: 正在进入目录 `/home/shakin/work/build_for_windows/pkgs/binutils/build/i686-w64-mingw32/gas'
gcc -DHAVE_CONFIG_H -I. -I../../../source/binutils-2.24/gas -I. -I../../../source/binutils-2.24/gas -I../bfd -I../../../source/binutils-2.24/gas/config -I../../../source/binutils-2.24/gas/../include -I../../../source/binutils-2.24/gas/.. -I../../../source/binutils-2.24/gas/../bfd -DLOCALEDIR="\"/home/shakin/work/build_for_windows/mingw-w64-i686/share/locale\"" -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Werror -g -O2 -MT app.o -MD -MP -MF .deps/app.Tpo -c -o app.o ../../../source/binutils-2.24/gas/app.c
gcc -DHAVE_CONFIG_H -I. -I../../../source/binutils-2.24/gas -I. -I../../../source/binutils-2.24/gas -I../bfd -I../../../source/binutils-2.24/gas/config -I../../../source/binutils-2.24/gas/../include -I../../../source/binutils-2.24/gas/.. -I../../../source/binutils-2.24/gas/../bfd -DLOCALEDIR="\"/home/shakin/work/build_for_windows/mingw-w64-i686/share/locale\"" -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Werror -g -O2 -MT as.o -MD -MP -MF .deps/as.Tpo -c -o as.o ../../../source/binutils-2.24/gas/as.c
gcc -DHAVE_CONFIG_H -I. -I../../../source/binutils-2.24/gas -I. -I../../../source/binutils-2.24/gas -I../bfd -I../../../source/binutils-2.24/gas/config -I../../../source/binutils-2.24/gas/../include -I../../../source/binutils-2.24/gas/.. -I../../../source/binutils-2.24/gas/../bfd -DLOCALEDIR="\"/home/shakin/work/build_for_windows/mingw-w64-i686/share/locale\"" -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Werror -g -O2 -MT atof-generic.o -MD -MP -MF .deps/atof-generic.Tpo -c -o atof-generic.o ../../../source/binutils-2.24/gas/atof-generic.c
gcc -DHAVE_CONFIG_H -I. -I../../../source/binutils-2.24/gas -I. -I../../../source/binutils-2.24/gas -I../bfd -I../../../source/binutils-2.24/gas/config -I../../../source/binutils-2.24/gas/../include -I../../../source/binutils-2.24/gas/.. -I../../../source/binutils-2.24/gas/../bfd -DLOCALEDIR="\"/home/shakin/work/build_for_windows/mingw-w64-i686/share/locale\"" -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Werror -g -O2 -MT compress-debug.o -MD -MP -MF .deps/compress-debug.Tpo -c -o compress-debug.o ../../../source/binutils-2.24/gas/compress-debug.c
gcc -DHAVE_CONFIG_H -I. -I../../../source/binutils-2.24/gas -I. -I../../../source/binutils-2.24/gas -I../bfd -I../../../source/binutils-2.24/gas/config -I../../../source/binutils-2.24/gas/../include -I../../../source/binutils-2.24/gas/.. -I../../../source/binutils-2.24/gas/../bfd -DLOCALEDIR="\"/home/shakin/work/build_for_windows/mingw-w64-i686/share/locale\"" -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Werror -g -O2 -MT cond.o -MD -MP -MF .deps/cond.Tpo -c -o cond.o ../../../source/binutils-2.24/gas/cond.c
gcc -DHAVE_CONFIG_H -I. -I../../../source/binutils-2.24/gas -I. -I../../../source/binutils-2.24/gas -I../bfd -I../../../source/binutils-2.24/gas/config -I../../../source/binutils-2.24/gas/../include -I../../../source/binutils-2.24/gas/.. -I../../../source/binutils-2.24/gas/../bfd -DLOCALEDIR="\"/home/shakin/work/build_for_windows/mingw-w64-i686/share/locale\"" -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Werror -g -O2 -MT depend.o -MD -MP -MF .deps/depend.Tpo -c -o depend.o ../../../source/binutils-2.24/gas/depend.c
gcc -DHAVE_CONFIG_H -I. -I../../../source/binutils-2.24/gas -I. -I../../../source/binutils-2.24/gas -I../bfd -I../../../source/binutils-2.24/gas/config -I../../../source/binutils-2.24/gas/../include -I../../../source/binutils-2.24/gas/.. -I../../../source/binutils-2.24/gas/../bfd -DLOCALEDIR="\"/home/shakin/work/build_for_windows/mingw-w64-i686/share/locale\"" -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Werror -g -O2 -MT dwarf2dbg.o -MD -MP -MF .deps/dwarf2dbg.Tpo -c -o dwarf2dbg.o ../../../source/binutils-2.24/gas/dwarf2dbg.c
gcc -DHAVE_CONFIG_H -I. -I../../../source/binutils-2.24/gas -I. -I../../../source/binutils-2.24/gas -I../bfd -I../../../source/binutils-2.24/gas/config -I../../../source/binutils-2.24/gas/../include -I../../../source/binutils-2.24/gas/.. -I../../../source/binutils-2.24/gas/../bfd -DLOCALEDIR="\"/home/shakin/work/build_for_windows/mingw-w64-i686/share/locale\"" -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Werror -g -O2 -MT dw2gencfi.o -MD -MP -MF .deps/dw2gencfi.Tpo -c -o dw2gencfi.o ../../../source/binutils-2.24/gas/dw2gencfi.c
mv -f .deps/compress-debug.Tpo .deps/compress-debug.Po
gcc -DHAVE_CONFIG_H -I. -I../../../source/binutils-2.24/gas -I. -I../../../source/binutils-2.24/gas -I../bfd -I../../../source/binutils-2.24/gas/config -I../../../source/binutils-2.24/gas/../include -I../../../source/binutils-2.24/gas/.. -I../../../source/binutils-2.24/gas/../bfd -DLOCALEDIR="\"/home/shakin/work/build_for_windows/mingw-w64-i686/share/locale\"" -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Werror -g -O2 -MT ecoff.o -MD -MP -MF .deps/ecoff.Tpo -c -o ecoff.o ../../../source/binutils-2.24/gas/ecoff.c
../../../source/binutils-2.24/gas/as.c: In function ‘print_version_id’:
../../../source/binutils-2.24/gas/as.c:224:14: error: ‘TARGET_ALIAS’ undeclared (first use in this function)
VERSION, TARGET_ALIAS, BFD_VERSION_STRING);
^
../../../source/binutils-2.24/gas/as.c:224:14: note: each undeclared identifier is reported only once for each function it appears in
../../../source/binutils-2.24/gas/as.c: In function ‘parse_args’:
../../../source/binutils-2.24/gas/as.c:635:5: error: ‘TARGET_ALIAS’ undeclared (first use in this function)
TARGET_ALIAS);
^
../../../source/binutils-2.24/gas/as.c:649:44: error: ‘TARGET_CANONICAL’ undeclared (first use in this function)
fprintf (stderr, _("canonical = %s\n"), TARGET_CANONICAL);
^
../../../source/binutils-2.24/gas/as.c:650:43: error: ‘TARGET_CPU’ undeclared (first use in this function)
fprintf (stderr, _("cpu-type = %s\n"), TARGET_CPU);
^
make[4]: *** [as.o] 错误 1


-------------------------------

 问题2: 编译gcc 4.9.1 出错

------------------------------
错误信息

perl ../../source/gcc-4.9.1/gcc/../contrib/texi2pod.pl ../../source/gcc-4.9.1/gcc/doc/include/gpl_v3.texi > gpl.pod
echo "@set BUGURL @uref{http://gcc.gnu.org/bugs.html}" >> gcc-vers.texiT; \
mv -f gcc-vers.texiT gcc-vers.texi
echo timestamp > s-mlib
g++ -c -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -DHAVE_CONFIG_H -DGENERATOR_FILE -I. -Ibuild -I../../source/gcc-4.9.1/gcc -I../../source/gcc-4.9.1/gcc/build -I../../source/gcc-4.9.1/gcc/../include -I../../source/gcc-4.9.1/gcc/../libcpp/include \
-o build/genhooks.o ../../source/gcc-4.9.1/gcc/genhooks.c
g++ -c -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -DHAVE_CONFIG_H -DGENERATOR_FILE -I. -Ibuild -I../../source/gcc-4.9.1/gcc -I../../source/gcc-4.9.1/gcc/build -I../../source/gcc-4.9.1/gcc/../include -I../../source/gcc-4.9.1/gcc/../libcpp/include \
-o build/genchecksum.o ../../source/gcc-4.9.1/gcc/genchecksum.c
g++ -c -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -DHAVE_CONFIG_H -DGENERATOR_FILE -I. -Ibuild -I../../source/gcc-4.9.1/gcc -I../../source/gcc-4.9.1/gcc/build -I../../source/gcc-4.9.1/gcc/../include -I../../source/gcc-4.9.1/gcc/../libcpp/include \
-o build/genenums.o ../../source/gcc-4.9.1/gcc/genenums.c
In file included from ../../source/gcc-4.9.1/gcc/gcc-ar.c:22:0:
../../source/gcc-4.9.1/gcc/system.h:506:34: error: declaration of C function ‘const char* strsignal(int)’ conflicts with
extern const char *strsignal (int);
^
In file included from /usr/include/c++/4.8/cstring:42:0,
from ../../source/gcc-4.9.1/gcc/system.h:205,
from ../../source/gcc-4.9.1/gcc/gcc-ar.c:22:
/usr/include/string.h:564:14: error: previous declaration ‘char* strsignal(int)’ here
extern char *strsignal (int __sig) __THROW;
^
g++ -c -DSTANDARD_STARTFILE_PREFIX=\"../../../\" -DSTANDARD_EXEC_PREFIX=\"/home/shakin/work/build_ffmpeg_for_windows/mingw-w64-i686/lib/gcc/\" -DSTANDARD_LIBEXEC_PREFIX=\"/home/shakin/work/build_ffmpeg_for_windows/mingw-w64-i686/libexec/gcc/\" -DDEFAULT_TARGET_VERSION=\"4.9.1\" -DDEFAULT_TARGET_MACHINE=\"i686-w64-mingw32\" -DSTANDARD_BINDIR_PREFIX=\"/home/shakin/work/build_ffmpeg_for_windows/mingw-w64-i686/bin/\" -DTOOLDIR_BASE_PREFIX=\"../../../../\" -DTARGET_SYSTEM_ROOT=\"/home/shakin/work/build_ffmpeg_for_windows/mingw-w64-i686\" -DTARGET_SYSTEM_ROOT_RELOCATABLE -DCONFIGURE_SPECS="\"\"" -DTARGET_MACHINE=\"i686-w64-mingw32\" -DTARGET_SYSTEM_ROOT=\"/home/shakin/work/build_ffmpeg_for_windows/mingw-w64-i686\" -DTARGET_SYSTEM_ROOT_RELOCATABLE -DPERSONALITY=\"nm\" -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -DHAVE_CONFIG_H -I. -I. -I../../source/gcc-4.9.1/gcc -I../../source/gcc-4.9.1/gcc/. -I../../source/gcc-4.9.1/gcc/../include -I../../source/gcc-4.9.1/gcc/../libcpp/include -I/home/shakin/work/build_ffmpeg_for_windows/pkgs/gmp/gmp-6.0.0a-x86_64/include -I/home/shakin/work/build_ffmpeg_for_windows/pkgs/mpfr/mpfr-3.1.2-x86_64/include -I/home/shakin/work/build_ffmpeg_for_windows/pkgs/mpc/mpc-1.0.2-x86_64/include -I../../source/gcc-4.9.1/gcc/../libdecnumber -I../../source/gcc-4.9.1/gcc/../libdecnumber/bid -I../libdecnumber -I../../source/gcc-4.9.1/gcc/../libbacktrace -DCLOOG_INT_GMP -I/home/shakin/work/build_ffmpeg_for_windows/pkgs/cloog/cloog-0.18.1-x86_64/include -I/home/shakin/work/build_ffmpeg_for_windows/pkgs/isl/isl-0.12.2-x86_64/include -o gcc-nm.o -MT gcc-nm.o -MMD -MP -MF ./.deps/gcc-nm.TPo gcc-nm.c
g++ -c -DSTANDARD_STARTFILE_PREFIX=\"../../../\" -DSTANDARD_EXEC_PREFIX=\"/home/shakin/work/build_ffmpeg_for_windows/mingw-w64-i686/lib/gcc/\" -DSTANDARD_LIBEXEC_PREFIX=\"/home/shakin/work/build_ffmpeg_for_windows/mingw-w64-i686/libexec/gcc/\" -DDEFAULT_TARGET_VERSION=\"4.9.1\" -DDEFAULT_TARGET_MACHINE=\"i686-w64-mingw32\" -DSTANDARD_BINDIR_PREFIX=\"/home/shakin/work/build_ffmpeg_for_windows/mingw-w64-i686/bin/\" -DTOOLDIR_BASE_PREFIX=\"../../../../\" -DTARGET_SYSTEM_ROOT=\"/home/shakin/work/build_ffmpeg_for_windows/mingw-w64-i686\" -DTARGET_SYSTEM_ROOT_RELOCATABLE -DCONFIGURE_SPECS="\"\"" -DTARGET_MACHINE=\"i686-w64-mingw32\" -DTARGET_SYSTEM_ROOT=\"/home/shakin/work/build_ffmpeg_for_windows/mingw-w64-i686\" -DTARGET_SYSTEM_ROOT_RELOCATABLE -DPERSONALITY=\"ranlib\" -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -DHAVE_CONFIG_H -I. -I. -I../../source/gcc-4.9.1/gcc -I../../source/gcc-4.9.1/gcc/. -I../../source/gcc-4.9.1/gcc/../include -I../../source/gcc-4.9.1/gcc/../libcpp/include -I/home/shakin/work/build_ffmpeg_for_windows/pkgs/gmp/gmp-6.0.0a-x86_64/include -I/home/shakin/work/build_ffmpeg_for_windows/pkgs/mpfr/mpfr-3.1.2-x86_64/include -I/home/shakin/work/build_ffmpeg_for_windows/pkgs/mpc/mpc-1.0.2-x86_64/include -I../../source/gcc-4.9.1/gcc/../libdecnumber -I../../source/gcc-4.9.1/gcc/../libdecnumber/bid -I../libdecnumber -I../../source/gcc-4.9.1/gcc/../libbacktrace -DCLOOG_INT_GMP -I/home/shakin/work/build_ffmpeg_for_windows/pkgs/cloog/cloog-0.18.1-x86_64/include -I/home/shakin/work/build_ffmpeg_for_windows/pkgs/isl/isl-0.12.2-x86_64/include -o gcc-ranlib.o -MT gcc-ranlib.o -MMD -MP -MF ./.deps/gcc-ranlib.TPo gcc-ranlib.c
In file included from ../../source/gcc-4.9.1/gcc/../include/hashtab.h:40:0,
from ../../source/gcc-4.9.1/gcc/../include/filenames.h:29,
from ../../source/gcc-4.9.1/gcc/system.h:630,
from ../../source/gcc-4.9.1/gcc/gcc-ar.c:22:
../../source/gcc-4.9.1/gcc/../include/ansidecl.h:171:64: error: new declaration ‘char* basename(const char*)’
# define ATTRIBUTE_NONNULL(m) __attribute__ ((__nonnull__ (m)))
^
../../source/gcc-4.9.1/gcc/../include/libiberty.h:110:64: note: in expansion of macro ‘ATTRIBUTE_NONNULL’
extern char *basename (const char *) ATTRIBUTE_RETURNS_NONNULL ATTRIBUTE_NONNULL(1);
^
In file included from /usr/include/c++/4.8/cstring:42:0,
from ../../source/gcc-4.9.1/gcc/system.h:205,
from ../../source/gcc-4.9.1/gcc/gcc-ar.c:22:
/usr/include/string.h:601:26: error: ambiguates old declaration ‘const char* basename(const char*)’
extern "C++" const char *basename (const char *__filename)
^
In file included from ../../source/gcc-4.9.1/gcc/system.h:1064:0,
from ../../source/gcc-4.9.1/gcc/gcc-ar.c:22:
../../source/gcc-4.9.1/gcc/hwint.h: In function ‘int clz_hwi(long unsigned int)’:
../../source/gcc-4.9.1/gcc/hwint.h:16:30: error: ‘CHAR_BIT’ was not declared in this scope
#define HOST_BITS_PER_LONG (CHAR_BIT * SIZEOF_LONG)
^
../../source/gcc-4.9.1/gcc/hwint.h:60:35: note: in expansion of macro ‘HOST_BITS_PER_LONG’
# define HOST_BITS_PER_WIDE_INT HOST_BITS_PER_LONG
^
../../source/gcc-4.9.1/gcc/hwint.h:244:12: note: in expansion of macro ‘HOST_BITS_PER_WIDE_INT’
return HOST_BITS_PER_WIDE_INT;
^
../../source/gcc-4.9.1/gcc/hwint.h: In function ‘int ctz_hwi(long unsigned int)’:
../../source/gcc-4.9.1/gcc/hwint.h:16:30: error: ‘CHAR_BIT’ was not declared in this scope
#define HOST_BITS_PER_LONG (CHAR_BIT * SIZEOF_LONG)
^
../../source/gcc-4.9.1/gcc/hwint.h:60:35: note: in expansion of macro ‘HOST_BITS_PER_LONG’
# define HOST_BITS_PER_WIDE_INT HOST_BITS_PER_LONG
^
../../source/gcc-4.9.1/gcc/hwint.h:258:12: note: in expansion of macro ‘HOST_BITS_PER_WIDE_INT’
return HOST_BITS_PER_WIDE_INT;
^
../../source/gcc-4.9.1/gcc/hwint.h: In function ‘int floor_log2(long unsigned int)’:
../../source/gcc-4.9.1/gcc/hwint.h:16:30: error: ‘CHAR_BIT’ was not declared in this scope
#define HOST_BITS_PER_LONG (CHAR_BIT * SIZEOF_LONG)
^
../../source/gcc-4.9.1/gcc/hwint.h:60:35: note: in expansion of macro ‘HOST_BITS_PER_LONG’
# define HOST_BITS_PER_WIDE_INT HOST_BITS_PER_LONG
^
../../source/gcc-4.9.1/gcc/hwint.h:295:10: note: in expansion of macro ‘HOST_BITS_PER_WIDE_INT’
return HOST_BITS_PER_WIDE_INT - 1 - clz_hwi (x);
^
../../source/gcc-4.9.1/gcc/hwint.h: In function ‘long int sext_hwi(long int, unsigned int)’:
../../source/gcc-4.9.1/gcc/hwint.h:16:30: error: ‘CHAR_BIT’ was not declared in this scope
#define HOST_BITS_PER_LONG (CHAR_BIT * SIZEOF_LONG)
^
../../source/gcc-4.9.1/gcc/hwint.h:60:35: note: in expansion of macro ‘HOST_BITS_PER_LONG’
# define HOST_BITS_PER_WIDE_INT HOST_BITS_PER_LONG
^
../../source/gcc-4.9.1/gcc/hwint.h:328:15: note: in expansion of macro ‘HOST_BITS_PER_WIDE_INT’
if (prec == HOST_BITS_PER_WIDE_INT)
^
../../source/gcc-4.9.1/gcc/hwint.h: In function ‘long unsigned int zext_hwi(long unsigned int, unsigned int)’:
../../source/gcc-4.9.1/gcc/hwint.h:16:30: error: ‘CHAR_BIT’ was not declared in this scope
#define HOST_BITS_PER_LONG (CHAR_BIT * SIZEOF_LONG)
^
../../source/gcc-4.9.1/gcc/hwint.h:60:35: note: in expansion of macro ‘HOST_BITS_PER_LONG’
# define HOST_BITS_PER_WIDE_INT HOST_BITS_PER_LONG
^
../../source/gcc-4.9.1/gcc/hwint.h:342:15: note: in expansion of macro ‘HOST_BITS_PER_WIDE_INT’
if (prec == HOST_BITS_PER_WIDE_INT)
^
../../source/gcc-4.9.1/gcc/gcc-ar.c: In function ‘int main(int, char**)’:
../../source/gcc-4.9.1/gcc/gcc-ar.c:139:39: error: ‘LTOPLUGINSONAME’ was not declared in this scope
plugin = find_a_file (&target_path, LTOPLUGINSONAME, R_OK);
^
In file included from ../../source/gcc-4.9.1/gcc/errors.c:29:0:
../../source/gcc-4.9.1/gcc/system.h:506:34: error: declaration of C function ‘const char* strsignal(int)’ conflicts with
extern const char *strsignal (int);
^
In file included from /usr/include/c++/4.8/cstring:42:0,
from ../../source/gcc-4.9.1/gcc/system.h:205,
from ../../source/gcc-4.9.1/gcc/errors.c:29:
/usr/include/string.h:564:14: error: previous declaration ‘char* strsignal(int)’ here
extern char *strsignal (int __sig) __THROW;
^
../../source/gcc-4.9.1/gcc/gcc-ar.c:189:35: error: call of overloaded ‘strsignal(int&)’ is ambiguous
exe_name, sig, strsignal (sig),
^
../../source/gcc-4.9.1/gcc/gcc-ar.c:189:35: note: candidates are:
In file included from /usr/include/c++/4.8/cstring:42:0,
from ../../source/gcc-4.9.1/gcc/system.h:205,
from ../../source/gcc-4.9.1/gcc/gcc-ar.c:22:
/usr/include/string.h:564:14: note: char* strsignal(int)
extern char *strsignal (int __sig) __THROW;
^
In file included from ../../source/gcc-4.9.1/gcc/gcc-ar.c:22:0:
../../source/gcc-4.9.1/gcc/system.h:506:20: note: const char* strsignal(int)
extern const char *strsignal (int);
^
make[1]: *** [gcc-ar.o] 错误 1
make[1]: *** 正在等待未完成的任务....
In file included from ../../source/gcc-4.9.1/gcc/../include/hashtab.h:40:0,
from ../../source/gcc-4.9.1/gcc/../include/filenames.h:29,
from ../../source/gcc-4.9.1/gcc/system.h:630,
from ../../source/gcc-4.9.1/gcc/errors.c:29:
../../source/gcc-4.9.1/gcc/../include/ansidecl.h:171:64: error: new declaration ‘char* basename(const char*)’
# define ATTRIBUTE_NONNULL(m) __attribute__ ((__nonnull__ (m)))
^
../../source/gcc-4.9.1/gcc/../include/libiberty.h:110:64: note: in expansion of macro ‘ATTRIBUTE_NONNULL’
extern char *basename (const char *) ATTRIBUTE_RETURNS_NONNULL ATTRIBUTE_NONNULL(1);
^
In file included from /usr/include/c++/4.8/cstring:42:0,
from ../../source/gcc-4.9.1/gcc/system.h:205,
from ../../source/gcc-4.9.1/gcc/errors.c:29:
/usr/include/string.h:601:26: error: ambiguates old declaration ‘const char* basename(const char*)’
extern "C++" const char *basename (const char *__filename)
^
In file included from ../../source/gcc-4.9.1/gcc/system.h:1064:0,
from ../../source/gcc-4.9.1/gcc/errors.c:29:
../../source/gcc-4.9.1/gcc/hwint.h: In function ‘int clz_hwi(long unsigned int)’:
../../source/gcc-4.9.1/gcc/hwint.h:16:30: error: ‘CHAR_BIT’ was not declared in this scope
#define HOST_BITS_PER_LONG (CHAR_BIT * SIZEOF_LONG)
^
../../source/gcc-4.9.1/gcc/hwint.h:60:35: note: in expansion of macro ‘HOST_BITS_PER_LONG’
# define HOST_BITS_PER_WIDE_INT HOST_BITS_PER_LONG
^
../../source/gcc-4.9.1/gcc/hwint.h:244:12: note: in expansion of macro ‘HOST_BITS_PER_WIDE_INT’
return HOST_BITS_PER_WIDE_INT;
^
../../source/gcc-4.9.1/gcc/hwint.h: In function ‘int ctz_hwi(long unsigned int)’:
../../source/gcc-4.9.1/gcc/hwint.h:16:30: error: ‘CHAR_BIT’ was not declared in this scope
#define HOST_BITS_PER_LONG (CHAR_BIT * SIZEOF_LONG)
^
../../source/gcc-4.9.1/gcc/hwint.h:60:35: note: in expansion of macro ‘HOST_BITS_PER_LONG’
# define HOST_BITS_PER_WIDE_INT HOST_BITS_PER_LONG
^
../../source/gcc-4.9.1/gcc/hwint.h:258:12: note: in expansion of macro ‘HOST_BITS_PER_WIDE_INT’
return HOST_BITS_PER_WIDE_INT;
^
../../source/gcc-4.9.1/gcc/hwint.h: In function ‘int floor_log2(long unsigned int)’:
../../source/gcc-4.9.1/gcc/hwint.h:16:30: error: ‘CHAR_BIT’ was not declared in this scope
#define HOST_BITS_PER_LONG (CHAR_BIT * SIZEOF_LONG)
^
../../source/gcc-4.9.1/gcc/hwint.h:60:35: note: in expansion of macro ‘HOST_BITS_PER_LONG’
# define HOST_BITS_PER_WIDE_INT HOST_BITS_PER_LONG
^
../../source/gcc-4.9.1/gcc/hwint.h:295:10: note: in expansion of macro ‘HOST_BITS_PER_WIDE_INT’
return HOST_BITS_PER_WIDE_INT - 1 - clz_hwi (x);
^
../../source/gcc-4.9.1/gcc/hwint.h: In function ‘long int sext_hwi(long int, unsigned int)’:
../../source/gcc-4.9.1/gcc/hwint.h:16:30: error: ‘CHAR_BIT’ was not declared in this scope
#define HOST_BITS_PER_LONG (CHAR_BIT * SIZEOF_LONG)
^
../../source/gcc-4.9.1/gcc/hwint.h:60:35: note: in expansion of macro ‘HOST_BITS_PER_LONG’
# define HOST_BITS_PER_WIDE_INT HOST_BITS_PER_LONG
^
../../source/gcc-4.9.1/gcc/hwint.h:328:15: note: in expansion of macro ‘HOST_BITS_PER_WIDE_INT’
if (prec == HOST_BITS_PER_WIDE_INT)
^
../../source/gcc-4.9.1/gcc/hwint.h: In function ‘long unsigned int zext_hwi(long unsigned int, unsigned int)’:
../../source/gcc-4.9.1/gcc/hwint.h:16:30: error: ‘CHAR_BIT’ was not declared in this scope
#define HOST_BITS_PER_LONG (CHAR_BIT * SIZEOF_LONG)
^
../../source/gcc-4.9.1/gcc/hwint.h:60:35: note: in expansion of macro ‘HOST_BITS_PER_LONG’
# define HOST_BITS_PER_WIDE_INT HOST_BITS_PER_LONG
^
../../source/gcc-4.9.1/gcc/hwint.h:342:15: note: in expansion of macro ‘HOST_BITS_PER_WIDE_INT’
if (prec == HOST_BITS_PER_WIDE_INT)
^
make[1]: *** [errors.o] 错误 1
../../source/gcc-4.9.1/gcc/genhooks.c: In function ‘void emit_documentation(const char*)’:
../../source/gcc-4.9.1/gcc/genhooks.c:140:31: warning: ignoring return value of ‘int fscanf(FILE*, const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
fscanf (f, "%999s", buf);
^
../../source/gcc-4.9.1/gcc/genhooks.c:131:3: warning: ignoring return value of ‘int fscanf(FILE*, const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
while (fscanf (f, "%*[^@]"), buf[0] = '\0',
^
../../source/gcc-4.9.1/gcc/genhooks.c:193:34: warning: ignoring return value of ‘int fscanf(FILE*, const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
fscanf (f, "%5[^ \n]", buf);
^
../../source/gcc-4.9.1/gcc/genhooks.c:199:31: warning: ignoring return value of ‘int fscanf(FILE*, const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
fscanf (f, "%999s", buf);
^
/bin/bash ../../source/gcc-4.9.1/gcc/../move-if-change tmp-optionlist optionlist
echo timestamp > s-options
make[1]:正在离开目录 `/home/shakin/work/build_ffmpeg_for_windows/pkgs/gcc/build/gcc'
make: *** [all-gcc] 错误 2
-------------------------------

碰到上面两个问题,请尝试一下以下方法,个人亲试:

unset LIBRARY_PATH CPATH C_INCLUDE_PATH PKG_CONFIG_PATH CPLUS_INCLUDE_PATH INCLUDE
如果在/etc/profile 或者 ~/.bashrc中设置了ccache的话,也暂时去掉ccache的设置.

 

【编译32bit】 注意 一些路径要换成自己本机的路径

准备工作:

脚本获取:wget http://zeranoe.com/scripts/mingw_w64_build/mingw-w64-build-3.6.4 ,然后修改权限

ubuntu14.04情况下,执行:sudo apt-get install pax cvs flex bison texinfo

执行:bash ./mingw-w64-build-3.6.4 --build-type=multi --default-configure --disable-shared --enable-gendef


 (1)ln -s "/usr/bin/pkg-config" /home/shakin/work/build_ffmpeg_for_windows/mingw-w64-i686/bin/i686-w64-mingw32-pkg-config
 (2)编译 x264
./configure --enable-static --enable-win32thread --host=i686-w64-mingw32 --prefix=/home/shakin/work/build_ffmpeg_for_windows/dist/modules --cross-prefix=i686-w64-mingw32-
 (3)编译libfdk_aac
./configure --host=i686-w64-mingw32 --prefix=/home/shakin/work/build_ffmpeg_for_windows/dist/modules --enable-static --disable-shared

 其他的外插件略,需要安装的官网也有详细步骤.

 

 (4)编译ffmpeg
./configure --disable-static --enable-shared --enable-version3 --enable-gpl --enable-nonfree --disable-pthreads --enable-w32threads --enable-runtime-cpudetect --enable-memalign-hack --enable-libfdk-aac --enable-libx264 --enable-zlib --enable-cross-compile --target-os=mingw32 --arch=x86 --prefix=/home/shakin/work/build_ffmpeg_for_windows/dist/modules/ffmpeg --cross-prefix=i686-w64-mingw32- --extra-cflags="-I/home/shakin/work/build_ffmpeg_for_windows/dist/modules/include" --extra-ldflags="-L/home/shakin/work/build_ffmpeg_for_windows/dist/modules/lib"

 

编译的 exe和 dll文件,就在/home/shakin/work/build_ffmpeg_for_windows/dist/modules/ffmpeg 路径下,另外,编译成64位版时,libx264,libfdk_aac等也要相应的变成64bit,

 编译 x264
./configure --enable-static --enable-win32thread --host=x86_64-w64-mingw32 --prefix=/home/shakin/work/build_ffmpeg_for_windows/dist/modules --cross-prefix=x86_64-w64-mingw32-
 编译libfdk_aac
./configure --host=x86_64-w64-mingw32 --prefix=/home/shakin/work/build_ffmpeg_for_windows/dist/modules --enable-static --disable-shared

 编译ffmpeg

./configure --disable-static --enable-shared --enable-version3 --enable-gpl --enable-nonfree --disable-pthreads --enable-w32threads --enable-runtime-cpudetect --enable-memalign-hack --enable-libfdk-aac --enable-libx264 --enable-zlib --enable-cross-compile --target-os=mingw32 --arch=x86 --prefix=/home/shakin/work/build_ffmpeg_for_windows/dist/modules/ffmpeg --cross-prefix=x86_64-w64-mingw32- --extra-cflags="-I/home/shakin/work/build_ffmpeg_for_windows/dist/modules/include" --extra-ldflags="-L/home/shakin/work/build_ffmpeg_for_windows/dist/modules/lib"




http://www.cnblogs.com/shakin/p/4276434.html

你可能感兴趣的:(使用zeranoe的自动化脚本mingw-w64-build-3.6.4在ubutun14.04_64bit上交叉编译ffmpeg 2.5)