install additional compiler gcc 4.7 in LEAP 42.2

Hi
I need gcc 4.7 compiler for Matlab 2015b. However, there is no package available in Yast, so I need to download this from GNU website. I have some questions regarding installing gcc 4.7.
Will installing gcc 4.7 conflict with current default compiler?

When I typed ./configure, it showed the error messages-Building GCC requires GMP 4.2+, MPFR 2.3.1+ and MPC 0.8.0+.
Try the --with-gmp, --with-mpfr and/or --with-mpc option to specify their location.
So I typed ./configure --with-gmp /usr/lib64/libgmp.so.10
It showed the error message /bin/sh ./config.sub /usr/lib64/libgmp.so.10 failed

Do you have any suggestion to fix this?

Thanks

Chris

You can install different gcc versions side by side on your machine.
After that, you will then need to modify your build configuration to reference the non-default gcc explicitly or you can switch between gcc using an update-alternatives configuration… For that, you’d need to configure manually, I describe how to do this in the following Wiki article I wrote…

https://en.opensuse.org/User:Tsu2/gcc_update-alternatives

Will gcc 4.8 work? It’s available at

https://software.opensuse.org/package/gcc

TSU

I have installed gcc compiler version 4.7.4 sucessfully. Howerever, after I typed the following command, it didn’t show gcc-4.7. But I checked gcc version by typing gcc --version. It showed gcc 4.7.4. How can I fix this problem? Thanks.

linux-xuw8:/home/chris # update-alternatives --config gcc
There are 2 choices for the alternative gcc (providing /usr/bin/gcc).

Selection Path Priority Status

  • 0 /usr/bin/gcc-4.8 50 auto mode
    1 /usr/bin/gcc-4.8 50 manual mode
    2 /usr/bin/gcc-5 20 manual mode

I’ve never needed to use matlab but maybe this is what your need.

https://software.opensuse.org/package/modules-software-matlab-R2015b

John