Thread: Compiling 64-bit on 32-bit host

  1. #1
    Registered Abuser
    Join Date
    Jun 2006
    Location
    Toronto
    Posts
    591

    Compiling 64-bit on 32-bit host

    I'm currently looking to compile native 64-bit code from a 32-bit machine (Windows).
    I've been pointed at MinGW64, however I'm unsure of which package to get from their repository (Browse MinGW-w64 - for 32 and 64 bit Windows Files on SourceForge.net), or even if MinGW64 supports compilation from a 32-bit host. Can anyone who has had success in setting up such an environment offer any advice?

  2. #2
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    I've never used MinGW, but I've compiled 64-bit code with the command line compiler that comes with the Windows Platform SDK.
    "I am probably the laziest programmer on the planet, a fact with which anyone who has ever seen my code will agree." - esbo, 11/15/2008

    "the internet is a scary place to be thats why i dont use it much." - billet, 03/17/2010

  3. #3
    Registered Abuser
    Join Date
    Jun 2006
    Location
    Toronto
    Posts
    591
    I'll have to try that if there's no leads on a MinGW-64 solution. I have the 2008 version of VS, hopefully that has support for 64-bit compilation.

  4. #4
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    It does. Simply select x64 as the platform, and boom - you have a 64-bit executable.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  5. #5
    Registered User
    Join Date
    Dec 2006
    Location
    Canada
    Posts
    3,229
    You'll need to get the cross-compiler for x86-64 (that runs on 32-bit). The native 64-bit compiler is buggy last time I checked. But that's ok, the compiler itself really doesn't need to be 64-bit.

    You need to change a line or 2 in boost to get it to compile, though. Check the mingw-64 forum on sourceforge. I think I posted my solution (or workaround) there.

    If you need the latest compiler, you may want to build it (binutils + gcc + 64-bit CRT) from source, which is not that difficult.
    GCC 4.4.0 released!

    EDIT: instructions here. http://mingw-w64.svn.sourceforge.net...16&view=markup

    You can use MSYS instead of CYGWIN if you don't want CYGWIN DLL dependency.
    Last edited by cyberfish; 07-13-2009 at 04:43 AM.

  6. #6
    Registered Abuser
    Join Date
    Jun 2006
    Location
    Toronto
    Posts
    591
    Ah thanks for that! I will be testing the "mingw-w64_x86-64_mingw32_4.4.0-1" package today.

    A lot of the other builds I had tried either depended on the cygwin dll or weren't clear as to whether they were a 64-bit compiler targeting 32-bit or the other way around.

    If I get particularly courageous I'll try the instructions you've linked, though I've never had much success building any project with MSYS or cygwin other than libmad (and only after much headache and cryptic configure/make errors).

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. 32 bit or 64 bit allignment ?! gcc options??
    By mynickmynick in forum C Programming
    Replies: 3
    Last Post: 07-29-2008, 02:43 AM
  2. If the RGB color is (64, 64, 255), change it to (64, 255, 64).
    By Grayson_Peddie in forum C# Programming
    Replies: 2
    Last Post: 06-14-2003, 04:26 PM
  3. 64 bit variables
    By Yawgmoth in forum C Programming
    Replies: 11
    Last Post: 12-19-2002, 01:55 PM
  4. 16 bit or 32 bit
    By Juganoo in forum C Programming
    Replies: 9
    Last Post: 12-19-2002, 07:24 AM
  5. 64 bit
    By stormbringer in forum C Programming
    Replies: 2
    Last Post: 10-29-2002, 06:51 PM