Golang How to use Liteide to cross-compile Linux execution programs under the Windows platform

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

1, the use of cross-compilation in the Windows environment, the need to compile the tool GCC, the recommended use of 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 (install directory) to System environment variable path

2, in the Golang installation directory under the C:\GO\SRC directory to create a new Cc.bat file, the contents are as follows:

01 setCGO_ENABLED=0
02 ::x86
03 setGOARCH=386
04 setGOOS=windows
05 call make.bat --no-clean
06  
07 setGOOS=linux
08 call make.bat --no-clean
09  
10 setGOOS=freebsd
11 call make.bat --no-clean
12  
13 setGOOS=darwin
14 call make.bat --no-clean
15 ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
16  
17 ::x64
18 setGOARCH=amd64
19 setGOOS=linux
20 call make.bat --no-clean
21 ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
22  
23 ::arm
24 setGOARCH=arm
25 setGOOS=linux
26 call make.bat --no-clean
27 ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
28  
29 setGOARCH=386
30 setGOOS=windows
31 go get github.com/nsf/gocode
32 pause

When you're done, double-click Run batch File

3, open liteide x21 Select Cross-compilation environment

Then compile the program and find the Linux executable in the source file directory to successfully build the


http://my.oschina.net/xlplbo/blog/209641

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.