Answer the question
In order to leave comments, you need to log in
Is it possible to compile a go program to run on a machine without go installed?
I compile a program on a poppy, send it to a linux machine, when I run it I get an error:
-bash: ./deb-alias: cannot execute binary file: Executable file format error
Answer the question
In order to leave comments, you need to log in
1. Different operating systems have their own rules.
2. When you compile, without specifying where you will use it, it compiles for you under the operating system on which you run the compiler.
3. In a situation like yours, you need to explicitly indicate on which operating system you are going to run the program.
4. This is called cross-compilation. Search the Internet for this word.
5. You are very lucky to be dealing with Go, otherwise you would have to deal with special dev deployments and/or toolchains.
6. You need to set 2 environment variables - GOOS=linux and GOARCH=amd64, that is, specify the format of the file being created. And then run the compiler.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question