Friday, January 4, 2008

Upgrading gcc to upgrade clamav to 0.92

I have problem upgrading my clamav 0.91.2 to 0.92 due to bug in gcc 4.0.1 on my Mandriva 2006. So I upgraded my gcc to 4.1.2. I chose to compile from source. It is advisable to refer to successful builds pertaining to the version of gcc to get a clue whether it will successfully build on your target system. I didn't choose later version because I couldn't find any successful build for my system. So I played safe. :P

Download: GNU gcc 4.1.2 (China Mirror)
You have to download at least gcc-core-4.1.2.tar.bz2 and gcc-4.1.2.tar.bz2. I also downloaded gcc-g++-4.1.2.tar.bz2, and gcc-objc-4.1.2.tar.bz2. I didn't download the others because I didn't need them. You may want to download them depends on your requirement.

Untar the tarballs
tar xjvf gcc-core-4.1.2.tar.bz2
tar xjvf gcc-4.1.2.tar.bz2
tar xjvf gcc-g++-4.1.2.tar.bz2
tar xjvf gcc-objc-4.1.2.tar.bz2

The above commands will untar the tarballs into a dir that is gcc-4.1.2. Then, as usual, run ./configure, make and make install. Before you run ./configure, please run ./configure --help to view what parameters needed. Some of the options are autodetected and included by configure itself (ie c/c++ libraries,headers ,etc).

./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var

then you can run make and make install to install it to your system. clamav 0.92 will be successfully compiled with this version of gcc.

UPDATE: Reported that gcc < 4.0 can compile clamav 0.92 successfully. So you don't need to upgrade if you use that version of gcc. Also reported that using the 'buggy' gcc, one can use -O0 as optimization flag to avoid the bug.

upgrading clamav from source
Please read my article here. The steps are still the same.

Good luck!

No comments: