Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gcc error trying to exec 'cc1': execvp: No such file or directory when running with non-root user

Tags:

c++

c

gcc

g++

ubuntu

I see that same question has been asked many times but my problem is different.

I installed gcc on ubuntu 14.04 and and it works fine with root user. When I attempt to compile using non-root user it throws

error gcc: error trying to exec 'cc1': execvp: No such file or directory

Once I compile the file with root user, non-root user is able to execute the file without any error but it is not able to compile the file.

I suspect there is a problem with file permissions and I have checked permissions for cc1 and non root user had execute permission on the file.

like image 961
Somil Bhandari Avatar asked May 20 '15 08:05

Somil Bhandari


1 Answers

First way:

Under the root account use the command:

which gcc

which cc1

ls -l $Output of previous command

It will show you where are cc1 and gcc and rights of cc1
Check that you have proper rights for cc1 file

Then under "regular" user:

which gcc

Output of which gcc should be the same as for root.

If right is ok and path to gcc the same as under the root, add PATH to cc1 for user.

Second way:

Under the root account:

gcc -v hello_world.c 2>&1 | grep cc1

And do the same under the "regular" account.

It will show you the real commands that was used for compilation.

Compare them and check rights and PATH as in first way


To add PATH use: export PATH=$PATH:$add_new_path_to_folder_here

like image 199
Laser Avatar answered Oct 29 '22 16:10

Laser