iconv-go升级过程中的编译问题
工作项目原因,需要对golang进行升级。升级之后老的iconv-go运行有问题。因为新的golang运行更加严格,所以需要升级iconv-go.
从djimenez/iconv-go 拉下来代码进行编译发现“找不到iconv库的一些接口”,目测是库没链进来。错误信息如下:
go install ./...
# github.com/djimenez/iconv-go
/tmp/go-build579267556/github.com/djimenez/iconv-go/_obj/converter.cgo2.o: In function `_cgo_5f3e10abf205_Cfunc_iconv_open':
src/github.com/djimenez/iconv-go/converter.go:: undefined reference to `libiconv_open'
/tmp/go-build579267556/github.com/djimenez/iconv-go/_obj/converter.cgo2.o: In function `_cgo_5f3e10abf205_Cfunc_iconv_close':
src/github.com/djimenez/iconv-go/converter.go:: undefined reference to `libiconv_close'
/tmp/go-build579267556/github.com/djimenez/iconv-go/_obj/converter.cgo2.o: In function `_cgo_5f3e10abf205_C2func_iconv_open':
src/github.com/djimenez/iconv-go/converter.go:: undefined reference to `libiconv_open'
/tmp/go-build579267556/github.com/djimenez/iconv-go/_obj/converter.cgo2.o: In function `_cgo_5f3e10abf205_C2func_iconv_close':
src/github.com/djimenez/iconv-go/converter.go:: undefined reference to `libiconv_close'
/tmp/go-build579267556/github.com/djimenez/iconv-go/_obj/converter.cgo2.o: In function `call_iconv':
src/github.com/djimenez/iconv-go/converter.go:: undefined reference to `libiconv'
collect2: ld returned exit status
很奇怪,本地明明有安装iconv,怎么就找不到iconv库?
iconv --version
iconv (GNU libiconv 1.14)
Copyright (C) - Free Software Foundation, Inc.
License GPLv3+: GNU GPL version or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Bruno Haible.
进到iconv-go的converter.go发现
package iconv /*
#cgo darwin LDFLAGS: -liconv
#cgo freebsd LDFLAGS: -liconv
#cgo windows LDFLAGS: -liconv
#include <stdlib.h>
#include <iconv.h> // As of GO 1.6 passing a pointer to Go pointer, will lead to panic
// Therofore we use this wrapper function, to avoid passing **char directly from go
size_t call_iconv(iconv_t ctx, char *in, size_t *size_in, char *out, size_t *size_out){
return iconv(ctx, &in, size_in, &out, size_out);
} */
我了个去,darwin,freebsd,windows都有。但是我在centos下使用的。难不成是这个原因,导致iconv库没有链进去?于是尝试进行了修改。
package iconv /*
#cgo darwin LDFLAGS: -liconv
#cgo freebsd LDFLAGS: -liconv
#cgo windows LDFLAGS: -liconv
#cgo LDFLAGS: -liconv
#include <stdlib.h>
#include <iconv.h> // As of GO 1.6 passing a pointer to Go pointer, will lead to panic
// Therofore we use this wrapper function, to avoid passing **char directly from go
size_t call_iconv(iconv_t ctx, char *in, size_t *size_in, char *out, size_t *size_out){
return iconv(ctx, &in, size_in, &out, size_out);
} */
再进行编译。奇迹般的通过了,通过了,通过了。。。
好吧,目前只是这样猥琐的解决的。这样写不知道会不会对跨平台造成影响。先这样解决吧。记录一下。
如果哪位同仁看到这篇文章,觉得不是这样解决的,请不吝赐教。
iconv-go升级过程中的编译问题的更多相关文章
- WDCP从php5.2升级到5.3的办法,以及升级过程中iconv错误的处理
从wdcp官方论坛我们可以找到一个询问升级的帖子,然后管理员在回复中也提供了升级方法: cd /tmp wget -c http://dl.wdlinux.cn:5180/soft/php-5.3.1 ...
- 在Linux下安装PHP过程中,编译时出现错误的解决办法
在Linux下安装PHP过程中,编译时出现configure: error: libjpeg.(a|so) not found 错误的解决办法 configure: error: libjpeg.(a ...
- VMware虚拟机升级过程中遇到的一点问题
在将VWware由9.0升级到10.0的过程中,出现如下图的错误: failed to create the requested registry key Key:Installer e ...
- 通过 yum update 将系统从CentOS 6.2 升级到 CentOS 6.6 及升级过程中的简单排错
本文说明 本文写于2014年的WP中,后WP停止维护,今天翻到此记录整理下,记录于此,方便日后查看. 话说那时候写博客真是认真啊~哈哈~ 升级前的系统信息 [root@thatsit ~]# unam ...
- Confluence 6 在升级过程中查看合并日志
为了监控升级的过程,你应该查看 application log 日志中的输出. 通常日志经常将会显示多个日志实例,这个实例是定义在日志的 INFO 级别的,通常格式如下: WikiToXhtmlMig ...
- android recovery升级过程中掉电处理
一般在升级过程,都会提示用户,请勿断电,不管是android的STB,TV还是PHONE,或者是其他的终端设备,升级过程,基本上都可以看到“正在升级,请勿断电”,然后有个进度条,显示升级的进度. 但是 ...
- node安装升级过程中遇到的问题汇总
一.Node already installed, it's just not linked 第一步:sudo chown -R $(whoami) $(brew --prefix)/* 第二步:br ...
- iOS 9 升级过程汇中白苹果 iPhone或iPad 解决方案
最近想必有很多朋友升级了iOS 9,不过有部分朋友在升级过程中遇到了白苹果问题.也就是卡在升级过程中,不限重启.这时,你只能通过dfu进行升级了. ios9怎么进入dfu模式: 1.将你的iPhone ...
- Linux下安装过程中编译PHP时报错:configure: error: libjpeg.(a|so) not found
在Linux下安装PHP过程中,编译时出现configure: error: libjpeg.(a|so) not found 错误的解决的方法: 检查之后发现已经安装libjpeg.可是/usr/l ...
随机推荐
- Python流程控制-逻辑运算-if...else语句
摘录自:http://www.runoob.com/python/python-if-statement.html Python条件语句是通过一条或多条语句的执行结果(True或者False)来决定执 ...
- BZOJ4977: [[Lydsy1708月赛]跳伞求生(不错的贪心)
4977: [[Lydsy1708月赛]跳伞求生 Time Limit: 5 Sec Memory Limit: 256 MBSubmit: 446 Solved: 142[Submit][Sta ...
- 《DSP using MATLAB》Problem 3.1
先写DTFT子函数: function [X] = dtft(x, n, w) %% --------------------------------------------------------- ...
- free命令学习 输出理解
命令 [root@localhost ~]# free -m total used free shared buffers cached Mem: 7869 7651 218 1 191 5081 - ...
- c#:Json字符串转成xml对象
没看到.net framework中有这样的功能, 懒得到处找了, 索性花点时间自己写一个 /* * Created by SharpDevelop. * Date: 2013/6/24 * User ...
- Windows 10 上的 Git 如何清除密码? Git Credential Manager for Windows
Windows 10 上的 Git 如何清除密码? 因为一台新的电脑是 Windows 10 在第一次使用 Git 要求输入密码时把密码给输错了. 之前提交都是说 Token 错了,不再出现提示密码. ...
- FastAdmin 升级后出现 is already in use
FastAdmin 升级后出现 is already in use 升级 FastAdmin 改进很多,但全新安装出现以下错误 Cannot use app\common\library\Menu a ...
- 【转】在Visual Studio中怎样快速添加代码段
原文网址:http://blog.csdn.net/yl2isoft/article/details/9735527 以前一直只知道,键入prop,再按两次tab键,会生成自动属性代码. 今天闲着无事 ...
- windows dos权限管理
显示或者修改文件的访问控制列表(ACL) CACLS filename [/T] [/M] [/L] [/S[:SDDL]] [/E] [/C] [/G user:perm] ...
- .net 提取注释生成API文档 帮助文档
提取注释生成API文档 一.前言 在多人协作的项目中,除了良好的代码规范外,完整的API文档也相当重要.通过文档我们快速了解系统各模块的实际接口,及其使用场景.使用示例,一定程度上降低沟通成本,和 ...