Click here to Skip to main content
15,878,230 members
Articles / DevOps
Tip/Trick

GCC Cross Compiler Setup in Windows

Rate me:
Please Sign up or sign in to vote.
4.56/5 (5 votes)
17 Jan 2017CPOL 27.6K   19   9
How to setup GCC cross compiler in Windows to generate Linux binaries

Introduction

This article describes setting up Linux compatible GCC compilers in Windows. Basically, GCC is used to compile C/C++ code for Linux systems.

Background

In scenario like, code base is present in windows and the binaries have to be generated for particular Linux flavor from Windows, cross compilers come in handy.

Setup

  1. Download the latest Cygwin installer from the following path:

    http://cygwin.com/setup-x86_64.exe

  2. Start the Cygwin installer with the following command:
    /path/to/setup-x86_64.exe -K http://cygwinports.org/ports.gpg 
  3. On Choose Installation Type page, select "Install from Internet".
  4. Use Internet Explorer Proxy Settings.
  5. On Choose Download Site(s) page, select a distro mirror, then enter <a>ftp://ftp.cygwinports.org/pub/cygwinports</a> in the User URL field and press Add.

    Or choose http://mirrors.kernel.org/sources.redhat.com/cygwinports/

  6. Along with the default packages, select the following packages:

    Image 1

    Select the appropriate GCC package that corresponds to your flavor of Linux.

  7. Proceed to install.
  8. Now the GCC cross compiler shall be available under:

    <InstallDrive>:\cygwin64\bin

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
India India
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
QuestionUnable to get setup from <https://sourceware.org/cygwinports> Pin
Member 1377475111-Apr-18 10:32
Member 1377475111-Apr-18 10:32 
AnswerRe: Unable to get setup from <https://sourceware.org/cygwinports> Pin
Arun Maiya3-May-18 19:40
professionalArun Maiya3-May-18 19:40 
PraiseGreat Post! Pin
koothkeeper6-Jan-17 15:37
professionalkoothkeeper6-Jan-17 15:37 
GeneralMy vote of 5 Pin
koothkeeper6-Jan-17 15:36
professionalkoothkeeper6-Jan-17 15:36 
GeneralRe: My vote of 5 Pin
Arun Maiya8-Jan-17 16:24
professionalArun Maiya8-Jan-17 16:24 
QuestionCompatibility Pin
E. Papulovskiy5-Jan-17 4:25
E. Papulovskiy5-Jan-17 4:25 
Interesting, what about compatibility? If I compile a code for kernel 4.8.2, will it work on 2.6.35 (Scientific Linux 6.8) or 3.16.7 (Debian Jessie)?
AnswerRe: Compatibility Pin
Arun Maiya5-Jan-17 18:35
professionalArun Maiya5-Jan-17 18:35 
AnswerRe: Compatibility Pin
Albert Holguin9-Jan-17 9:43
professionalAlbert Holguin9-Jan-17 9:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.