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

Strange compiler errors when CGO_ENABLED=0 #9

Closed
EtienneBruines opened this issue Nov 25, 2014 · 3 comments
Closed

Strange compiler errors when CGO_ENABLED=0 #9

EtienneBruines opened this issue Nov 25, 2014 · 3 comments

Comments

@EtienneBruines
Copy link

I'm trying to compile my Go project to one static binary file, without linking to external libraries.

I am doing so by using this command:

CGO_ENABLED=0 go get -a -u -ldflags '-s'

This however produces the following errors:

# github.com/chai2010/webp
../github.com/chai2010/webp/reader.go:17: undefined: maxWebpHeaderSize
../github.com/chai2010/webp/webp.go:13: undefined: webpGetInfo
../github.com/chai2010/webp/webp.go:17: undefined: webpDecodeGray
../github.com/chai2010/webp/webp.go:30: undefined: webpDecodeRGB
../github.com/chai2010/webp/webp.go:39: undefined: webpDecodeRGBA
../github.com/chai2010/webp/webp.go:52: undefined: webpEncodeGray
../github.com/chai2010/webp/webp.go:57: undefined: webpEncodeRGB
../github.com/chai2010/webp/webp.go:61: undefined: webpEncodeRGBA
../github.com/chai2010/webp/webp.go:65: undefined: webpEncodeLosslessGray
../github.com/chai2010/webp/webp.go:70: undefined: webpEncodeLosslessRGB
../github.com/chai2010/webp/webp.go:70: too many errors

Which is strange, because (for instance) maxWebpHeaderSize is declared in capi.go

Extra info:

OS: Debian Jessie
Kernel 3.2.0-4-amd64
go version go1.3.2 linux/amd64

Any thoughts?

Thanks in advance.

@chai2010
Copy link
Owner

@EtienneBruines
The current webp is based on cgo. If cgo is disabled, it will cause error.
I will merge a puro go version to fix this issue when cgo is disabled.

thanks for your feedback.

@chai2010
Copy link
Owner

@EtienneBruines

e5bfb99

Fix the build error if cgo is disabled.
But the go test will fail.

I will close this issue.

PS:
Just for webp, cgo use static link, output is one static binary file.

@EtienneBruines
Copy link
Author

@chai2010 Perfect! Thank you for the rapid response. Good to know that I shouldn't use CGO_ENABLED=0 and webp together.

chrislusf added a commit to seaweedfs/seaweedfs that referenced this issue May 28, 2017
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

2 participants