ubuntu 安装iconv 库

本文提供了解决libiconv在编译过程中遇到的安全漏洞警告的步骤,通过应用补丁并进行相应的代码修改,最终成功解决了问题。
包的下载页面http://www.gnu.org/software/libiconv/
$ ./configure --prefix=/usr/local
$ make
$ make install


出现
error: ‘gets’ undeclared here (not in a function) 错误,

解决办法
1. 

  1. wget -c http://www.itkb.ro/userfiles/file/libiconv-glibc-2.16.patch.gz
  2. cd libiconv-1.14/srclib
  3. patch -p1 stdio.in.h


这个补丁的内容如下

  1. --- srclib/stdio.in.h.orig 2011-08-07 16:42:06.000000000 +0300
  2. +++ srclib/stdio.in.h 2013-01-10 15:53:03.000000000 +0200
  3. @@ -695,7 +695,9 @@
  4. /* It is very rare that the developer ever has full control of stdin,
  5. so any use of gets warrants an unconditional warning. Assume it is
  6. always declared, since it is required by C89. */
  7. -_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
  8. +#if defined(__GLIBC__) && !defined(__UCLIBC__) && !__GLIBC_PREREQ(2, 16)
  9. + _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
  10. +#endif
     #endif

第二种 改

libiconv-1.14/srclib/stdio.in.h

在stdio.in.h中找到 //_GL_WARN_ON_USE (gets, "gets is a securityhole - use fgets instead");

修改为:

#if defined(__GLIBC__) &&!defined(__UCLIBC__) &&!__GLIBC_PREREQ(2, 16) _GL_WARN_ON_USE (gets, "gets is a security hole -use fgets instead"); #endif






评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值