Author Topic: Can I make C::B portable?  (Read 39768 times)

Squeller

  • Guest
Can I make C::B portable?
« on: November 16, 2006, 02:13:38 pm »
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

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Can I make C::B portable?
« Reply #1 on: November 16, 2006, 02:48:01 pm »
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

  • Guest
Re: Can I make C::B portable?
« Reply #2 on: November 16, 2006, 02:56:38 pm »
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.

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2750
Re: Can I make C::B portable?
« Reply #3 on: November 16, 2006, 03:01:47 pm »
Search the main index for "usb". There's a lot of info on portability.

bigbug

  • Guest
Re: Can I make C::B portable?
« Reply #4 on: November 17, 2006, 10:32:47 am »
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?

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Can I make C::B portable?
« Reply #5 on: November 17, 2006, 01:36:35 pm »
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

  • Guest
Re: Can I make C::B portable?
« Reply #6 on: November 17, 2006, 01:59:39 pm »
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"?
« Last Edit: November 17, 2006, 02:07:48 pm by bigbug »

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Can I make C::B portable?
« Reply #7 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 :)
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: Can I make C::B portable?
« Reply #8 on: November 17, 2006, 03:00:56 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...

bigbug

  • Guest
Re: Can I make C::B portable?
« Reply #9 on: November 17, 2006, 03:03:52 pm »
Thank You!!! :D

Squeller

  • Guest
Re: Can I make C::B portable?
« Reply #10 on: November 18, 2006, 05:53:10 pm »
Thanks anyone for your information, I think I'll get it working next week when I have time.

Offline Belgabor

  • Multiple posting newcomer
  • *
  • Posts: 91
Re: Can I make C::B portable?
« Reply #11 on: November 18, 2006, 05:58:53 pm »
One small thing to add: Global variables (a la $(#mingw)) don't seem to work for the "Compiler's install directory".

Squeller

  • Guest
Re: Can I make C::B portable?
« Reply #12 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?

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Can I make C::B portable?
« Reply #13 on: November 18, 2006, 06:19:53 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

  • Guest
Re: Can I make C::B portable?
« Reply #14 on: November 19, 2006, 02:08:07 pm »
Thanks, very good design.
I've simply overseen the codeblocks folder in %appdata%.