openwrt交叉编译libffi zlib libiconv gettext glib gstreamer

libffi
如果你是直接从git托管源构建libffi,那么configure还不存在; 首先运行./autogen.sh。这将要求您安装autoconf,automake和libtool。
您可能想要告诉configure在哪里安装libffi库和头文件。为此,请使用–prefixconfigure开关。Libffi默认安装在/ usr / local下。
如果要启用额外的运行时调试检查,请使用 --enable-debugconfigure开关。当您的程序在使用libffi时神秘地死亡时,这很有用。
另一个有用的配置开关是–enable-purify-safety。使用它将添加一些额外的代码,当您使用libffi使用Purify时,这些代码将禁止某些警告。使用Purify时仅使用此开关,因为它会降低库的速度。
如果您不想构建文档,请使用–disable-docs configure开关。
Ubuntu配置安装:
首先要解压到一个文件夹名没有空格的文件夹,否则autoconf会出错。
sudo ./configure --disable-docs
sudo make
sudo make install
交叉编译的配置:
sudo CC=/opt/OpenWrt-Toolchain-ramips-mt7628_gcc-4.8-linaro_uClibc-0.9.33.2.Linux-i686/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin/mipsel-openwrt-linux-gcc ./configure --prefix=/opt/OpenWrt-Toolchain-ramips-mt7628_gcc-4.8-linaro_uClibc-0.9.33.2.Linux-i686/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/ --host=mipsel-openwrt-linux --disable-docs
编译安装和安装:
sudo make
sudo make install
注意:交叉编译时CC如果没有加上gcc的路径,configure检测编译器的时候将找不到编译器,并出现错误不可生成可执行文件。

//

交叉编译zlib
sudo CC=/opt/OpenWrt-Toolchain-ramips-mt7628_gcc-4.8-linaro_uClibc-0.9.33.2.Linux-i686/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin/mipsel-openwrt-linux-gcc ./configure --prefix=/opt/OpenWrt-Toolchain-ramips-mt7628_gcc-4.8-linaro_uClibc-0.9.33.2.Linux-i686/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/

///

libiconv
$ ./configure --prefix=/usr/local
$ make
$ make install
交叉编译:
$ sudo ./configure --prefix=/opt/OpenWrt-Toolchain-ramips-mt7628_gcc-4.8-linaro_uClibc-0.9.33.2.Linux-i686/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/ CC=/opt/OpenWrt-Toolchain-ramips-mt7628_gcc-4.8-linaro_uClibc-0.9.33.2.Linux-i686/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin/mipsel-openwrt-linux-gcc --host=mipsel-openwrt-linux
$ sudo make
$ sudo make install

//

gettext
sudo ./configure --prefix=/opt/OpenWrt-Toolchain-ramips-mt7628_gcc-4.8-linaro_uClibc-0.9.33.2.Linux-i686/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/ CC=/opt/OpenWrt-Toolchain-ramips-mt7628_gcc-4.8-linaro_uClibc-0.9.33.2.Linux-i686/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin/mipsel-openwrt-linux-gcc --host=mipsel-openwrt-linux

