glib交叉编译过程

来源:互联网 发布:苹果手机同步软件 编辑:程序博客网 时间:2024/05/16 09:56
glib-2.24.0交叉编译过程

硬件环境arm, gcc编译器版本3.4.6
编译主机环境: 2.6.32-21-generic #32-Ubuntu SMP  i686 GNU/Linux


1:执行autogen.sh
2:配置cache-file,具体配置项如下:
glib_cv_long_long_format=ll
glib_cv_stack_grows=no
glib_cv_working_bcopy=yes
glib_cv_sane_realloc=yes
glib_cv_have_strlcpy=no
glib_cv_va_val_copy=yes
glib_cv_rtldglobal_broken=yes
glib_cv_uscore=yes
ac_cv_func_posix_getpwuid_r=yes
ac_cv_func_nonposix_getpwuid_r=yes
ac_cv_func_posix_getgrgid_r=yes
glib_cv_use_pid_surrogate=yes
ac_cv_func_printf_unix98=no
ac_cv_func_vsnprintf_c99=no

保存为文件arm-linux.cache

3:编译过程中会出现以下错误情况:
1)“checking for msgfmt... no
configure: error:
*** You must have either have gettext support in your C library, or use the
*** GNU gettext library. (http://www.gnu.org/software/gettext/gettext.html
解决方法:安装gettest,apt-get install gettext
2) “checking for growing stack pointer... configure: error: in `/root/glib-2.24.0':
configure: error: cannot run test program while cross compiling
解决方法:glib_cv_stack_grows=no
3)“checking for glib-genmarshal... no
configure: error: Could not find a glib-genmarshal in your PATH
解决方法:apt-get install libglib2.0-dev


4: 在glib目录下,执行“./configure --host=arm-etone-linux-gnueabi CC={交叉gcc编译器所在路径}/bin/arm-linux-gcc --cache-file=arm-linux.cache --prefix=/root/glib/install " 命令,配置编译的环境。

4: 修改glib目录下的libtool脚本,由于默认的一些命令可能与本机的有所出入,所以需要参考/usr/bin/libtool的脚本,把NM和global_symbol_pipe的定义修改为“/usr/bin/libtool”脚本中的定义。

5:执行”make“命令,编译完毕。


这个过程磨了很久才出来的,唉,对脚本还不是很熟练!



PS: 编译glib-2.29.16时,需要增加
ac_cv_path_GLIB_COMPILE_SCHEMAS=yesac_cv_func_qsort_r=yes
两个配置项,并且安装libffi库。