1. 程式人生 > >openwrt lede解決編譯:error GNU libiconv not in use but included iconv.h is from libiconv

openwrt lede解決編譯:error GNU libiconv not in use but included iconv.h is from libiconv

1.lede 17.1.5

2. 工程中沒有glib2 需要手動新增一個,所以我從其他版本中直接拷貝過來一份glib2的配置(glib2 版本2.44.1)

3.當編譯的時候出現了,error GNU libiconv not in use but included iconv.h is from libiconv

從原始碼找出現error的位置如下:

  53 
  54 #if defined(USE_LIBICONV_GNU) && !defined (_LIBICONV_H)
  55 #error GNU libiconv in use but included iconv.h not from libiconv
  56 #endif
  57 #if !defined(USE_LIBICONV_GNU) && defined (_LIBICONV_H) \
  58      && !defined (__APPLE_CC__) && !defined (__LP_64__)
  59 #error GNU libiconv not in use but included iconv.h is from libiconv
  60 #endif

需要避免兩種情況:

第一種: 需要滿足 USE_LIBICONV_GNU ,即編譯選項--with-libiconv=gnu  (no/gnu/native),且使用libiconv庫

第二種: 需要滿足即非USE_LIBICONV_GNU,即編譯選項--with-libiconv=no, 且不使用libiconv庫

下面來看我的glib2 Makefile:

  1 #
  2 # Copyright (C) 2007-2015 OpenWrt.org
  3 #
  4 # This is free software, licensed under the GNU General Public License v2.
  5 # See /LICENSE for more information.
  6 #
  7 
  8 include $(TOPDIR)/rules.mk
  9 
 10 PKG_NAME:=glib2
 11 PKG_VERSION:=2.44.1
 12 PKG_RELEASE:=1
 13 
 14 PKG_SOURCE:=glib-$(PKG_VERSION).tar.xz
 15 PKG_BUILD_DIR:=$(BUILD_DIR)/glib-$(PKG_VERSION)
 16 PKG_SOURCE_URL:
[email protected]
/glib/2.44 17 PKG_MD5SUM:=83efba4722a9674b97437d1d99af79db 18 19 PKG_BUILD_DEPENDS:=glib2/host libpthread zlib libintl libffi 20 HOST_BUILD_DEPENDS:=libintl/host libiconv/host libffi/host 21 PKG_INSTALL:=1 22 PKG_USE_MIPS16:=0 23 24 PKG_FIXUP:=autoreconf 25 26 HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/glib-$(PKG_VERSION) 27 28 include $(INCLUDE_DIR)/host-build.mk 29 include $(INCLUDE_DIR)/package.mk 30 include $(INCLUDE_DIR)/nls.mk 31 32 define Package/glib2 33 SECTION:=libs 34 CATEGORY:=Libraries 35 DEPENDS:=$(ICONV_DEPENDS) $(INTL_DEPENDS) +zlib +libpthread +libffi +libattr 36 TITLE:=glib 2.0 37 MAINTAINER:=Peter Wagner <
[email protected]
> 38 URL:=http://www.gtk.org/ 39 endef 40 41 define Package/glib2/description 42 The GLib library of C routines 43 endef 44 45 HOST_CONFIGURE_ARGS += \ 46 --disable-selinux 47 48 CONFIGURE_ARGS += \ 49 --enable-shared \ 50 --enable-static \ 51 --enable-debug=no \ 52 --disable-selinux \ 53 --disable-fam \ 54 $(if $(ICONV_FULL),--with-libiconv=gnu) 55 56 CONFIGURE_VARS += \ 57 glib_cv_stack_grows=no \ 58 glib_cv_uscore=no \ 59 ac_cv_path_GLIB_GENMARSHAL=$(STAGING_DIR_HOST)/bin/glib-genmarshal \ 60 ac_cv_func_mmap_fixed_mapped=yes \ 61 ac_cv_func_posix_getpwuid_r=yes \ 62 ac_cv_func_posix_getgrgid_r=yes 63 64 define Build/InstallDev 65 $(INSTALL_DIR) $(1)/usr/include 66 $(CP) \ 67 $(PKG_INSTALL_DIR)/usr/include/glib-2.0 \ 68 $(1)/usr/include/ 69 $(CP) \ 70 $(PKG_INSTALL_DIR)/usr/lib/glib-2.0/include/*.h \ 71 $(1)/usr/include/glib-2.0/ 72 $(CP) \ 73 $(PKG_INSTALL_DIR)/usr/include/gio-unix-2.0 \ 74 $(1)/usr/include/ 75 76 $(INSTALL_DIR) $(1)/usr/lib 77 $(CP) \ 78 $(PKG_INSTALL_DIR)/usr/lib/glib-2.0 \ 79 $(1)/usr/lib/ 80 81 $(CP) \ 82 $(PKG_INSTALL_DIR)/usr/lib/*.{so*,a,la} \ 83 $(1)/usr/lib/ 84 85 $(INSTALL_DIR) $(1)/usr/lib/pkgconfig 86 $(INSTALL_DATA) \ 87 $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/*.pc \ 88 $(1)/usr/lib/pkgconfig 89 90 $(INSTALL_DIR) $(2)/share/aclocal/ 91 $(INSTALL_DATA) \ 92 $(PKG_INSTALL_DIR)/usr/share/aclocal/*.m4 \ 93 $(2)/share/aclocal/ 94 endef 95 96 define Package/glib2/install 97 $(INSTALL_DIR) $(1)/usr/lib 98 $(CP) \ 99 $(PKG_INSTALL_DIR)/usr/lib/*.so* \ 100 $(1)/usr/lib/ 101 endef 102 103 $(eval $(call HostBuild)) 104 $(eval $(call BuildPackage,glib2))

