{"id":56,"date":"2008-06-21T09:10:00","date_gmt":"2008-06-21T09:10:00","guid":{"rendered":"https:\/\/knielsen-hq.org\/w\/?p=56"},"modified":"2021-09-01T07:00:42","modified_gmt":"2021-09-01T07:00:42","slug":"installing-gcc-4-3-1","status":"publish","type":"post","link":"https:\/\/knielsen-hq.org\/w\/installing-gcc-4-3-1\/","title":{"rendered":"Installing GCC-4.3.1"},"content":{"rendered":"\n<p>I sometimes see even seasoned developers be reluctant to use a different gcc version (ie. to reproduce a potentially compiler-specific issue or just to experiment with new optimisations or features). The reason is a fear of breaking their system by installing multiple compilers, or even by replacing their system compiler with a new one.<\/p>\n\n\n\n<p>But actually it is very easy to install multiple gcc versions without any risk of &#8220;polluting&#8221; the development environment. At least on Debian or Debian-based distributions (I am using Ubuntu) which can automatically install dependencies.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">    sudo apt-get build-dep gcc-4.1 g++-4.1\n<\/pre>\n\n\n\n<p>That is a brilliant feature of Debian apt, a life-saver when compiling sources with complex dependencies.<\/p>\n\n\n\n<p>Here is how it goes:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">    cd \/usr\/local\/src\/\n    wget ftp:\/\/ftp.fu-berlin.de\/unix\/languages\/gcc\/releases\/gcc-4.3.1\/gcc-core-4.3.1.tar.bz2\n    wget ftp:\/\/ftp.fu-berlin.de\/unix\/languages\/gcc\/releases\/gcc-4.3.1\/gcc-g++-4.3.1.tar.bz2\n    mkdir gcc-4.3.1\n    cd gcc-4.3.1\/\n    bzip2 -dc ..\/gcc-core-4.3.1.tar.bz2 | tar xf -\n    bzip2 -dc ..\/gcc-g++-4.3.1.tar.bz2 | tar xf -\n    mkdir build\n    cd build\n    ..\/gcc-4.3.1\/configure --prefix=\/usr\/local\/src\/gcc-4.3.1 --disable-multilib\n    time make -j4\n    make install\n<\/pre>\n\n\n\n<p>These days it doesn&#8217;t even take long to build, just under 15 minutes on a 2.4GHz Q6600 (cheap quad-core Intel).<\/p>\n\n\n\n<p>Now, the new GCC is installed in a completely seperate location, so it does not interfere in any way with normal work. But to use it to build some particular software, just do something like this:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">    PATH=\"\/usr\/local\/src\/gcc-4.3.1\/bin:$PATH\" .\/configure\n    PATH=\"\/usr\/local\/src\/gcc-4.3.1\/bin:$PATH\" make\n<\/pre>\n\n\n\n<p>Well, there is one snag, that is why I have the &#8211;disable-multilib in the above .\/configure. Otherwise I get this:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">    In file included from \/usr\/local\/src\/gcc-4.3.1\/build\/.\/gcc\/include-fixed\/features.h:355,\n             from \/usr\/include\/stdio.h:28,\n             from ..\/..\/..\/..\/gcc-4.3.1\/libgcc\/..\/gcc\/tsystem.h:90,\n             from ..\/..\/..\/..\/gcc-4.3.1\/libgcc\/..\/gcc\/libgcc2.c:33:\n    \/usr\/include\/gnu\/stubs.h:7:27: error: gnu\/stubs-32.h: No such file or directory\n<\/pre>\n\n\n\n<p>This is some problem with Ubuntu Feisty which puts that include file in \/usr\/include\/i486-linux-gnu\/gnu\/stubs-32.h where apparently GCC does not look for it. I do not need to build any 32-bit binaries, so &#8211;disable-multilib is a quick solution.<\/p>\n\n\n\n<p>Hopefully this is fixed somehow in Hardy.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I sometimes see even seasoned developers be reluctant to use a different gcc version (ie. to reproduce a potentially compiler-specific issue or just to experiment with new optimisations or features). The reason is a fear of breaking their system by installing multiple compilers, or even by replacing their system compiler with a new one. But&hellip; <a class=\"more-link\" href=\"https:\/\/knielsen-hq.org\/w\/installing-gcc-4-3-1\/\">Continue reading <span class=\"screen-reader-text\">Installing GCC-4.3.1<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[11,6],"_links":{"self":[{"href":"https:\/\/knielsen-hq.org\/w\/wp-json\/wp\/v2\/posts\/56"}],"collection":[{"href":"https:\/\/knielsen-hq.org\/w\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/knielsen-hq.org\/w\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/knielsen-hq.org\/w\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/knielsen-hq.org\/w\/wp-json\/wp\/v2\/comments?post=56"}],"version-history":[{"count":1,"href":"https:\/\/knielsen-hq.org\/w\/wp-json\/wp\/v2\/posts\/56\/revisions"}],"predecessor-version":[{"id":57,"href":"https:\/\/knielsen-hq.org\/w\/wp-json\/wp\/v2\/posts\/56\/revisions\/57"}],"wp:attachment":[{"href":"https:\/\/knielsen-hq.org\/w\/wp-json\/wp\/v2\/media?parent=56"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/knielsen-hq.org\/w\/wp-json\/wp\/v2\/categories?post=56"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/knielsen-hq.org\/w\/wp-json\/wp\/v2\/tags?post=56"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}