djimenez / iconv-go

iconv support for Go
BSD 2-Clause "Simplified" License
418 stars 66 forks source link

fatal error: iconv.h: No such file or directory #42

Closed sa7mon closed 4 years ago

sa7mon commented 4 years ago

It appears I'm having the same problem as #16 which I was disappointed to see just got closed without any replies.

I get this error when attempting to go get on a Windows system:

 go get github.com/djimenez/iconv-go
# github.com/djimenez/iconv-go
C:\Users\<redacted>\go\pkg\mod\github.com\djimenez\iconv-go@v0.0.0-20160305225143-8960e66bd3da\converter.go:8:10: fat
al error: iconv.h: No such file or directory
    8 | #include <iconv.h>
      |          ^~~~~~~~~
compilation terminated.

I see you've noted in the readme that we need to have cgo installed, but I'm looking around it seems like this functionality is built into go itself? Sorry if there is a super obvious fix, but I haven't been able to find one.

Thanks!

djimenez commented 4 years ago

iconv.h will be provided either by the development packages of your system or by the iconv compliant library you use - i.e. gnu libiconv. This is why #16 was just closed.

I would suggest using https://godoc.org/golang.org/x/text/encoding if you don't have a very specific reason for wanting to use iconv. It is pure go and maintained.

I answered this before / similarly in #38