Liteide cross-compiling under Windows platform Golang

Source: Internet
Author: User
This is a creation in Article, where the information may have evolved or changed.

1, using cross-compilation in a Windows environment, you need to compile the tool gcc, you must use MinGW:

http://sourceforge.net/projects/mingw/files/Installer/mingw-get-inst/mingw-get-inst-20120426/ Mingw-get-inst-20120426.exe/download

Run MinGW installation Mannger after installation is complete

Select Install mingw32-ggc-g++

Set environment variables after installation, add C:\MinGW\bin (installation directory) to the previous position in the system environment variable path

Note: If an error such as this occurs COUNLD not being located in the dynamic link Libintl-8.dll, is this DLL conflict, will all other directories Libintl-8.dll all renamed, to prevent conflicts, remember to change back after compiling or affect the normal operation of other programs, as follows:

2, in the Golang (current version Go 1.3.3) installation directory under the C:\GO\SRC directory under the new Cc.bat file (first name), the contents are as follows:

Set cgo_enabled=0:::::::::::::::::::::x86:::::::::::::::::::::::::::::::::::::::set goarch=386set  goos=windowscall make.bat --no-clean set goos=linuxcall make.bat -- No-clean ::set goos=freebsd::call make.bat --no-clean ::set goos=darwin::call  make.bat --no-clean:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: ::::::::: ::::::::::::x64:::::::::::::::::::::::::::::::::::::::set goarch=amd64set goos=linuxcall  make.bat --no-clean::set goos=freebsd::call make.bat --no-clean ::set goos= Darwin::call make.bat --no-clean::::.::::::::::::::-----:-::::--:::::::-::::::::::::::::.::::::::-:::::.:::  :::::::::::::::::::::::arm::::::::::::::::::::::::::::::::::::::::set goarch=arm::set goos= Linux::call make.bat --no-clean::::.::::::::::::::-----:-::::--:::::::-::::::::::::::::.::::::::-:::::.:::  ::::::::::::::::::::::install gocodE::::::::::::::::::::::::::::set goarch=386set goos=windowsgo get github.com/nsf/gocodepause 

After that, double-click to run the batch file, a lengthy compilation process, no error, then congratulations on your success:)

(see if the bin directory and the PKG directory have execution files and package generation for the relevant platform)

3, open liteide x24 Select Compile Linux executable (above batch file not all platforms are compiled, executable added)

Then compile the program, found in the source file directory, the Linux executable has been successfully generated!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.