重點看:  
 48 CONFIGURE_ARGS += \
 49     --enable-shared \
 50     --enable-static \
 51     --enable-debug=no \
 52     --disable-selinux \
 53     --disable-fam \
 54     $(if $(ICONV_FULL),--with-libiconv=gnu)
 ICONV_FULL 代表一個libiconv-full的庫,如果這個庫選上,使用--with-libiconv=gnu選項

而ICONV_FULL怎麼選:則看openwrt 目錄中include/nls.mk

  8 # iconv full
  9 ifeq ($(CONFIG_BUILD_NLS),y)
 10     ICONV_PREFIX:=$(STAGING_DIR)/usr/lib/libiconv-full
 11     ICONV_FULL:=1
 12 
 13     INTL_PREFIX:=$(STAGING_DIR)/usr/lib/libintl-full
 14     INTL_FULL:=1

 15 
 16 # iconv stub
 17 else
 18     ICONV_PREFIX:=$(STAGING_DIR)/usr/lib/libiconv-stub
 19     ICONV_FULL:=
 20 
 21     INTL_PREFIX:=$(STAGING_DIR)/usr/lib/libintl-stub
 22     INTL_FULL:=
 23 endif

從這個配置中可以看出,只需要選擇編譯選項CONFIG_BUILD_NLS即可.

make menuconfig

       --->Global build settings

                 ----->[*] Compile with full language support

另外還需要加上libiconv的庫

 ---->Libraries

              ---------><*> libintl-full............................ GNU Internationalization library

儲存配置,這樣就大功告成了

這樣的配置編譯target是沒有問題,我的工程在編譯hostbuild的有問題,於是乎我在hostbuild中加了兩項的配置:

 45 HOST_CONFIGURE_ARGS += \
 46     --disable-selinux \

 47     --prefix=$(STAGING_DIR_HOST) \            //將生成的二進位制,安裝到host目錄(我的工程預設安裝,安裝位置有問題)
 48     --exec-prefix=$(STAGING_DIR_HOST) \

 47     $(if $(ICONV_FULL),--with-libiconv=gnu) \   (host也有這個問題,所以也加上了)
 48     ac_cv_path_GLIB_GENMARSHAL=$(STAGING_DIR_HOST)/bin/glib-genmarshal   (這個如果不加,可能會找不到glib-genmarshal)

這要的改變,可以在工程完美編譯通過.最終可以在:staging_dir/target****/usr/lib看到生成的glib2的庫.

libiconv庫 為需要做轉換的應用提供了一個iconv()的函式,以實現一個字元編碼到另一個字元編碼的轉換。

相關推薦

openwrt lede解決編譯error GNU libiconv not in use but included iconv.h is from libiconv

1.lede 17.1.5 2. 工程中沒有glib2 需要手動新增一個,所以我從其他版本中直接拷貝過來一份glib2的配置(glib2 版本2.44.1) 3.當編譯的時候出現了,error GNU libiconv not in use but included ic

OpenWRT 編譯 error GNU libiconv not in use but included iconv.h is from libiconv

如題,編譯時碰到上述錯誤,google後一大堆,唯獨沒有OpenWRT的解決辦法,找到這篇文章: 按照文章的方法,在glib目錄下,手動執行: ./configure --enable-iconv=no --with-libiconv=gnu 貌似 --enable-ic

NDK編譯error: iostream: No such file or directory錯誤解決辦法

        最近發現真的好記性不如爛筆頭啊,曾經碰到過這個問題,今天又一次碰到,又各種百度谷歌才搞定,決定還是隨手記下來吧,幫助自己,希望也能幫助他人哈,廢話不多說了在jni標頭檔案中有這麼一句#include <iostream>,在編譯的時候發生了標題的

解決辦法error: inner element must either be a resource reference or empty.

  今天在linux上編譯程式碼,結果出錯了: error: <item> inner element must either be a resource reference or empty. 看看程式碼: <array name="network">

