Is there and easy way to install gcc-4.3 on Oneiric ? I really need it because matlab depends on i for the creation of mex-files

I tried changing all my resopistories back to Maverick just to install gcc-4.3 but I get this error:

refl_v0p8_linux_and_windows % sudo apt-get install gcc-4.3-multilib libstdc++6-4.3-        dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 gcc-4.3-multilib : Depends: gcc-4.3 (= 4.3.5-3ubuntu1) but it is not going to be     installed
                Depends: libc6-dev-i386 (>= 2.5) but it is not going to be installed
 libstdc++6-4.3-dev : Depends: g++-4.3 (= 4.3.5-3ubuntu1) but it is not going to be         installed
    E: Broken packages
  • try sudo apt-get install gcc....don't add multilib...der are some dependency issues.. Nov 3, 2011 at 6:26
  • 1
    Note: It is not recommend practice to re-compile software with a gcc version other than the one that the code was developed and tested on. Some instances (wrap code with MATLAB for '.mex' files, OLDER driver code, cross-compilers, etc.) may cause subtle errors.
    – david6
    Dec 3, 2011 at 2:40
  • Also raised as: ubuntuforums.org/showpost.php?p=11375235&postcount=1 still unresolved
    – david6
    Dec 3, 2011 at 2:46

5 Answers 5


1) Edit the sources.list file:

sudo gedit /etc/apt/sources.list

add this line:

deb http://mirror.pnl.gov/ubuntu/ hardy-updates main universe

a complete list of mirror sites are given here

Save and close the file

2) Logout the login

3) Open Synaptic. If you don't see the mirror.pnl.gov/ubuntu/ hardy-updates main universe in the source-list on the left, click on Reload.

4) Choose mirror.pnl.gov/ubuntu/ hardy-updates main universe from the left column - this should show the list of packages.

5) Choose g77 from the list, mark for installation and apply. g77 is now installed and is ready to use.


There is definitely no need to use gcc-4.3. Of course you always get the warning message during mex-files creating:

Warning: You are using gcc version "4.6.x.x)". The version currently supported with MEX is "4.3.4". For a list of currently supported compilers see: http://www.mathworks.com/support/compilers/current_release/

but this is a warning - the MEX function will still compile!!!

The only thing to change is new link on libc.so.6 library: (see http://morganbye.net/blog/2011/10/matlab-ubuntu-1110)

So for 64 bit: Remove old link

sudo rm /lib64/libc.so.6

(Be careful when removing the old link. It is essential for Linux to boot. So if you reboot before replacing the link with the new version then it'll be time to dig out a live disk. If you're paranoid then you can copy "cp" libc.so.6 to something like libc.so.6.backup first.)

Replace with new link

sudo ln -s /lib/x86_64-linux-gnu/libc-2.13.so /lib64/libc.so.6

For 32 bit: (I have not tested this as I only run x64 systems, but from the comments I think it should work)

Remove old link (again be careful with this command)

sudo rm /lib32/libc.so.6

Replace with new link

sudo ln -s /lib/i386-linux-gnu/libc-2.13.so /lib/libc.so.6

Of course if this is a fresh Ubuntu install then you probably wont need the rm (remove) command.


You have broken dependencies. You can "repair" them doing

sudo apt-get -f install

But before saying yes, please look, what apt tries to uninstall.

And as a hint: It is not a good idea to downgrade the ubuntu verion just to get another version of gcc. You can have multiple versions of gcc on one machine! I would go again to the version you had before your failed attempt to downgrade and keep the gcc version you had before. Then get the tar-ball of gcc 4.3 and compile it yourself, it is not difficult. After that you have two gcc versions, then you can point matlab to the other version (specify the gcc path somewhere in matlab).

It would not recommend you to compile other software with a gcc version other than the one that was installed by default in ubuntu.

  • I've tried to compile it, but it's not that easy. Would you mind helping me how to do that? Nov 8, 2011 at 8:35
  • usually you first invoke "./configure" - then you see somewhere an alert message or sth. like "missing foo". Then you have to search for foo and install it. usually you should find foo as package in ubuntu. After having installed all depending packages your configure script should walkthrough and then compilation should work.
    – Michael K
    Nov 10, 2011 at 8:35

Possible workaround: (fix for MATLAB, not GCC-4.3)

from: http://xcorr.net/2010/05/07/getting-gcc-to-work-with-matlab-r2009b-on-linux-ubuntu-karmic-to-compile-mex-files/

(in summary)

Step 1:

for MATLAB, with sudo run mex -setup and select the (latest) GCC compiler.

Step 2:

sudo gedit ~/.matlab/R2009b/mexopts.sh

Replace ALL instances of CC=’gcc’ with CC=’gcc-4.6′

(optional) Replace -ansi with -std=c99, to allow use of C++ style // comments.

Note: If you later re-run mex -setup, this will overwrite the mexopts.sh file.


I know this question is two years old, but I don't like to see questions that never get an accepted answer so I'm trying to help.

This doesn't use the package manager, but at http://gcc-uk.internet.bs/releases/ you can find almost every version of GCC. Version 4.3.0 (and likely all others) include HTML installation instructions. If you don't like UK servers, there is a list of mirrors at the GCC website; some of them might have old versions like this one does.

I have to disagree with Michal Kvasnicka, you should always use the specified version of GCC.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .