News:

The new Release 25.03 is out! You can download binaries for Windows and many major Linux distros here .

Main Menu

Can I make C::B portable?

Started by Squeller, November 16, 2006, 02:13:38 PM

Previous topic - Next topic

Squeller

Hi,

can I make cb portable together with the gnu gcc compiler? This requires to set relative paths e.g. in the compiler options. Has someone tried it?

Thx

thomas

There should be no reason why that should not work. The development version of Code::Blocks should be alltogether relocatable ("portable").

For RC2/Windows, that's of course not true, since RC2 writes its configuration to the Windows registry.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

bigbug

Some time ago I tried it. I managed it to make the compiler directory relative by using the variable $(CODEBLOCKS). But it didn't work for the debugger. It looked like the builtin variables weren't expanded for the invocation of the debugger.

Pecan

Search the main index for "usb". There's a lot of info on portability.

bigbug

I've tried it again. It still doesn't work, because:

  • if you use a relative path in "Global compiler settings/Programs", it's relative to the current project
  • builtin variables neither expand if used for the "Compiler's installation directory" nor if used for the debugger path
Would it be a great effort to make the builtin variables expand in either the "Compiler's installation directory" or the debugger path?

thomas

Proof of concept:

Compiling Code::Blocks svn sources (located on drive D:) with Code::Blocks revision 3222 and MinGW 3.4.5, both located on a USB stick (drive G:), using preferences stored on the same USB stick.


"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

bigbug

#6
If you have a MinGW installation (e.g. in C:\MinGW), did you try renaming the folder? I tried and if I don't rename it, Code::Blocks automagically uses the compiler from my local MinGW but if I rename it, Code::Blocks says:
Execution of 'mingw32-g++.exe ...' failed.

Edit:
Looking at your "File Monitor" screenshot, it seems Code::Blocks opens "G:\CodeBlocks\mingw32-g++.exe". Since your Code::Blocks executable is located at "G:\CodeBlocks\codeblocks.exe" and your compiler directory is "$(codeblocks)\..\mingw", shouldn't it open "G:\mingw\bin\mingw32-g++.exe"?

thomas

If it fails for you, it may depend on the path, as the compiler plugin works on that. Mandrav is looking into it right now.
Probably a one-liner :)
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

mandrav

Quote from: thomas on November 17, 2006, 02:51:37 PM
If it fails for you, it may depend on the path, as the compiler plugin works on that. Mandrav is looking into it right now.
Probably a one-liner :)

An one-liner it was, bug fixed.
Be patient!
This bug will be fixed soon...


Squeller

Thanks anyone for your information, I think I'll get it working next week when I have time.

Belgabor

One small thing to add: Global variables (a la $(#mingw)) don't seem to work for the "Compiler's install directory".

Squeller

OK, I've put my mingw directory to the codeblocks directory and put the $(codeblocks) variable to the compiler options, which seems to work.

But a stupid questions: Where does c::b store it's settings?

thomas

Quote from: Squeller on November 18, 2006, 06:00:48 PM
OK, I've put my mingw directory to the codeblocks directory and put the $(codeblocks) variable to the compiler options, which seems to work.

But a stupid questions: Where does c::b store it's settings?
In a folder codeblocks inside your "Application Data" folder (usually in C:\Documents and Settings\...).
However, to make Code::Blocks "portable", you just copy the profile you want to the folder where Code::Blocks lives, that one has precedence. This way, you can put it onto a memory stick or cdrom, or whatever.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Squeller

Thanks, very good design.
I've simply overseen the codeblocks folder in %appdata%.