Installing Code::Blocks from source on Gentoo

From CodeBlocks
Revision as of 21:30, 11 April 2006 by Sethjackson (Talk | contribs)

Jump to: navigation, search

Note: This Information is antiquated!

Code::Blocks now works fine with Unicode and wx2.6, and the build system has changed


( Note: This is non-official and unverified. It worked for me, but... )

Prepare Libraries

Code::Blocks uses the wxWidgets ( library for its GUI. wxWidgets in turn uses GTK+ ( GTK+ is the library which GNOME desktop uses, but GNOME is not required to use it. In fact, odds are very good that if you have a number of GUI programs installed, you already have it. wxWidgets is also very common, if slightly less so.

You need to compile the wxGTK package with the following use flag:


The best way of getting this done is by adding a line to /etc/portage/package.use and recompiling wxGTK :

# echo x11-libs/wxGTK gtk2  >> /etc/portage/package.use
# emerge wxGTK

Note: Code::Blocks now works fine with Unicode. So you might want to build wxGTK with +unicode flag.

Get the source code

For this you have 2 options:

Option 1: Download a source tarball.

This is easy and means you have an easily-reproduced source set.

1) Download a source tarball from The Download Section of

2) Extract it. For this tutorial, I'm going to assume that you're installing as root, so /usr/local/src is a good pick. Any location is fine, however. This should create a codeblocks-1.0rc2 ( or similar ) folder.

Option 2: Fetch from CVS

This is not signifigantly harder and means you have a more up-to-date version of the source code. Usually this means more features and different bugs, which might be more or less annoying.

1) Install the CVS client. You might have it already. If not, this just requires the usual :

# emerge dev-util/cvs

2) Set the CVS root. Run the following command, and enter the password anonymous when asked :

# cvs -d :pserver:[email protected]:/cvsroot/codeblocks login

Note that simply hitting enter--not entering a password--might also work.

3) Checkout a copy. cd to the directory you want the code to be placed in. Note that CVS will create a codeblocks directory for you. For this tutorial, I'm going to assume that you're installing as root, so /usr/local/src is a good pick. Any location is fine, however.

# cd /usr/local/src

The following command fetches the source from the CVS server :

# cvs -d :pserver:[email protected]:/cvsroot/codeblocks checkout codeblocks

Compile the Code

1) cd to codeblocks directory. Following our example, from CVS this would be /usr/local/src/codeblocks; from a tarball, something like /usr/local/src/codeblocks-1.0rc2 :

# cd /usr/local/src/codeblocks


# cd /usr/local/src/codeblocks-1.0rc2

2) bootstrap. The very first time you unpack the source (or checkout from CVS), you need to run ./bootstrap. This will create a sane building environment.

# ./bootstrap

Note: If you get weird errors here try running following command and then bootstrap again.

# find . -type f -and -not -name "*.cpp" -and -not -name "*.h" -and -not -name "*.png" -and -not -name "*.bmp" | sed "s/.*/\"\\0\"/" | xargs dos2unix

3) configure. Use 'configure --help' to see what things you can enable or disable.

# ./configure

4) make and make install.

# make
# sudo make install


to come

To run Code::Blocks:

# codeblocks


Linux releases or compiling on Linux from the forum

Code::Blocks : CVS access instructions

Basic Introduction to CVS and ( Project CVS Services


Original Author: me22 ( [email protected] ) Some changes: sleipner ( [email protected] )