downgrade gcc-version to compile mex-files for matlab???
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
downgrade gcc-version to compile mex-files for matlab???
I am trying to run matlab 7.7 (R2008b) on my ubuntu 9.10 distribution..the thing is that I am totally new with both matlab and linux and I get the following error message from matlab when I try to run an example mex-function:
Warning: You are using gcc version "". The earliest gcc version supported
with mex is "4.0.0". The latest version tested for use with mex is "4.2.0".
To download a different version of gcc, visit http://gcc.gnu.org
eval: 1: gcc: Permission denied
mex: compile of ' "yprime.c"' failed.
??? Error using ==> mex at 213
Unable to complete successfully.
I had gcc-4.4 as default on my pc, so after this error I downloaded an older version (gcc-4.1) and removed with rm the symbolic link in /usr/bin pointing to gcc-4.4 and created a new one pointing to gcc-4.1. Now when I type gcc -v in the terminal it says that gcc is in the packages gcc and pentium-builder, suggesting to do an apt-get install. I tried that but than it says that gcc-4.1 is already the newest version.
Can anyone help me please? It seems that I have multiple versions of gcc installed but neither the terminal nor matlab can find them. What did I wrong? and HOW can I solve it???
I'm not sure what do you mean with file, I tried this:
~$ ls -l 'file /usr/bin/gcc*'
ls: cannot access file /usr/bin/gcc*: No such file or directory
~$ gcc -v
The program 'gcc' can be found in the following packages:
* gcc
* pentium-builder
Try: sudo apt-get install <selected package>
gcc: command not found
~$ sudo apt-get install gcc-4.1
[sudo] password for margareta:
Reading package lists... Done
Building dependency tree
Reading state information... Done
gcc-4.1 is already the newest version.
The following packages were automatically installed and are no longer required:
linux-headers-2.6.31-14 libgmp3-dev libgmpxx4ldbl libncurses5-dev
linux-headers-2.6.31-14-generic
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
As you can see, when I try to reinstall it says that I already have the newest version..any idea what's the problem?
~$ gcc-4.1 -v
The program 'gcc-4.1' can be found in the following packages:
* hardening-wrapper
* gcc-4.1
Try: sudo apt-get install <selected package>
gcc-4.1: command not found
~$ sudo apt-get install gcc-4.1
[sudo] password for margareta:
Reading package lists... Done
Building dependency tree
Reading state information... Done
gcc-4.1 is already the newest version.
The following packages were automatically installed and are no longer required:
linux-headers-2.6.31-14 libgmp3-dev libgmpxx4ldbl libncurses5-dev
linux-headers-2.6.31-14-generic
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
So it isn't installed properly or the symbolic link is the problem?
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,513
Rep:
There is nothing in /usr/src/ , to be used as a compiler.
Files in /usr/src/ are most often source code only.
Suggest : 1) delete the alien link in /usr/bin ( = gcc )
2) Reinstall the required package(s) with "Synaptic".
Synaptic can reinstall packages.
"sudo apt-get install" cannot be used for reinstall.
The default is still "gcc" ( = gcc-4.4 ). Can also be installed.
Using e.g. gcc-4.1 , example : make CC=gcc-4.1
.....
Knowing which packages, you have installed : See "Synaptic".
Or use the command :
dpkg --get-selections \* > selections.txt
Or : dpkg --get-selections > selections.txt
.. which will save the text file selections.txt in /home/<user>/
.....
~$ file /usr/bin/gcc*
/usr/bin/gcc: symbolic link to `/usr/src/gcc-4.1'
/usr/bin/gcc-4.4: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.15, stripped
/usr/bin/gccbug-4.1: POSIX shell script text executable
~$ file /usr/src/gcc*
/usr/src/gcc-4.1: directory
Does that mean that the symbolic link should go inside the folder?
The symbolic link should point to the gcc executable. Otherwise the link /usr/bin/gcc will act like the directory /usr/src/gcc-4.1, which is not what you want. Either you reinstall gcc-packages, as suggested by knudfl, or you change /usr/bin/gcc to point to the correct gcc executable.
Btw: Why does the link /usr/bin/gcc point to /usr/src? Did you try to compile gcc yourself? In this case you need to do a 'sudo make install' in the source folder too.
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,513
Rep:
# 10
Quote:
In this case you need to do a 'sudo make install'
in the source folder too.
I would not do that. May prevent a regularly installed
gcc from working :
All gcc-4.x are sharing the same libgcc**
And a new libgcc** may not work with any of those.
Better stick to the gcc selection in Synaptic.
.....
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.