chai2010 / webp

WebP decoder and encoder for Go (Zero Dependencies).
http://godoc.org/github.com/chai2010/webp
BSD 3-Clause "New" or "Revised" License
522 stars 88 forks source link

Problem with macos build #21

Open mchusovlianov opened 5 years ago

mchusovlianov commented 5 years ago

I try to build application which use webp library and can't build it with enabled CGO: GOOS=darwin GOARCH=amd64 CGO_ENABLED=1 go build -ldflags "-X main.Version=2.1.29 -X main.Build=`git rev-parse HEAD` -X main.BuildTime=`date +%FT%T%z`" -o bin I have gcc installed. image

ns3777k commented 5 years ago

facing the same issue. just curious. are you using go modules?

solher commented 5 years ago

Having the same issue here. I'm trying to migrate my project to go modules :/

ns3777k commented 5 years ago

if you take a look inside the vendor folder, you won't find internal directory where webp.h should be located. since i commit my vendor directory, i just git clone this repo inside vendor directory. there probably should be a better way =\

solher commented 5 years ago

I just found the solution actually. The go modules tool is not able to resolve C dependencies so it doesn't see that some .c/.h files are actually in the internal package of the chai2010/webp lib. Just copy it by hand in the vendor folder and it should work :)

solher commented 5 years ago

Hahaha perfect #RaceCondition

coldnight commented 5 years ago

@ns3777k I'm facing same issue with govendor, with govendor you can install this package via

govendor fetch github.com/chai2010/webp/^

More details please refer to kardianos/govendor#137 and here.

coldnight commented 5 years ago

For now, Go module prunes non-package directories, see more discussions in golang/go#26366.

coldnight commented 5 years ago

Some useful tools:

kosta commented 5 years ago

Is there a way to fix this bug on inside chai2010/webp? I feed like go vendoring is much less useful if you need to utilize external tools to make it work...

coldnight commented 5 years ago

I don't think we can find a way to fix this bug inside this project, this is kind a issue(feature lacking) of go mod.

pci commented 4 years ago

For those coming across this issue who are using dep, a workaround is to add

[prune]
  go-tests = true
  unused-packages = true

  [[prune.project]]
    name = "github.com/chai2010/webp"
    go-tests = false
    unused-packages = false

to your Gopkg.toml to stop the pruning of the C code.

furiousassault commented 4 years ago

@chai2010, good day. The issue is still actual for go mod dependency management with vendoring. Should we expect any changes that would make module to be downloaded with internals via go mod?