LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   "No C compiler found in $PATH" - why not? (https://www.linuxquestions.org/questions/linux-newbie-8/no-c-compiler-found-in-%24path-why-not-585014/)

tengun 09-16-2007 02:17 AM

"No C compiler found in $PATH" - why not?
 
I know this has probably been asked multiple times before, but:

I installed gcc (GNU c compiler) v 2.95 from CNR so that I could compile sodipodi. However, after it was installed to /usr/bin/, I found that ./configure still kept telling me "$no acceptable c complier found in $PATH". So, I created a symlink to gcc, still got an error, even copied the binary from /usr/bin to sodipodi's directory, hoping that that would put a c compiler in $PATH, and ran ./configure again. Still no acceptable c compiler found in $PATH.

How do I set gcc as my default c compiler so that ./configure will stop giving me this error? I'm using Linspire, by the way, if you hadn't already figured that out when I mentioned "CNR".

PatrickNew 09-16-2007 02:28 AM

Go to a terminal and type "echo $PATH" without the quotes and see if /usr/bin is in it. If all else fails, you could try a symlink in /bin, but /usr/bin should be in everyone's path. Hrmm.

tengun 09-16-2007 02:40 AM

This is the output...

/bin:/usr/bin:/sbin:/usr/sbin:/usr/X11R6/bin:/usr/bin:/usr/share/qt3/bin

I don't quite understand it. /usr/bin/ is the second path in $PATH. Do the paths need to be in a different order? If so, how do I set $PATH?

Edit:
I created a symlink to gcc in /bin, but it didn't satisfy ./configure.

colucix 09-16-2007 03:10 AM

The problem can be related to the fact that the available gcc compiler is not suitable to the compilation for some reason. Maybe a too old version? Anyway, to force using a compiler you can define the environment variable
Code:

export CC=gcc
before launching ./configure. Second, would be useful to inspect the gcc executable by
Code:

file gcc
you should obtain something like (if you are on a 32-bit machine)
Code:

/usr/bin/gcc-4.1: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.6.4, dynamically linked (uses shared libs), for GNU/Linux 2.6.4, stripped
if not, probably something went wrong when installing the compiler.

tengun 09-16-2007 02:00 PM

Well, I tried force CC=gcc, and it did recognize gcc. However, it then told me that my "C compiler cannot create executables".

When I ran file, the output was:

Quote:

gcc-2.95: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.2.0, dynamically linked (uses shared libs), stripped
So, since I knew I might be able to use apt-get to find a more recent binary, I issued
Code:

apt-get install gcc-4.1
...however, apt-get couldn't find the package.


I am using gcc version 2.95 (I have no idea why CNR would have an outdated version, and the most recent one they have is version 3.4) - where can I find a more recent binary?

colucix 09-16-2007 05:12 PM

Quote:

Originally Posted by tengun (Post 2893869)
So, since I knew I might be able to use apt-get to find a more recent binary, I issued
Code:

apt-get install gcc-4.1
...however, apt-get couldn't find the package.

Hmmm... I'm not used to apt-get, nor I know about Linspire distribution, but you can try
Code:

apt-get install gcc
without version number, or
Code:

apt-get install build-essential
then report exactly any eventual error message. I'm sure some other member more experienced than me about apt-get can help to go through this issue. Cheers!

tengun 09-16-2007 08:40 PM

Code:

dell:~# apt-get install gcc
Reading Package Lists... Done
Building Dependency Tree... Done
Package gcc is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package gcc has no installation candidate

Code:

dell:~# apt-get install build-essential
Reading Package Lists... Done
Building Dependency Tree... Done
E: Couldn't find package build-essential
dell:~#

Hmm... the package is "missing, has been obsoleted, or
is only available from another source"?

tengun 09-22-2007 04:20 PM

Update: I uninstalled my old, outdated version of GCC and replaced it with a less obsolete version (3.4). I set it as the default with "export CC=gcc", and it gave me the same error until I copied the "gcc-3.4" file to just "gcc". Then configure ran fine, generating a couple screens worth of output, and all seemed to be fine until the end. Configure just required me to have gcc, g++, gpp and pkg-config, and they had to be those exact names or configure wouldn't find them (mine had names like gcc-3.4 and g++-3.4). My cpp wasn't sane because I didn't have the GNU c++ compiler, g++ (which presumably told gpp how to function).

To make a long story short, I got it solved, and if anyone using the Linspire distro has my problem, they should visit my CNR aisle.


All times are GMT -5. The time now is 05:32 AM.