出错:
/usr/include/spawn.h:178:12: note: previous declaration of ‘posix_spawn_file_actions_addclose’ was here
extern int posix_spawn_file_actions_addclose (posix_spawn_file_actions_t *
^
In file included from ./sys/select.h:110:0,
from /opt/OpenWrt-Toolchain-ramips-mt7628_gcc-4.8-linaro_uClibc-0.9.33.2.Linux-i686/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/include/sys/types.h:220,
from ./sys/types.h:39,
from ./fcntl.h:50,
from execute.c:25:
./spawn.h:1336:1: error: conflicting types for ‘posix_spawn_file_actions_adddup2’
GL_FUNCDECL_SYS (posix_spawn_file_actions_adddup2, int,
^
In file included from ./spawn.h:28:0,
from execute.c:47:
/usr/include/spawn.h:184:12: note: previous declaration of ‘posix_spawn_file_actions_adddup2’ was here
extern int posix_spawn_file_actions_adddup2 (posix_spawn_file_actions_t *
^
make[5]: *** [execute.lo] 错误 1
make[5]:正在离开目录 /mnt/hgfs/Ubuntushared/gettext-0.20.1/gettext-tools/gnulib-lib' make[4]: *** [all] 错误 2 make[4]:正在离开目录/mnt/hgfs/Ubuntushared/gettext-0.20.1/gettext-tools/gnulib-lib’
出现一系统类似spawn.h的’posix
错误。
解决:
可能是与/usr/include/spawn.h下的旧版本冲突,我的方法是先将/usr/include/spawn.h移到另一个文件夹后,把gettext-0.20.1/gettext-tools/gnulib-lib/spawn.h复制到/usr/include.
但接着又出现#include_next<spawn.h>找不到错误。于是我把gettext-0.20.1/gettext-tools/gnulib-lib/spawn.h里的:
/
The include_next requires a split double-inclusion guard. */
#if 1

include_next <spawn.h>

#endif
#if 1改为:#if 0 意为去掉这个备份include
然后想之前的那一步替换是不是没有必要。反正已编译完成,没再试。但是记得把刚才暂时替换的spawn.h再次替换回去。

//
glib
新添加有关配置文件Vim glib.cache:
glib_cv_long_long_format=ll
glib_cv_stack_grows=no
glib_cv_have_strlcpy=no
glib_cv_have_qsort_r=yes
glib_cv_va_val_copy=yes
glib_cv_uscore=no
glib_cv_rtldglobal_broken=no
ac_cv_func_posix_getpwuid_r=yes
ac_cv_func_posix_getgrgid_r=yes
下面列出了cache文件的全部变量。其中一些变量通常并不需要设置。

缓存文件变量
glib_cv_long_long_format=[ll/q/I64]. 为64位整形数而使用于printf()和scanf()函数的格式化部分。 “ll” 是C99的标准, 被’trio’库使用来编译GLib, 如果你的printf()函数不能胜任的话。 如果你正在编译使用trio的话是不需要设置的。

glib_cv_stack_grows=[yes/no]. 堆栈是否向上或向下增长。大多数地方都需要设置为"no", 有几个体系结构,如PA-RISC等需要设置为"yes"。

glib_cv_working_bcopy=[yes/no]. bcopy()函数是否可以处理重叠的复制。 如果你没有memmove(), 就需要设置。(可能性非常小)

glib_cv_sane_realloc=[yes/np]. 是否realloc()函数符合ANSI C标准并能够处理第一个参数为NULL的情况。 默认为"yes", 你可能并不需要设定它。

glib_cv_have_strlcpy=[yes/no]. 是否有匹配OpenBSD的strlcpy()函数。 默认值为"no",这是安全的,因为在这种情况下GLib使用内置的版本。

glib_cv_have_qsort_r=[yes/no]. Whether you have qsort_r() that matches BSD. Defaults to “no”, which is safe, since GLib uses a built-in version in that case.

glib_cv_va_val_copy=[yes/no]. va_list是否可以作为指针复制。 如果设置为"no",那么memcopy()将被使用。 如果你没有va_copy()或__va_copy()会有问题。(所以,GCC不存在问题。) 默认为"yes",这种情况比"no"要多一些。

glib_cv_rtldglobal_broken=[yes/no]. 是否在OSF/1 v5.0中发现存在有bug。默认为"no"。

glib_cv_uscore=[yes/no]. Whether an underscore needs to be prepended to symbols when looking them up via dlsym(). Only needs to be set if your system uses dlopen()/dlsym().

ac_cv_func_posix_getpwuid_r=[yes/no]. 是否你的getpwuid_r函数(在你的C库,而不是线程库)遵守POSIX规范。 接受’struct passwd **'作为最终的参数。

ac_cv_func_nonposix_getpwuid_r=[yes/no]. 是否你有一些getpwuid_r()函数的变量不能遵守POSIX规范,但是GLib有能力去使用它(或者发生段错误)。只有在ac_cv_func_posix_getpwuid_r没被设置的情况下才需要设置此变量。此变量可以安全地被设置为"no".

ac_cv_func_posix_getgrgid_r=[yes/no]. 是否你有一个getgrgid_r函数去遵守POSIX规范。

glib_cv_use_pid_surrogate=[yes/no]. 是否使用setpriority()函数在线程的PID上, 作为设置线程优先级的方式。 只有在使用POSIX线程的时候需要设置。

ac_cv_func_printf_unix98=[yes/no]. 是否你的printf()函数支持Unix98样式的%N$位置参数。 默认为"no"。

ac_cv_func_vsnprintf_c99=[yes/no]. 是否你有一个vsnprintf()函数符合C99的。 (C99语义的意思是返回字符数,被写到输入缓存有足够的空间)。 默认为"no"。

sudo ./configure --prefix=/opt/OpenWrt-Toolchain-ramips-mt7628_gcc-4.8-linaro_uClibc-0.9.33.2.Linux-i686/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/ CC=/opt/OpenWrt-Toolchain-ramips-mt7628_gcc-4.8-linaro_uClibc-0.9.33.2.Linux-i686/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin/mipsel-openwrt-linux-gcc --host=mipsel-openwrt-linux LIBFFI_LIBS=" -lffi " ZLIB_LIBS=" -lz " --cache-file=glib.cache --disable-selinux --disable-xattr --disable-libelf LIBS=" -ldl"

错误1:
checking for pthread_create/pthread_join in -lthread… no
configure: error: I can’t find the libraries for the thread implementation
posix. Please choose another thread implementation or
provide information on your thread implementation.
解决:
在config.log里有部分错误信息是这样的:
configure:26097: /opt/OpenWrt-Toolchain-ramips-mt7628_gcc-4.8-linaro_uClibc-0.9.33.2.Linux-i686/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin/mipsel-openwrt-linux-gcc -o conftest -g -O2 -pthread conftest.c -lintl -liconv >&5
mipsel-openwrt-linux-uclibc-gcc.bin: warning: environment variable ‘STAGING_DIR’ not defined
mipsel-openwrt-linux-uclibc-gcc.bin: warning: environment variable ‘STAGING_DIR’ not defined
mipsel-openwrt-linux-uclibc-gcc.bin: warning: environment variable ‘STAGING_DIR’ not defined
/opt/OpenWrt-Toolchain-ramips-mt7628_gcc-4.8-linaro_uClibc-0.9.33.2.Linux-i686/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin/…/lib/gcc/mipsel-openwrt-linux-uclibc/4.8.3/…/…/…/…/mipsel-openwrt-linux-uclibc/bin/ld: warning: libdl.so.0, needed by /opt/OpenWrt-Toolchain-ramips-mt7628_gcc-4.8-linaro_uClibc-0.9.33.2.Linux-i686/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin/…/lib/gcc/mipsel-openwrt-linux-uclibc/4.8.3/…/…/…/…/mipsel-openwrt-linux-uclibc/lib/libpthread.so.0, not found (try using -rpath or -rpath-link)
/opt/OpenWrt-Toolchain-ramips-mt7628_gcc-4.8-linaro_uClibc-0.9.33.2.Linux-i686/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin/…/lib/gcc/mipsel-openwrt-linux-uclibc/4.8.3/…/…/…/…/mipsel-openwrt-linux-uclibc/lib/libpthread.so.0: undefined reference to dlclose' /opt/OpenWrt-Toolchain-ramips-mt7628_gcc-4.8-linaro_uClibc-0.9.33.2.Linux-i686/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin/../lib/gcc/mipsel-openwrt-linux-uclibc/4.8.3/../../../../mipsel-openwrt-linux-uclibc/lib/libpthread.so.0: undefined reference todlopen’
/opt/OpenWrt-Toolchain-ramips-mt7628_gcc-4.8-linaro_uClibc-0.9.33.2.Linux-i686/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin/…/lib/gcc/mipsel-openwrt-linux-uclibc/4.8.3/…/…/…/…/mipsel-openwrt-linux-uclibc/lib/libpthread.so.0: undefined reference to `dlsym’
collect2: error: ld returned 1 exit status

这个是编译的时候没有-ldl。所以在configure加上 LIBS=" -ldl"
错误2:
configure: error:
*** GLib requires a 64 bit type. You might want to consider
*** using the GNU C compiler.

解决:修改gilb. cache里的glib_cv_long_long_format=q

错误3:
出现过mv -f conftest.er1 conftest.err权限不够,不能移动。
解决:
加上sudo也不能解决,于是改到主文件夹试试。结果配置完成。

错误4:
make的时候出现一系列错误,找到最开始的出错:
glib/glibconfig.h:51:1: error: missing terminating " character
解决:
glib/glibconfig.h里出现了一错误:
#define G_GINT64_MODIFIER "q
"
#define G_GINT64_FORMAT “q
i”
#define G_GUINT64_FORMAT “q
u”
很明显,这几句都被无意分行了,把它们恢复即可:
#define G_GINT64_MODIFIER “q”
#define G_GINT64_FORMAT “qi”
#define G_GUINT64_FORMAT “qu”

然后就sudo make成功了。然后就sudo make install

//
Gstreamer-1.4.5
sudo CC=/opt/OpenWrt-Toolchain-ramips-mt7628_gcc-4.8-linaro_uClibc-0.9.33.2.Linux-i686/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin/mipsel-openwrt-linux-gcc ./configure --build=i686-linux --host=mipsel-openwrt-linux --prefix=/opt/arm/gstreamer-1.4.5 --enable-playbin2 --disable-loadsave --disable-gtk-doc ac_cv_func_register_printf_function=no --disable-tests --disable-valgrind

gstreamer需要依次安装上面的 依赖软件。
错误1:
ubuntu系统需要安装Flex。
sudo apt-get install flex

  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值