Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / DevOps

GCC Cross Compiler Setup in Windows

4.56/5 (5 votes)
17 Jan 2017CPOL 29.6K  
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)