編譯安裝libiconv
cd /usr/local/src
wgethttp://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz
tar xfz libiconv-1.14.tar.gz
cd libiconv-1.14
./configure --prefix=/usr/local/libiconv
make
make install
cd ..
make時遇到錯誤:
gcc -DHAVE_CONFIG_H -DEXEEXT=\"\" -I. -I.. -I../lib -I../intl -DDEPENDS_ON_LIBICONV=1 -DDEPENDS_ON_LIBINTL=1 -g -O2 -c allocator.c
gcc -DHAVE_CONFIG_H -DEXEEXT=\"\" -I. -I.. -I../lib -I../intl -DDEPENDS_ON_LIBICONV=1 -DDEPENDS_ON_LIBINTL=1 -g -O2 -c areadlink.c
gcc -DHAVE_CONFIG_H -DEXEEXT=\"\" -I. -I.. -I../lib -I../intl -DDEPENDS_ON_LIBICONV=1 -DDEPENDS_ON_LIBINTL=1 -g -O2 -c careadlinkat.c
gcc -DHAVE_CONFIG_H -DEXEEXT=\"\" -I. -I.. -I../lib -I../intl -DDEPENDS_ON_LIBICONV=1 -DDEPENDS_ON_LIBINTL=1 -g -O2 -c malloca.c
gcc -DHAVE_CONFIG_H -DEXEEXT=\"\" -I. -I.. -I../lib -I../intl -DDEPENDS_ON_LIBICONV=1 -DDEPENDS_ON_LIBINTL=1 -g -O2 -c progname.c
In file included from progname.c:26:0:
./stdio.h:1010:1:錯誤:‘gets’未聲明(不在函數內)
_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
^
ke[2]: *** [progname.o] 錯誤 1
▽ake[2]: 離開目錄“/usr/local/src/libiconv-1.14/srclib”
make[1]: *** [all] 錯誤 2
make[1]: 離開目錄“/usr/local/src/libiconv-1.14/srclib”
make: *** [all] 錯誤 2
解決辦法1:
編輯stdio.h文件,將 _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");字段部分內容改為如下:
#ifdefined(__GLIBC__) && !defined(__UCLIBC__) && !__GLIBC_PREREQ(2, 16)
_GL_WARN_ON_USE (gets,"gets is a security hole - use fgets instead");
#endif
#endif
解決辦法2:
cd srclib/
sed -ir -e '/gets is a security/d' ./stdio.in.h
cd ../
make
重新make即可!
http://xxxxxx/Linuxjc/1134280.html TechArticle