[Solved] Process to for a distributable build, help?

Hello, I’m struggling to get a working distributable build. I’ve setup the dev environment on a VM of Ubuntu 14.04 64bit, having a working test and dev install running at version 2.1.0. Make test passes, make run works great and I can actively modify running Go and React code and see the results in my local env. But now that I’ve made some changes and I want to deploy. So I run make dist and the build works. This is where the problem starts - when I deploy the binary platform file it says “cannot execute binary file: Exec format error”. I’m building on the same box I’m trying to run it on, it should match the architecture of the box - but it’s saying it doesn’t. I’m relatively new to GoLang, but shouldn’t a binary built on a machine run on the same machine? Probably a noob error but looking for some guidance.

Any help is appreciated. Thanks!

Ok, think I solved it. I gave up trying to build on my VM (still have no idea why it failed) and built on my Mac OS using Go’s cross-compile.

To build for a specific architecture you update the MakeFile server-build go commands and prepend the OS and Arch you want. For example, I’m building for Ubuntu 14.04 64-bit:

	GOOS=linux GOARCH=amd64 CGO_ENABLED=0 $(GO) generate $(GOFLAGS) ./...
	GOOS=linux GOARCH=amd64 CGO_ENABLED=0 $(GO) install $(GOFLAGS) ./...```

Hope this helps someone else.
1 Like