65.9K
CodeProject is changing. Read more.
Home

GCC Cross Compiler Setup in Windows

starIconstarIconstarIconstarIcon
emptyStarIcon
starIcon

4.56/5 (5 votes)

Jan 5, 2017

CPOL
viewsIcon

29551

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:

    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