LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 05-18-2016, 04:58 PM   #16
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,325

Rep: Reputation: 760Reputation: 760Reputation: 760Reputation: 760Reputation: 760Reputation: 760Reputation: 760

Ok it is where it should be (If I follow the --prefix=/usr from gcc -v output)
Now the question is why does gcc search programs in /usr/local?

Could you show output with:
Code:
echo $GCC_EXEC_PREFIX
Code:
GCC_EXEC_PREFIX=/usr/lib/gcc/x86_64-linux-gnu gcc -print-prog-name=cc1

Last edited by keefaz; 05-18-2016 at 05:04 PM.
 
1 members found this post helpful.
Old 05-18-2016, 08:19 PM   #17
djohan
LQ Newbie
 
Registered: Oct 2014
Location: La Honda, California
Distribution: Red Hat 9.0, Precise Puppy 5.7.1
Posts: 12

Original Poster
Rep: Reputation: Disabled
Hi keefaz: Here is response-

don@don-Precision-M2800:~/CREATE3d$
don@don-Precision-M2800:~/CREATE3d$ echo $GCC_EXEC_PREFIX

don@don-Precision-M2800:~/CREATE3d$ GCC_EXEC_PREFIX=/usr/lib/gcc/x86_64-linux-gnu gcc -print-prog-name=cc1
/usr/lib/gcc/x86_64-linux-gnu/4.6/cc1
don@don-Precision-M2800:~/CREATE3d$

Don
 
1 members found this post helpful.
Old 05-18-2016, 08:46 PM   #18
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,325

Rep: Reputation: 760Reputation: 760Reputation: 760Reputation: 760Reputation: 760Reputation: 760Reputation: 760
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

Last edited by keefaz; 05-18-2016 at 08:59 PM.
 
1 members found this post helpful.
Old 05-18-2016, 09:30 PM   #19
djohan
LQ Newbie
 
Registered: Oct 2014
Location: La Honda, California
Distribution: Red Hat 9.0, Precise Puppy 5.7.1
Posts: 12

Original Poster
Rep: Reputation: Disabled
NOW it works!

don@don-Precision-M2800:~/CREATE3d$ export GCC_EXEC_PREFIX=/usr/lib/gcc/
don@don-Precision-M2800:~/CREATE3d$ gcc -o test test.c
don@don-Precision-M2800:~/CREATE3d$ ./test
Hello World!
don@don-Precision-M2800:~/CREATE3d$

Have not tried method #2, but I will test next time with a fresh login.

Thanks
Don
 
  


Reply


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
gcc: installation problem, cannot exec `cc1': No such file or directory digimars Linux - General 2 11-25-2008 03:17 AM
gcc: installation problem, cannot exec `cc1': No such file or directory Error Message 08h Programming 2 07-20-2006 12:44 PM
gcc: installation problem, cannot exec `cc1': No such file or directory natsirc Linux - General 3 11-11-2004 10:26 AM
gcc: installation problem, cannot exec `cc1': No such file or directory Error Message 08h Linux - Newbie 1 06-01-2004 05:26 AM
gcc: Internal compiler error: program cc1 got fatal signal 11 smj Linux - Software 2 02-20-2003 11:35 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:17 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
Open Source Consulting | Domain Registration