Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iconv 对‘libiconv’未定义的引用 #41

Closed
wupeaking opened this issue Dec 13, 2016 · 2 comments
Closed

iconv 对‘libiconv’未定义的引用 #41

wupeaking opened this issue Dec 13, 2016 · 2 comments

Comments

@wupeaking
Copy link

由于外网被强了,因此克隆后直接使用,但是出现了如下错误:
/tmp/go-build377085664/util/iconv/_obj/iconv.cgo2.o:在函数‘bridge_iconv’中:
util/iconv/iconv.go:16:对‘libiconv’未定义的引用
/tmp/go-build377085664/util/iconv/_obj/iconv.cgo2.o:在函数‘_cgo_f7d217435582_C2func_iconv_close’中:
util/iconv/iconv.go:88:对‘libiconv_close’未定义的引用
/tmp/go-build377085664/util/iconv/_obj/iconv.cgo2.o:在函数‘_cgo_f7d217435582_C2func_iconv_open’中:
util/iconv/iconv.go:110:对‘libiconv_open’未定义的引用
/tmp/go-build377085664/util/iconv/_obj/iconv.cgo2.o:在函数‘_cgo_f7d217435582_Cfunc_iconv_close’中:
util/iconv/iconv.go:163:对‘libiconv_close’未定义的引用
/tmp/go-build377085664/util/iconv/_obj/iconv.cgo2.o:在函数‘_cgo_f7d217435582_Cfunc_iconv_open’中:
util/iconv/iconv.go:181:对‘libiconv_open’未定义的引用
collect2: 错误:ld 返回 1

感觉像是动态库找不到的问题,我发现自己的libconv.so在/usr/local/lib目录下,然后我有专门在/etc/ld.so.conf.d/ 添加了一条记录,ldconfig 之后 重新编译还是失败。

应该怎么做呢?(;′⌒`)

@godsoul
Copy link

godsoul commented Jul 16, 2018

在iconv.go 里面,你看下,加上 // #cgo linux LDFLAGS: -liconv 这句话,估计漏写了。

@Barbery
Copy link
Contributor

Barbery commented Aug 13, 2018

在官方的docker(From golang:1.10-alpine)里面跑不起来,尝试了安装apk add --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing/ --allow-untrusted gnu-libiconv也不行
有朋友知道怎么解决吗?

报错信息如下:

# gopkg.in/iconv.v1
../gopkg.in/iconv.v1/iconv.go:10:20: fatal error: iconv.h: No such file or directory
 // #include <iconv.h>
                    ^
compilation terminated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants