Home >Backend Development >Golang >How to Resolve the Go Cross-Compilation Bootstrapping Error on Windows?
Cross-Compiling from Windows to Linux: Resolving the Bootstrapping Error
When attempting to cross-compile Go programs from Windows to Linux, you may encounter an error indicating that Linux/AMD64 must be bootstrapped. This error arises because the necessary tools for cross-compiling have not yet been built.
To resolve this issue, you must first ensure that your Windows GOARCH is set to amd64. Subsequently, execute the following batch programs:
set GOARCH=amd64 set GOOS=linux go tool dist install -v pkg/runtime go install -v -a std
By running these commands, you will build the required tools for cross-compiling. Once this process is complete, you should be able to successfully cross-compile Go programs from Windows to Linux. Note that the GOARCH parameter should be set to lowercase "amd64" for this process to succeed.
If your Windows GOARCH is 386, building the 386 tools is necessary. This requires downloading Mingw GCC and following the instructions provided by user2714852.
For further assistance, you may refer to the documentation at https://golang.org/wiki/WindowsCrossCompiling, which contains detailed instructions for cross-compiling from Windows to Linux.
The above is the detailed content of How to Resolve the Go Cross-Compilation Bootstrapping Error on Windows?. For more information, please follow other related articles on the PHP Chinese website!