ROS編譯error: stray ‘\357’ in program

今天在用catkin_make編譯ros工作空間時,出現報警: error: stray ‘\357’ in program error: stray ‘\274’ in program error: stray ‘\233’ in program 原因是,在編碼過程中,由於中文新增備註

解決OpenSSLerror while loading shared libraries: libcrypto.so.1.1: cannot open shared object file: No

解決OpenSSL:error while loading shared libraries: libcrypto.so.1.1: cannot open shared object file: No

解決辦法error: failed to push some refs to 'https://github.com/xxxx.git'

在github遠端建立倉庫後, 利用gitbash進行提交本地檔案的時候出現如下錯誤: [[email protected] demo]# git push -u origin master Username for 'https://github.c

Python3 pip 解決問題 error: Unable to find vcvarsall.bat

當我給 python3.5 安裝 第三方庫 charset 時:pip install charset,出現了錯誤: D:\WorkSpace\python_ws\python-large-web-crawler\firstdemo>pip

Webpack錯誤解決(一)ERROR in Entry module not found

在webpack.config.js做了少許更改後,執行webpack命令,突然出現以下錯誤: ERROR in Entry module not found: Error: Cannot resolve 'file' or 'directory' ./

遠程登陸mysql報錯ERROR 1130 (HY000): Host '10.0.0.8' is not allowed to connect to this MySQL server

image code 再次 light 解決辦法 allow this 解決 ror 問題原因:在數據庫遷移到mysql主機後遠程登陸mysql報錯: ERROR 1130 (HY000): Host ‘10.0.0.8‘ is not allowed to connec

VS2017使用inet_addr報錯error C4996: 'inet_addr': Use inet_pton() or InetPton() instead or define _WINSO

轉自:VS2015報錯C4996處理,error C4996: 'inet_addr': Use inet_pton() or InetPton() instead or define _WINSOCK_D 問題: 在vs2017中,使用如下程式碼: addr.sin_addr.S_

git 報錯ERROR: missing Change-Id in commit message footer

[email protected]:~/work/SourceFile/iwds_kernel/slpt$ git push origin Counting objects: 108, done. Delta compression using up to 8

Angular 懶載入報錯Error:Cannot find 'default' in 'xx/xx/xx.module'

前言     Angular日常採坑 在Angular中嘗試進行懶載入時,遇到以下錯誤: Error:Cannot find ‘defaut’in ‘xx/xx/xx’ 導致原因    在AppRo

殺手SQL一條關於 ‘Not in’ SQL 的優化案例

編輯手記:在 DBA 所優化的資料庫環境中,絕大多數效能問題其實是由於 SQL 編寫不當導致的。SQL 的世界無奇不有,今天我們一起見識一條讓你絕對想吐血的殺手SQL。 某保險客戶,ETL 耗時數個小時,我們做了sql report發現壓力主要在其中一個SQL上。 單次執行時間:5788(秒) 單

sql語句優化用join取代not in

寫了好幾個頁面,速度都上不去,瓶頸在於SQL查詢。太多的表,太多的not in,總是從一大推表和資料中篩選出一點資料。看了很多關於SQL優化的文章,都強烈要求不要太多使用not in查詢,最好用表連線來取代它。如:select ID,name from Table_A wh

解決】java.net.BindException: Address already in use: JVM_Bind

錯誤 嚴重: StandardServer.await: create[8005]: java.net.BindException: Address already in use: JVM_Bind at java.net.DualSta

80端口占用異常解決方法java.net.BindException: Address already in use: JVM_Bind:80(或8080)

pid 異常解決 exc == protocol nbsp catalina int tcp 1:Tomcat(或其他Web容器)啟動時控制臺報錯如下示: 2007-8-2 15:20:43 org.apache.coyote.http11.Http11Protocol

解決編譯libiconv時報錯./stdio.h:1010:1: error: 'gets' undeclared here (not in a function)

轉載自:http://forum.z27315.com/topic/15662-%E8%A7%A3%E5%86%B3%E7%BC%96%E8%AF%91libiconv%E6%97%B6%E7%9A%8439gets39-undeclared-here%E9%94%99%E

編譯安裝libiconv報錯./stdio.h:1010:1: error: 'gets' undeclared here (not in a function)

編譯安裝libiconv報錯:./stdio.h:1010:1: error: 'gets' undeclared here (not in a function)錯誤如下: In file included from progname.c:26:0: ./stdio.h:101

[已解決]Xcode編譯項目最後失敗Error: Jar file buglySymboliOS.jar was not found. Please copy the jar file into ~/bin folder

iphone prepare pre found inter step lib detail key Xcode去用Archive打包企業版app,在編譯的最後出錯: <div–<————————————————————– Copyright 2014-2015