Yep it finds it when you set GCC_EXEC_PREFIX env variable to the gcc directory
Maybe the search path could be shortened to '/usr/lib/gcc/'
Try:
Code:
GCC_EXEC_PREFIX=/usr/lib/gcc/ gcc -print-prog-name=cc1
If it gives cc1 full path, then try compile your program like:
Code:
export GCC_EXEC_PREFIX=/usr/lib/gcc/
gcc -o test test.c
./test
Or in onliner
Code:
GCC_EXEC_PREFIX=/usr/lib/gcc/ gcc -o test test.c
If /usr/lib/gcc/ doesn't work as search path, you will need to set GCC_EXEC_PREFIX to /usr/lib/gcc/x86_64-linux-gnu
At this point, maybe export GCC_EXEC_PREFIX in ~/.bashrc or ~/.bash_profile (will need logout and login), so you won't need to set GCC_EXEC_PREFIX each time you want to compile a program.
I still wonder why gcc is not able to search in the correct path as it should be, maybe further infos are needed
Code:
whereis gcc
which -a gcc
# or maybe something in the environment?
env