You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When generating contents prior to building for freebsd, generation fails with a segfault:
I'm executing the generate step as a dependency of the build step, therefore the env variables are also set for the generate step. The behaviour is the same when I run GOOS=freebsd GOARCH=amd64 go generate code.vikunja.io/api/pkg/static directly.
$ GOOS=freebsd GOARCH=amd64 make build
go generate code.vikunja.io/api/pkg/static
signal: segmentation fault (core dumped)
pkg/static/static.go:17: running "go": exit status 1
make: *** [Makefile:105: generate] Error 1
If I generate the assets for my own platform (linux) and run the build with all env set for freebsd, it seems to work, but only if I don't run the generate step.
I'm not sure if this is an issue with vfsgen or some other part of the go toolchain. It is imho not critical since the workaround with running the generate step first and only then setting the env variables for freebsd when compiling the binary is an okay-ish workaround. I only happend to stuble upon this because of the way my makefile is set up.
The text was updated successfully, but these errors were encountered:
That go generate directive is invoking go run. When you run GOOS=freebsd GOARCH=amd64 go generate, the GOOS/GOARCH environment variables are passed on to go run, which builds a binary for FreeBSD and then attempts to execute it. Doing so on Linux causes a segmentation fault.
You shouldn't try to do GOOS=freebsd go generate when on Linux. Do go generate instead.
An alternative fix you could consider is to modify that line to do something like:
//go:generate sh -c "GOOS=$GOHOSTOS GOARCH=$GOHOSTOS go run -tags=dev templates_generate.go"
But I wouldn't recommend it because it adds more complexity than just running go generate with GOOS/GOARCH values that can be used by go run on your system, and it adds a dependency on sh.
When generating contents prior to building for freebsd, generation fails with a segfault:
I'm executing the
generate
step as a dependency of thebuild
step, therefore the env variables are also set for the generate step. The behaviour is the same when I runGOOS=freebsd GOARCH=amd64 go generate code.vikunja.io/api/pkg/static
directly.The code is here.
If I generate the assets for my own platform (linux) and run the build with all env set for
freebsd
, it seems to work, but only if I don't run thegenerate
step.I'm not sure if this is an issue with vfsgen or some other part of the go toolchain. It is imho not critical since the workaround with running the
generate
step first and only then setting the env variables for freebsd when compiling the binary is an okay-ish workaround. I only happend to stuble upon this because of the way my makefile is set up.The text was updated successfully, but these errors were encountered: