Code::Blocks Forums

User forums => General (but related to Code::Blocks) => Topic started by: Newbie0815 on March 25, 2010, 12:56:01 am

Title: Installing 64bit?
Post by: Newbie0815 on March 25, 2010, 12:56:01 am
I´ve been searching the web for months now, but either I´m blind, or there is no info about it.
I found tons of topics asking, how to compile 64bit applications on a 32bit OS or the other way around.
I found tons of topics dealing with compiling 64bit in Linux.
Also there are tons of topics asking about the 64bit version of MinGW, where the answers all require a university degree in informatics before one could understand them.
A search for "Code Blocks 64 bit" in Google finds the Wiki page, where they explain how to make C::B work to compile 64bit with VC++2005, but not a word about MinGW.
I understand that most programmers will have enough knowledge and prefer to install IDE and compiler separate, but beginners like me apreciate the all in one installation as C::B offers it in the download section.
I´ve already had a hard time installing a nighly build over the basic installation to make it work in Vista 32bit.

I´m not really developping anything, I´m just learning by doing and more out of curiosity than need, but now I have Windows7 64bit and obviously I would like to have an easy all in one installation package for the IDE/compiler I´m familiar with, which is C::B/MinGW/GCC++.
It might be a bold request, but you might say, I want to keep everything as it was in 32bit, with the only difference that I can then compile 64bit applications within Windows7 64bit.
One where a click on "Create a new project" will automatically produce the code needed to create an empty example window, which will compile as it is, only makes it a 64bit example window.

Unfortunately there is no such thing, not even a website explaining how to set it up, or at least none that a beginner like me could understand.
Could anyone explain how to do this, in words a dummy like me can understand, or does anyone know a website explaining it?
Title: Re: Installing 64bit?
Post by: Propagator on March 25, 2010, 11:06:19 am
You don't need a 64bit Code::Blocks to compile 64bit applications. So just install the latest nightly of Code::Blocks and you should be fine.

But you'll need a 64bit compiler as the one provided by the MinGW-w64 project (http://sourceforge.net/projects/mingw-w64/ (http://sourceforge.net/projects/mingw-w64/)). According to this URL (http://sourceforge.net/apps/trac/mingw-w64/wiki/download%20filename%20structure (http://sourceforge.net/apps/trac/mingw-w64/wiki/download%20filename%20structure)) you'll have to download an archive with the prefix mingw-w64-bin_x86_64-mingw_..... You can find such archives e.g. in the Personal Builds folder of the MinGW-w64 project on sourceforge.

The next step is to unpack the archive. In my case, I put everything into a folder c:\mingw-w64\.

Finally you must set up Code::Blocks to use this toolchain. In the menu Settings->Compiler and Debugger go to the tab Toolchain Executables. Set the compiler's installation directory (c:\mingw-w64 in my case) and enter the file names of the toolchain executables (in my case: C compiler: x86_64-w64-mingw32-gcc.exe, C++ compiler: x86_64-w64-mingw32-g++.exe, etc..)

Now you should be ready to use Code::Blocks to write and compile 64bit applications...  (hope I didn't miss a step)
Title: Re: Installing 64bit?
Post by: Newbie0815 on March 25, 2010, 01:34:28 pm
Thanks for the answer.
Sounds  quite easy, but I didn´t fully understand it.
Your first links leads to a download where the file contains the word "snapshot" which makes me wonder what that means, at least to me it doesn´t sound like the simply ready made package.
Your second link leads to a page where they try to explain how you find out what you need, but the link on top of the page leads to a list of files that somehow doesn´t match the explanations at least there are way more files than the page explains about and again I´m not sure which one I need.
Then there are separate files like one for Release for GCC4.4.0 and another Release for GCC4.4.1, which makes me believe, I might have to download GCC separate and install that as well, but on that one there is no further explanation.

While the files have sizes between 3.4MB and 1.6GB, I´m sure its not all the same, but I really have no clue which one(s) I need to have C::B installed about the same way as I have it through the all in one download, just in 64bit version.
Title: Re: Installing 64bit?
Post by: stahta01 on March 25, 2010, 03:04:32 pm
While the files have sizes between 3.4MB and 1.6GB, I´m sure its not all the same, but I really have no clue which one(s) I need to have C::B installed about the same way as I have it through the all in one download, just in 64bit version.

Then you will need to wait a few months to maybe years. Note, it may never happen.

Tim S.
Title: Re: Installing 64bit?
Post by: Newbie0815 on March 25, 2010, 04:26:03 pm
When I first got here, about 3 years ago, I had about the same problem, maybe even worse than this time.
I haven´t forgotten, it was you, stahta01, who helped me out back then, the post is still here: http://forums.codeblocks.org/index.php/topic,5231.0.html (http://forums.codeblocks.org/index.php/topic,5231.0.html)
I´ve copied your first reply in that thread into a .txt, plus a few notes I´ve added for myself and I´ve reused it countless times to reinstall my system.
I´ve happily worked with this for the last 3 years, and I´m still grateful for your help back then.

Somehow I was hoping I could get an updated list of things to do, in same format as you gave me there.

Beginning with a new PC, nothing but a fresh windows7 ultimate 64bit installed.
download [this file], unpack it into [this folder]
run [this], select [this]

It was the best explanation I ever got for anything, absolute foolproof.
I guess I can´t thank you enough for your help there, so let me say thanks again, and if it´s not too much for you, could you make me a similar list for 64bit?
Title: Re: Installing 64bit?
Post by: Biplab on March 25, 2010, 05:08:25 pm
Download the following package. This is the latest one. It's an all-in-one package. Download it and then follow the steps "Propagator" wrote above.

Quote
http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/sezero_20100322/mingw-w64-bin_x86_64-mingw_20100322_sezero.zip/download
Title: Re: Installing 64bit?
Post by: Newbie0815 on March 25, 2010, 05:34:44 pm
Thanks for the link, alone by the filename it looks good already.
Only 2 more questions:

1) Since I don´t have any C::B on a new PC, which version of C::B do I install?
The 8.02 from the download page already has a note underneath saying it doesn´t work in Vista, so I would assume it doesn´t work in Windows7 either.
If I download a nightly without installing the 8.02 first, I have to do all the environment variables myself, so I would guess, easiest way would be
1) Install 8.02
2) Copy and replace the latest nightly into the folders from that installation
3) Unpack mingw64 and follow Propagator´s list

2) What about the 2 files I had to copy into the C::B folder?
wxmsw26u_gcc_cb.dll and mingwm10.dll
Not needed anymore, or new version available, or correct version already included in the above list?
Title: Re: Installing 64bit?
Post by: Propagator on March 26, 2010, 09:37:17 am
Just follow the steps in point 3 of this post: http://forums.codeblocks.org/index.php/topic,3232.0.html (http://forums.codeblocks.org/index.php/topic,3232.0.html)

You get the most recent versions of the files mentioned there from the links embedded in this post: http://forums.codeblocks.org/index.php/topic,12098.0.html (http://forums.codeblocks.org/index.php/topic,12098.0.html)

Unpack all the files into the same folder. There's no need to use the 8.02 installer prior to these steps... Works perfectly for me with Windows 7 64bit.
Title: Re: Installing 64bit?
Post by: Newbie0815 on March 26, 2010, 02:53:15 pm
Thanks to everyone, hopefully that will be easy enough even for me.
Title: Re: Installing 64bit?
Post by: b105xor on June 07, 2010, 07:25:49 am
I'm new to C::B - so I thought it was just me, but I am having a problem with this very basic transition.  I have a codebase that will definitely break when compiled as 64bit so I need to port it.  First I installed the conventional Mingw32 and it compiles fine.  Then installed Mingw64, copied the c:b toolset, went in and changed the path and executables to the new Mingw64 install, but it still built, and my code was the exact size as the 32bit code - obviously something is amiss.

I then changed the build output to verbose (command line) and after a few builds that finally took, but what it clearly shows is that it is still using the original mingw32 toolset, even when I have the new mingw64 toolset selected.  I tried closing c::b and opening it back up, but it doesn't help.  Well soon ill turn off the computer for the day and see if a full restart helps, but I can't imagine that should work. 

Any suggestions?

I copied the old toolset rather than making a new toolset as I am worried there is some setting i might miss, but I guess I need to try that.
Title: Re: Installing 64bit?
Post by: oBFusCATed on June 07, 2010, 02:48:33 pm
You need to change the compiler associated to the project/target you're trying to build.
Title: Re: Installing 64bit?
Post by: b105xor on June 07, 2010, 04:37:46 pm
You need to change the compiler associated to the project/target you're trying to build.

Yeah, I tried that and it didn't work.  It is definitely a bug with C:B - here is the list of things I tried before I got it to work:

-copied old tools to new 64bit variant, modified path and exe's for new toolset.
-changed project to use new toolset
-build still used original toolset
-many C:B open/close cycles
-build still used original toolset
-deleted C:B and reinstalled
-build still used original toolset
-cycle power
-build still used original toolset
-deleted original toolset
-build still tried to use original toolset
-Changed toolset to watcom
-C:B complied and used Watcom for building
-Changed to new "copied" 64 variant of mingw64
-success

Finally then, it looks like 2 bugs:
1-uninstall doesn't clear Win7 registry settings
2-C:B will ignore a toolset change to a copied toolset unless you first transitioning through a pre-installed toolset.

Not trying to be critical though - it seems to be a great tool.
Title: Re: Installing 64bit?
Post by: Jenna on June 07, 2010, 05:10:57 pm
Finally then, it looks like 2 bugs:
1-uninstall doesn't clear Win7 registry settings
2-C:B will ignore a toolset change to a copied toolset unless you first transitioning through a pre-installed toolset.

1 C::B do not use the library to save the configuration, so it cab not clear it.

2 C::B does not ignore toolset changings, at least not here (neither on linux nor on w2k, xp or vista, not tested on win7).

You did not write which version of C::B you use, so it's difficult to give the correct answer.

If you have both toolchains in system-path (or at least the one you do not use actually) and one of the toolchains is incomplete (most likely the new one), you might use a mix of 32- and 64-bit tools.
If you have made any settings in Global compiler options for the original toolchain before copying it (search-paths, libs etc.) they get copied to the new one and can break it.
Title: Re: Installing 64bit?
Post by: b105xor on June 07, 2010, 05:42:58 pm

1 C::B do not use the library to save the configuration, so it cab not clear it.

2 C::B does not ignore toolset changings, at least not here (neither on linux nor on w2k, xp or vista, not tested on win7).

You did not write which version of C::B you use, so it's difficult to give the correct answer.

If you have both toolchains in system-path (or at least the one you do not use actually) and one of the toolchains is incomplete (most likely the new one), you might use a mix of 32- and 64-bit tools.
If you have made any settings in Global compiler options for the original toolchain before copying it (search-paths, libs etc.) they get copied to the new one and can break it.

I'm not sure this is going to be where you want to track bugs, but I am game if you are.

1-If C:B is not using the registry, then the bug is that C:B uninstall does not delete configuration files.  The effect is the same - a final user should not have to reverse engineer the application to figure out how to uninstall it.

2-I changed absolutely nothing between my change from Mingw64 to Watcom and back to Mingw64 when it magically started working.  It was not an issue of mixing toolchains.  It was simply ignoring the new toolchain and all indications were to that effect (e.g. exe names are completely different in each toolset and in verbose mode C:B was shown invoking the old exe names - "path" can never enter into such an error).  I did have an additional search and lib path which I was happy to see get duplicated in the new copy that I used for Mingw64.  Can you be more specific about how this will "break" the new tool chain?  I did see some unexpected tool path type error with the Mingw64 toolset when C:B started to use it (after the swap from Watcom). 

In the interest of full discloser, I am not currently on the machine I was using when I saw these errors.  However, I installed C:B on both within a few hours, on Saturday, so 99% they are the same, which is 10.05.  If I get time, I might be able to recreate it on XP.

Thnx for the speedy reply!
Title: Re: Installing 64bit?
Post by: b105xor on June 07, 2010, 08:20:51 pm
I am trying to reproduce the previous behavior and I get very strange results.  On this machine I have VS2005 and not Watcom and it is XP.

My MinGW64 gets completely ignored as before, but I tried swapping to VS2005 and oddly, C:B is building with MinGW.  Very unexpected behavior.  Fortunately, with VS2005, it gives some message that VS2005 is an invalid install or something is broken so it is ignoring VS2005 and compiling with MinGW!  I mean, ok, its unexpected, so I am happy to have a message, but when I go back to the MinGW64, C:B ignores the MinGW6 exe's and does not give the nice message that it has arbitrarily picked a replacement compiler.

Obviously I would argue this is an unwanted behavior, but if this makes every one else happy then hey whatever.  It looks like the bug is more about warning message not showing when a newly created toolset is rejected for some reason. 
Title: Re: Installing 64bit?
Post by: Jenna on June 07, 2010, 10:38:03 pm
I don't use MinGW64 and have only VC200x (don't know exactly) installed for testing purposes on onbe of my virtual machines.
But on my debian system I use several versions of gcc 4.1, 4.3, 4.4, 4.5 (all 64-bit) mingw32-cross-compiler, compiler-scripts using ccache, gdc and I can switch between them flawlessly, even if I just have  created (copied) a new compiler.
So I wonder what happens for you.

One question that just comes in my mind: do you use a project or do you try to compile single files ?
Title: Re: Installing 64bit?
Post by: b105xor on June 07, 2010, 10:50:08 pm
I am using a project or workspace with a few projects inside.  One of the first things I did when I was trying to figure this out was to look in the workspace config file which was aggravatingly updated with the 64bit tools, even though it was still using the 32bit tools. 

I honestly don't use the VS2005 on this machine, so I have no direct knowledge that it is functional, but the drive image I am using has been duplicated onto a few thousand machines other people are using daily, so it should be fine.  I have no idea why C:B doesn't like it.

Its fine though if it rejects a toolset and then moves on, just as long as it gives a message when it does.  I would prefer a dialog box, but that is just me nit-picking.  But definitely some form of communication is required when C:B does something I didn't tell it to do (e.g. pick some other toolset and charge ahead).