Open prologic opened 3 years ago
I think I fixed the macOS builds by removing the following form my .goreleaser.yml
config:
- env:
- - CGO_ENABLED=0
But now I have a problem cross-compliing/building the Linux binaries; I assume its having trouble cross-compiliing them?
⨯ release failed after 5.35s error=failed to build for linux_amd64: # github.com/chai2010/webp
../../../go/pkg/mod/github.com/chai2010/webp@v1.1.0/webp.go:17:9: undefined: webpGetInfo
../../../go/pkg/mod/github.com/chai2010/webp@v1.1.0/webp.go:21:20: undefined: webpDecodeGray
../../../go/pkg/mod/github.com/chai2010/webp@v1.1.0/webp.go:34:20: undefined: webpDecodeRGB
../../../go/pkg/mod/github.com/chai2010/webp@v1.1.0/webp.go:47:20: undefined: webpDecodeRGBA
../../../go/pkg/mod/github.com/chai2010/webp@v1.1.0/webp.go:63:14: undefined: webpDecodeGrayToSize
../../../go/pkg/mod/github.com/chai2010/webp@v1.1.0/webp.go:77:14: undefined: webpDecodeRGBToSize
../../../go/pkg/mod/github.com/chai2010/webp@v1.1.0/webp.go:91:14: undefined: webpDecodeRGBAToSize
../../../go/pkg/mod/github.com/chai2010/webp@v1.1.0/webp.go:104:7: undefined: toGrayImage
../../../go/pkg/mod/github.com/chai2010/webp@v1.1.0/webp.go:105:14: undefined: webpEncodeGray
../../../go/pkg/mod/github.com/chai2010/webp@v1.1.0/webp.go:114:14: undefined: webpEncodeRGB
../../../go/pkg/mod/github.com/chai2010/webp@v1.1.0/webp.go:114:14: too many errors
Actually disregard my previous comment, the CGO_ENABLE=0
actually works and that's the way I build this in our Docker image Dockerfile and that's how we run this in production at twtxt.net; so the static build works just fine.
What doesn't work (as stated above) is the GoReleaser builds... 🤷♂️ If I can't solve this soon I'm going to have to come up with another way to do binary releases.
The simplest way is build your code in Linux.
The simplest way is build your code in Linux.
How does this help solve the corss-compliation issue?
Hello. Thanks for your project once more.
Encountered the similar problem trying to build my project that uses your library on MacOS Catalina for Linux. So now I can't build it locally for several linux-based Docker images I use. Seems like this problem is discussed in repeating issues. Is there any progress on this?
+1
Hello. Thanks for your project once more.
Encountered the similar problem trying to build my project that uses your library on MacOS Catalina for Linux. So now I can't build it locally for several linux-based Docker images I use. Seems like this problem is discussed in repeating issues. Is there any progress on this?
I only found such a solution...
FROM golang:stretch
WORKDIR /app
COPY . .
RUN go build -o /app/app
CMD ["/app/app"]
for MacOS my Plan
Install CEO compilation tools
brew install FiloSottile/musl-cross/musl-cross
Build
CGO_ENABLED=1 GOOS=linux GOARCH=amd64 CC=x86_64-linux-musl-gcc CXX=x86_64-linux-musl-g++ CGO_LDFLAGS="-static" go build -a -ldflags "-s -w" -o ./dist/server .
I have this error
#16 8.120 # github.com/chai2010/webp
#16 8.120 /go/pkg/mod/github.com/chai2010/webp@v1.1.0/webp.go:17:9: undefined: webpGetInfo
#16 8.120 /go/pkg/mod/github.com/chai2010/webp@v1.1.0/webp.go:21:20: undefined: webpDecodeGray
#16 8.120 /go/pkg/mod/github.com/chai2010/webp@v1.1.0/webp.go:34:20: undefined: webpDecodeRGB
#16 8.120 /go/pkg/mod/github.com/chai2010/webp@v1.1.0/webp.go:47:20: undefined: webpDecodeRGBA
#16 8.120 /go/pkg/mod/github.com/chai2010/webp@v1.1.0/webp.go:63:14: undefined: webpDecodeGrayToSize
#16 8.120 /go/pkg/mod/github.com/chai2010/webp@v1.1.0/webp.go:77:14: undefined: webpDecodeRGBToSize
#16 8.120 /go/pkg/mod/github.com/chai2010/webp@v1.1.0/webp.go:91:14: undefined: webpDecodeRGBAToSize
#16 8.120 /go/pkg/mod/github.com/chai2010/webp@v1.1.0/webp.go:104:7: undefined: toGrayImage
#16 8.120 /go/pkg/mod/github.com/chai2010/webp@v1.1.0/webp.go:105:14: undefined: webpEncodeGray
#16 8.120 /go/pkg/mod/github.com/chai2010/webp@v1.1.0/webp.go:114:14: undefined: webpEncodeRGB
#16 8.120 /go/pkg/mod/github.com/chai2010/webp@v1.1.0/webp.go:114:14: too many errors
#16 ERROR: executor failed running [/bin/sh -c CGO_ENABLED=0 GO111MODULE=on GOARCH=amd64 go build -ldflags "-s -w"
for Windows my Plan
Install MinGW compilation tools
brew install mingw-w64
Build
CGO_ENABLED=1 GOOS=windows GOARCH=amd64 CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ CGO_LDFLAGS="-static" go build -a -ldflags "-s -w" -o ./dist/server.exe .
Hello! 👋 I am currently unable to release twtxt v0.2.0 because of the following build/link errors when running through my release process with
goreleaser
:The funny thing about this is that I actually develop on macOS and the binary otherwise builds just fine:
Can someone please help? I'm not really sure what's going on 😢 and this is #blocking my release.