gcc 6.3 installation on Ubuntu 16.04 & Matlab 2018b

gcc 6.3 installation on Ubuntu 16.04 & Matlab 2018b

Postby bkasu » 2019-04-06 14:25:45

***No guarantees or warranties, use at your own risk***

Unfortunately, Matlab 2018b only supports an older version of gcc for Linux (gcc 6.3) and this version is not readily available via Ubuntu software managers, such as Synaptic, or the automatic command line "update". Also, one must select gcc 6.3 as the default gcc version. So, this requires manual installation. Since I am a Linux newbie, it took me several attempts, but I was able to install gcc 6.3 and run Techila Matlab 2018b. Please see below, several web pages that I used to piece together my solution.

https://askubuntu.com/questions/864893/ ... -3-version
https://eli.thegreenplace.net/2014/01/1 ... bunu-12-04
https://askubuntu.com/questions/26498/h ... -g-version
https://gcc.gnu.org/wiki/InstallingGCC (note the warning "not recommended")

Please note that one must a) edit the following path and file names to suit your own needs, and b) use command "sudo" where needed for permission if you are not logged in as root. My final gcc executable is at /usr/local/gcc-6.3/bin/gcc6.3

1) Download the source code and its prerequisites.
wget https://ftp.gnu.org/gnu/gcc/gcc-6.3.0/gcc-6.3.0.tar.bz2
tar jxvf gcc-6.3.0.tar.bz2
cd gcc-6.3.0
./contrib/download_prerequisites

2) Compile the sources (--disable-multilib option needed for 64-bit machines)
cd ~
sudo mkdir build
cd build
sudo ../gcc-6.3.0/configure --prefix=$usr/local/gcc-6.3 --enable-languages=c,c++,fortran,go --disable-multilib --program-suffix=-6.3

3) Make command for my 8-core laptop
make -j 8
sudo make install

4) Setting default gcc version (important: note option -sf, and not -s, option -s alone did not work for me)
sudo ln -sf /usr/local/gcc-6.3/bin/gcc6.3 /usr/bin/gcc

5) Edit pathdef.m
sudo gedit /usr/local/MATLAB/R2018b/toolbox/local/pathdef.m
[edit file to allow path for '/usr/techlia/lib/Matlab' ....do not use "matlabroot" in front of this path declaration]

6) Before Techila Matlab setup (to avoid error with "techiliainit")
sudo chmod -R a+rw /usr/techila/

%-------------------------------------------------------------------------------------------------------------------------
On the Matlab setup, you will receive warning concerning the path, but you can ignore it as you have
already added it to pathdef.m

Matlab Command Window excerpt:

>> cd /usr/techila/lib/Matlab
>> installsdk
Warning: Unable to save path to file '/usr/local/MATLAB/R2018b/toolbox/local/pathdef.m'. You can save your path to a
different location by calling SAVEPATH with an input argument that specifies the full path. For MATLAB to use that
path in future sessions, save the path to 'pathdef.m' in your MATLAB startup folder.
> In savepath (line 176)
In installsdk (line 9)
Following path added to matlabpath: /usr/techila/lib/Matlab
>> techilainit
ans =
0
%-------------------------------------------------------------------------------------------------------------------------

No guarantees on this solution, use at your own risk! I am a Linux newbie, and there are surely better solutions available.
Accordingly, it will be best to contact the wonderful people at Techila cloud support for further support/questions.

Cheers,
BK
bkasu
 
Posts: 1
Joined: 2019-03-27 16:48:26

Return to MATLAB

cron