当前位置: 首页 > 系统与网络 > 正文

[分享]解决OPENWRT编译过程中在编译libsoup部分出现undefined reference to `libiconv’错误

最近在编译openwrt中出现了这种情况,错误如下:

/home/v/openwrt/trunk/staging_dir/toolchain-i386_i486_gcc-4.6-linaro_uClibc-0.9.33.2/lib/gcc/i486-openwrt-linux-uclibc/4.6.4/../../../../i486-openwrt-linux-uclibc/bin/ld: warning: libiconv.so.2, needed by /home/v/openwrt/trunk/staging_dir/target-i386_i486_uClibc-0.9.33.2/usr/lib/libgio-2.0.so, not found (try using -rpath or -rpath-link)
/home/v/openwrt/trunk/staging_dir/target-i386_i486_uClibc-0.9.33.2/usr/lib/libglib-2.0.so: undefined reference to `libiconv’
/home/v/openwrt/trunk/staging_dir/target-i386_i486_uClibc-0.9.33.2/usr/lib/libglib-2.0.so: undefined reference to `libiconv_open’
/home/v/openwrt/trunk/staging_dir/target-i386_i486_uClibc-0.9.33.2/usr/lib/libglib-2.0.so: undefined reference to `libiconv_close’
collect2: ld returned 1 exit status
make[6]: *** [get] Error 1
make[6]: Leaving directory `/home/v/openwrt/trunk/build_dir/target-i386_i486_uClibc-0.9.33.2/libsoup-2.45.3/examples’
Making all in docs
make[6]: Entering directory `/home/v/openwrt/trunk/build_dir/target-i386_i486_uClibc-0.9.33.2/libsoup-2.45.3/docs’
Making all in reference
make[7]: Entering directory `/home/v/openwrt/trunk/build_dir/target-i386_i486_uClibc-0.9.33.2/libsoup-2.45.3/docs/reference’
make[7]: Nothing to be done for `all’.
make[7]: Leaving directory `/home/v/openwrt/trunk/build_dir/target-i386_i486_uClibc-0.9.33.2/libsoup-2.45.3/docs/reference’
make[7]: Entering directory `/home/v/openwrt/trunk/build_dir/target-i386_i486_uClibc-0.9.33.2/libsoup-2.45.3/docs’
make[7]: Nothing to be done for `all-am’.
make[7]: Leaving directory `/home/v/openwrt/trunk/build_dir/target-i386_i486_uClibc-0.9.33.2/libsoup-2.45.3/docs’
make[6]: Leaving directory `/home/v/openwrt/trunk/build_dir/target-i386_i486_uClibc-0.9.33.2/libsoup-2.45.3/docs’
make[6]: Entering directory `/home/v/openwrt/trunk/build_dir/target-i386_i486_uClibc-0.9.33.2/libsoup-2.45.3′
make[6]: Leaving directory `/home/v/openwrt/trunk/build_dir/target-i386_i486_uClibc-0.9.33.2/libsoup-2.45.3′
make[5]: *** [all-recursive] Error 1
make[5]: Leaving directory `/home/v/openwrt/trunk/build_dir/target-i386_i486_uClibc-0.9.33.2/libsoup-2.45.3′
make[4]: *** [all] Error 2
make[4]: Leaving directory `/home/v/openwrt/trunk/build_dir/target-i386_i486_uClibc-0.9.33.2/libsoup-2.45.3′
make[3]: *** [/home/v/openwrt/trunk/build_dir/target-i386_i486_uClibc-0.9.33.2/libsoup-2.45.3/.built] Error 2
make[3]: Leaving directory `/home/v/openwrt/trunk/feeds/packages/libs/libsoup’
make[2]: *** [package/feeds/packages/libsoup/compile] Error 2
make[2]: Leaving directory `/home/v/openwrt/trunk’
make[1]: *** [/home/v/openwrt/trunk/staging_dir/target-i386_i486_uClibc-0.9.33.2/stamp/.package_compile] Error 2
make[1]: Leaving directory `/home/v/openwrt/trunk’
make: *** [world] 错误 2

首先的感觉是没有安装libiconv链接库,我使用的ubuntu系统,但是检查后libiconv-hook-dev软件包已经安装上了,/usr/lib下面也有正确的链接,ldconfig检查也没发现什么问题(如果是指定在/usr/local/lib下,可以先安装后使用ln -sf /usr/lib/libiconv.so.2.5.1 /usr/local/lib/libiconv.so.2
ln -sf /usr/lib/libiconv_hook.so.1.0.0 /usr/local/lib/libiconv_hook.so.1来将libiconv.so.2.5.1和libiconv_hook.so.1.0.0链接到/usr/local/lib中。)

网上搜索一番无果后,通过openwrt官方搜索,在此链接下提到(链接:https://dev.openwrt.org/ticket/10956)Adding -liconv to TARGET_LDFLAGS seems to fix the problem. 。之前是用过–with-liconv来指定libiconv路径的,无效。于是编辑/feeds/packages/libs/libsoup下的Makefile文件,在-Wl-rpath-link=$(STAGING_DIR)/usr/lib 部分插入-liconv。修改后如下: TARGET_LDFLAGS+=\ -Wl,-liconv,-rpath-link=$(STAGING_DIR)/usr/lib

libiconv
问题解决。

 

另 编译libsoup需要libsqlite3支持。

本文固定链接: http://blog.ich8.com/post/4252 | 霸王硬上弓's Blog

avatar
该日志由 霸王硬上弓 于2013年12月28日发表在 系统与网络 分类下, 你可以发表评论,并在保留原文地址及作者的情况下引用到你的网站或博客。
原创文章转载请注明: [分享]解决OPENWRT编译过程中在编译libsoup部分出现undefined reference to `libiconv’错误 | 霸王硬上弓's Blog

[分享]解决OPENWRT编译过程中在编译libsoup部分出现undefined reference to `libiconv’错误:等您坐沙发呢!

发表评论

您必须 [ 登录 ] 才能发表留言!