GNU/Linux
Installing C++ Boost on SuSE and Fedora
0C++ Boost on SuSE:
Its simple to install C++ Boost on a SuSE system by using its YaST package manager.
- Run YaST and select "Software" from the left pane. Now select "Software Management" from the right pane and search for "boost" using the Search box.
- Select the boost packages that you want to install from the right pane(you atleast need boost - 1.33.0-3) and press the "Accept" button.
You can now test the boost installation by compiling the two programs I had mentioned in my earlier post, using the following commands:
sh# g++ -o first first.cpp
sh# g++-o second second.cpp -lboost_filesystem
C++ Boost on Fedora:
Installing C++ Boost on RedHat Fedora systems is also along the same lines. First download the boost-1.33.1-5.i386.rpm RPM file from the internet. you can search for a different version of the file if you are not using the Fedora Core 5 system. Install it using the following command(you can directly click on the file):
sh# rpm -ivh boost-1.33.1-5.i386.rpm
You can also install it using the yum package manager of Fedora. Test the installation just as mentioned in the case of SuSE.
Java 1.5 and Eclipse in Gentoo – Part II
4My previous post discussed the installation of Java on a Gentoo system. Its all well as long as you want to run the default supported version of java on the Gentoo system – you install blackdown-jdk 1.4, Eclipse 3.0, and maybe Eclipse CDT too and get on with development. But if you want to install java 1.5(Tiger) then you need to unmask the package before you can install it and also remember to make blackdown(or sun) jdk 1.4 as the default JVM for the system. You can keep sun jdk 1.5 as the default JVM for the user. The procedure is like this:
[sun-jdk-1.5.0.06] “Sun JDK 1.5.0.06″ (/etc/env.d/java/20sun-jdk-1.5.0.06) *
[blackdown-jdk-1.4.2.03] “Blackdown JDK 1.4.2.03″ (/etc/env.d/java/20blackdown-jdk-1.4.2.03)
This shows you all the installed jdks on your system. Use the name as given under the brackets to set that particular jvm as your system default:
sh# /usr/sbin/env-update && source /etc/profile
This sets the blackdown jdk 1.4 as the system jvm, which is the recommended option. You can set the sun jdk 5.0 as the user default jvm though:
sh# echo source ~/.gentoo/java-env >> ~./bash_profile
sh# source ~/.gentoo/java-env
This sets the sun jdk 1.5 as the user jvm and it is safe this way. But don’t make 1.5 version as the default jvm for the system unless you are ready to break a lot of java applications.
Best way to install Java on Gentoo OS:
But this still is not an ideal setup from my point of view; the installed Eclipse version doesn’t support the Java 1.5 version. If you want to use the latest versions of all the java software without going through all of these hassles, you need to install everything related to java manaully in the user home directory. This won’t affect your normal portage structure in any way(but you still need a system jdk to run java applications from the browser).
First download the latest versions of Java SDK and the Eclipse IDE from the Internet and copy them into the home directory.
Download sun jdk 1.5.0 update 6 from here and copy it into the home directory. You will have to accept the license to be able to download this. Be sure to download the .bin version of the file and not the RPM version.
Download the latest version of the Eclipse IDE from here and copy it in the home directory. The latest build available currently is Eclipse 3.2M5a. If you plan to use Eclipse CDT plugin to create C++ applications, then you have to be content with the Eclipse 3.1.2 version.
(All the above links are for the gnu/linux, 32-bit operating system. Finding similar package files for 64-bit systems shouldn’t be too difficult)
Install jdk as a normal user:
sh# ./jdk_1_5_0_06-linux-i586.bin
sh# tar xvzf eclipse-sdk-3,1,2-linux-gtk.tar.gz
Rename the directory to which the above files are extracted to something simple, like “eclipse”.
Now add the following lines to your user profile( eg ~/.bash_profile ):
JDK_HOME=~/jdk1.5.0_06
JAVAC=~/jdk1.5.0_06/bin/javac
PATH=~/jdk1.5.0_06/bin:~/jdk1.5.0_06/jre/bin:~/eclipse:$PATH
MANPATH=$MANPATH:~/~/jdk1.5.0_06/man
JAVA_HOME=~/jdk1.5.0_06
source the profile once and start the Eclipse IDE:
sh# eclipse
Go to Windows menu and select Preferences from it. Select Java -> Installed JREs from the left pane and click on the “Add” button on the right pane.

Browse to and select jdk1.5.0_06/jre directory from your home directory. Enter “JDK1.5.0_06″ in “JRE Name:” field. Click on Java -> Compiler item from the left pane and select “5.0″ from the “Compiler Compliance Settings:” selection list.

Click OK button to dismiss the dialog box.
Now you can create java 1.5 applications on your Gentoo system using the Eclipse IDE.
Just extract the Eclipse CDT tar file in the eclipse folder to get the C++ support in Eclipse. (contents of ‘features’ directory from downloaded package should go into the ‘features’ directory in eclipse, and contents of ‘plugins’ directory should go into the ‘plugins’ directory in eclipse).
Java on Gentoo
2The simplest way to get started with Java development in Gentoo is to install the Blackdown JDK-1.4.2 along with the Eclipse IDE:
If you want to install the sun’s version of the jdk instead of the blackdown jdk, you can get the 1.4.2 version of it using:
To install the 1.5 version of the jdk, you need to unmask it first. Add the following two lines to your /etc/portage/package.keywords file:
>=dev-java/sun-jdk-1.5.0 ~x86
>=dev-java/java-sdk-docs-1.5.0 ~x86
Now do the emerge:
You can also install both of these versions at the same time, and then make one of them as the default jdk. If you need java support in other applications too(like web browser etc), then make sure to add the relevant keywords in the /etc/portage/package.use file:
=dev-java/sun-jdk-1.4.2.10-r2 X alsa browserplugin doc examples jce mozilla nsplugin
This also installs the documentation and the examples – remove these words if you don’t to install them. Also change the version number if you are installing the 1.5 version of the jdk.
If you want to use Eclipse IDE to create C++ programs, you need the eclipse-cdt plugin. First unmask it by placing the following line in /etc/portage/package.keywords file:
>=dev-util/eclipse-cdt-2.0 ~x86
Now do the emerge:
More information on installing java 1.5 and eclipse 3.x on Gentoo OS.
Installing C++ Boost on Slackware/Zenwalk
9C++ Boost 1.33.1 on Slackware/Zenwalk:
- Download bjam slackware package(tgz) and boost-1_33_1 source package(tar.gz) from the sourceforge.net website:
bjam for slackware
c++ boost source package
(or Google for the latest versions of these two packages) - Save these two files in the home directory and then cd into it:
sh# cd $HOME
- Install bjam(as root):
sh# installpkg boost-jam-3.1.11-1-linuxx86.tgz
sh# export PATH=$PATH:/boost-jam-3.1.11-1-linuxx86/ - Compile and install boost(as root):
sh# tar xjvf boost_1_33_1.tar.bz2
sh# cd boost_1_33_1
sh# bjam “-sTOOLS=gcc” install
C++ Boost is now installed. This procedure doesn’t install the files in the default library paths, so compilation commands are slightly longer than they are for Gentoo and Debian/Ubuntu:
sh# g++ -o first first.cpp -I/usr/local/include/boost-1_33_1
sh# g++ -o second second.cpp -I/usr/local/include/boost-1_33_1 -L/usr/local/lib -lboost_filesystem-gcc
You can simplify this by adding the paths of boost folders to gcc library environment variables:
sh# export LIBRARY_PATH=/usr/local/lib
The compilation can now be performed using the following simple commands:
sh# g++ -o second second.cpp -lboost_filesystem-gcc
The two ‘export’ commands can be added at the end of the profile file(/etc/profile or $HOME/.bash_profile) to avoid having to type them every time a new shell is opened. Other way to simplify the process would be to create symbolic links to boost library paths in the Slackware standard include paths so that gcc can find them directly.
Installing C++ Boost on Gentoo and Debian/Ubuntu
11Note: Updated the post to note the availability of C++ Boost 1.34.1 libraries for Gentoo and (especially) for Ubuntu 7.10(Gutsy Gibbon).
1. C++ Boost on Gentoo:
On the shell prompt, type:
This should install the latest version of boost available for Gentoo. Currently 1.33.1 version of Boost Libraries is available for Gentoo. Synchronise(‘emerge –sync’) with the Gentoo portage if your ‘emerge -p boost’ shows an earlier version. You can install the latest version Boost 1.34.1 by adding the line “dev-libs/boost ~x86″ to “/etc/portage/package.keywords” file.
2. C++ Boost on Debian/Ubuntu:
- Update2:
Boost 1.34.1 version is now available. To install the latest version, run the following command(or select these packages from Synaptic Package Manager):sh# apt-get install libboost-date-time-dev libboost-date-time1.34.1 libboost-dev libboost-doc libboost-filesystem-dev libboost-filesystem1.34.1 libboost-graph-dev libboost-graph1.34.1 libboost-iostreams-dev libboost-iostreams1.34.1 libboost-program-options-dev libboost-program-options1.34.1 libboost-python-dev libboost-python1.34.1 libboost-regex-dev libboost-regex1.34.1 libboost-signals-dev libboost-signals1.34.1 libboost-test-dev libboost-test1.34.1 libboost-thread-dev libboost-thread1.34.1Or,
sh# apt-get install libboost.*-dev libboost-doc libboost.*1.34.1 Update1:See the new update above
Boost 1.33.1 version is now available. To install this version, run the following command(or select these packages from Synaptic Package Manager):sh# apt-get install libboost-date-time-dev libboost-date-time1.33.1 libboost-dev libboost-doc libboost-filesystem-dev libboost-filesystem1.33.1 libboost-graph-dev libboost-graph1.33.1 libboost-iostreams-dev libboost-iostreams1.33.1 libboost-program-options-dev libboost-program-options1.33.1 libboost-python-dev libboost-python1.33.1 libboost-regex-dev libboost-regex1.33.1 libboost-signals-dev libboost-signals1.33.1 libboost-test-dev libboost-test1.33.1 libboost-thread-dev libboost-thread1.33.1Or,
sh# apt-get install libboost.*-dev libboost-doc libboost.*1.33.1Run the following command(or select these packages from Synaptic Package Manager):See the update abovesh# apt-get install libboost-date-time-dev libboost-date-time1.33.0 libboost-dev libboost-doc libboost-filesystem-dev libboost-filesystem1.33.0 libboost-graph-dev libboost-graph1.33.0 libboost-iostreams-dev libboost-iostreams1.33.0 libboost-program-options-dev libboost-program-options1.33.0 libboost-python-dev libboost-python1.33.0 libboost-regex-dev libboost-regex1.33.0 libboost-signals-dev libboost-signals1.33.0 libboost-test-dev libboost-test1.33.0 libboost-thread-dev libboost-thread1.33.0You can use the following simple command to install every library present in Boost that matches the pattern, if you don’t want to be selective about which libraries to install:
sh# apt-get install libboost.*-dev libboost-doc libboost.*1.33.0
All this mess could be avoided if only Debian/Ubuntu packages could build a meta-package to include all the C++ Boost libraries. One could use the pattern libboost.* but it includes the Boost debug files(libboost-dbg) too.
3. Build C++ Programs Using Boost Libraries
Once the boost package is installed, the C++ programs that make use of boost libraries can be built simply like this:
If the program needs to be linked to a library(for eg: filesystem library), then specify the name of the library using the -l switch:
I will follow this up with the installation procedure for Slackware and RPM based distributions(Done).
Update:Thanks to Jun Zhang for pointing out the missing packages in the Boost installation command for Ubuntu; the command is now updated.
Recent Comments