# gcc installed successfully but its Command not found



## anti (Feb 20, 2014)

I have install gcc successfully using: lang/gcc44

And I also tried also:
`pkg install gcc`

But when I try to use it the following appears:

```
gcc: Command not found.
```
When I issue `pkg install gcc` it shows:

```
Updating repository catalogue
gcc-4.6.4 already installed
```

I am using FreeBSD 10.0.


----------



## SirDice (Feb 20, 2014)

It'll be gcc44 to prevent clashes with gcc46 and gcc48.


----------



## anti (Feb 20, 2014)

SirDice said:
			
		

> It'll be gcc44 to prevent clashes with gcc46 and gcc48.



How could I set gcc = gcc44 & g++ = g++44 ?


----------



## SirDice (Feb 20, 2014)

http://www.freebsd.org/doc/en/articles/ ... ticle.html


----------



## anti (Feb 20, 2014)

SirDice said:
			
		

> http://www.freebsd.org/doc/en/articles/custom-gcc/article.html


 I did:

```
CC=gcc44
gcc=gcc44
CXX=g++44
g++=g++44
CPP=cpp44
```
 in `/etc/make.conf`

and still `gcc` shows:



> gcc: Command not found.


----------



## SirDice (Feb 20, 2014)

There will never be a command gcc. If you really need one just create an alias: `alias gcc gcc44`.


----------



## anti (Feb 20, 2014)

SirDice said:
			
		

> There will never be a command gcc. If you really need one just create an alias: `alias gcc gcc44`.



The issue is I am trying to compile a program source using `gmake`, it always shows these errors:



> gmake: g++: Command not found
> gmake: *** [monitor_client.o] Error 127


----------



## ShelLuser (Feb 20, 2014)

Then it seems either something is going haywire with your search path or your base system is messed up. Because those commands are normally part of the base system (do keep in mind that I'm mostly referring to FreeBSD 9.x here, I am confident the same applies for FreeBSD 10 but I haven't experimented with that release yet).

So first of all try using this command: `echo $PATH` and see what it says. If /usr/bin is mentioned then the problem lies elsewhere. Check /usr/bin. Under normal circumstances it should have commands such as gcc, cc, g++ and so on.

Is it possible that you rebuild your base system yourself and tweaked things in src.conf?

Edit:

Forgot to mention; obviously if /usr/bin isn't mentioned in the PATH output then that's the cause of your problems. Make sure /usr/bin gets included and everything should work normally once again.


----------



## ph0enix (Feb 20, 2014)

ShelLuser said:
			
		

> Then it seems either something is going haywire with your search path or your base system is messed up. Because those commands are normally part of the base system (do keep in mind that I'm mostly referring to FreeBSD 9.x here, I am confident the same applies for FreeBSD 10 but I haven't experimented with that release yet).
> 
> So first of all try using this command: `echo $PATH` and see what it says. If /usr/bin is mentioned then the problem lies elsewhere. Check /usr/bin. Under normal circumstances it should have commands such as gcc, cc, g++ and so on.
> 
> ...



gcc is not part of FreeBSD 10 so the commands won't be there.   I'm guessing that's what the OP is using.


----------



## kpa (Feb 20, 2014)

If the compiler is called gcc44 (or g++44 for C++) you have tell devel/gmake and the related utilities that the compiler is called something else than the usual.

`gmake CC=gcc44 CXX=g++44 CPP="gcc44 -E"`

If it still doesn't work I'd guess that the Makefile you have hardcodes the name to gcc (stupid practice but I've seen it done).


----------



## freethread (Feb 21, 2014)

On FreeBSD 10.0 gcc is no more part of the system, all gcc version installed from ports are versioned, that is gcc 4.6 is installed as gcc46, g++46, etc., so creating a symlink in /usr/local/bin should be fine (as root)

`# cd /usr/local/bin
# ln -s gcc46 gcc
# ln -s g++46 g++`

I think there are no side effects


----------



## ShelLuser (Feb 21, 2014)

ph0enix said:
			
		

> gcc is not part of FreeBSD 10 so the commands won't be there.   I'm guessing that's what the OP is using.


True, but Clang is part of the system. I don't know about g++ but from what I've been reading I get the impression that commands like cc should still be normally available, but instead of firing up GCC it's now using Clang. But then again I think that also differs per architecture (think i386 vs. amd64 for example).


----------



## anti (Jan 29, 2015)

What about FreeBSD 10.1, is gcc apart of 10.1?


----------



## jmccue (Jan 29, 2015)

anti said:


> What about FreeBSD 10.1, is gcc apart of 10.1?


No, `gcc` is no longer in FreeBSD base starting with 10.0


----------

