LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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


Reply
  Search this Thread
Old 02-22-2010, 01:54 PM   #1
margarita333
LQ Newbie
 
Registered: Feb 2010
Posts: 4

Rep: Reputation: Disabled
Question 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:

>> mex yprime.c

/home/margareta/Desktop/matlab/bin/mex: 1572: gcc: Permission denied

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???
 
Old 02-22-2010, 03:09 PM   #2
irmin
Member
 
Registered: Jan 2010
Location: the universe
Distribution: Slackware (modified), Slackware64 (modified), openSuSE (modified)
Posts: 342

Rep: Reputation: 62
Can you provide the output of 'ls -l /usr/bin/gcc*' and 'file /usr/bin/gcc*'?
 
Old 02-22-2010, 03:36 PM   #3
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2017 CentOS6.9 CentOS7.3 + 50+ other Linux OS, for test only.
Posts: 16,735

Rep: Reputation: 3317Reputation: 3317Reputation: 3317Reputation: 3317Reputation: 3317Reputation: 3317Reputation: 3317Reputation: 3317Reputation: 3317Reputation: 3317Reputation: 3317
Default for Ubuntu 9.10 Karmic is gcc-4.4.1 .

You can have as many compilers (gcc, g++, etc. )
installed at the same time, as you want.

sudo apt-get install gcc-4.3 gcc-4.2 gcc-4.1
.. provides the compilers in the repo.

Suggest : use gcc-4.1 ( gcc-4.2 is version 4.2.4 ).
.....
 
Old 02-22-2010, 04:33 PM   #4
margarita333
LQ Newbie
 
Registered: Feb 2010
Posts: 4

Original Poster
Rep: Reputation: Disabled
hey guys, thanks for helping me..ok the output is:

~$ ls -l /usr/bin/gcc*
lrwxrwxrwx 1 root root 16 2010-02-20 15:23 /usr/bin/gcc -> /usr/src/gcc-4.1
-rwxr-xr-x 1 root root 220484 2010-01-10 16:56 /usr/bin/gcc-4.4
-rwxr-xr-x 1 root root 16288 2009-08-27 14:03 /usr/bin/gccbug-4.1

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?

 
Old 02-22-2010, 04:39 PM   #5
smeezekitty
Senior Member
 
Registered: Sep 2009
Location: Washington U.S.
Distribution: M$ Windows / Debian / Ubuntu / DSL / many others
Posts: 2,339

Rep: Reputation: 231Reputation: 231Reputation: 231
Code:
gcc-4.1 -v
 
Old 02-22-2010, 04:40 PM   #6
irmin
Member
 
Registered: Jan 2010
Location: the universe
Distribution: Slackware (modified), Slackware64 (modified), openSuSE (modified)
Posts: 342

Rep: Reputation: 62
Quote:
ls -l 'file /usr/bin/gcc*'
the correct command is without the quotes and the ls -l: file /usr/bin/gcc*
Are you sure that '/usr/src/gcc-4.1' is the correct target for gcc?

Post the output of 'file /usr/src/gcc*' too (without the quotes).
 
Old 02-23-2010, 03:47 AM   #7
margarita333
LQ Newbie
 
Registered: Feb 2010
Posts: 4

Original Poster
Rep: Reputation: Disabled
hey irmin..

~$ 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?
 
Old 02-23-2010, 03:50 AM   #8
margarita333
LQ Newbie
 
Registered: Feb 2010
Posts: 4

Original Poster
Rep: Reputation: Disabled
I also tried the version option:

~$ 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?
 
Old 02-23-2010, 09:24 AM   #9
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2017 CentOS6.9 CentOS7.3 + 50+ other Linux OS, for test only.
Posts: 16,735

Rep: Reputation: 3317Reputation: 3317Reputation: 3317Reputation: 3317Reputation: 3317Reputation: 3317Reputation: 3317Reputation: 3317Reputation: 3317Reputation: 3317Reputation: 3317
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>/
.....
 
Old 02-23-2010, 11:11 AM   #10
irmin
Member
 
Registered: Jan 2010
Location: the universe
Distribution: Slackware (modified), Slackware64 (modified), openSuSE (modified)
Posts: 342

Rep: Reputation: 62
Quote:
Originally Posted by margarita333 View Post
hey irmin..

~$ 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.
 
Old 02-23-2010, 02:20 PM   #11
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2017 CentOS6.9 CentOS7.3 + 50+ other Linux OS, for test only.
Posts: 16,735

Rep: Reputation: 3317Reputation: 3317Reputation: 3317Reputation: 3317Reputation: 3317Reputation: 3317Reputation: 3317Reputation: 3317Reputation: 3317Reputation: 3317Reputation: 3317
# 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.
.....
 
  


Reply

Tags
downgrade, matlab


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Error compiling mex files for matlab using make. zest n zeal Linux - Newbie 1 01-30-2009 02:50 PM
Downgrade GCC to lower version Freelander Red Hat 1 10-02-2007 11:40 PM
Wrong GCC version during compile? raid517 Linux - Software 4 09-14-2005 09:46 AM
help to many linux version for mex oziwizzard Linux - Newbie 3 09-08-2005 02:51 PM
downgrade of GCC version nelnel Linux - Software 7 06-29-2005 02:10 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:25 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration