Did you know LQ has a Linux Hardware Compatibility List?
Go Back > Forums > Linux Forums > Linux - Software
User Name
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.


Search this Thread
Old 09-23-2008, 12:50 AM   #1
LQ Newbie
Registered: Sep 2008
Posts: 6

Rep: Reputation: 0
GCC build error on Ubuntu 7.04

Hi all,

Iam trying to build gcc4.0.3 from source and iam getting following err on ubuntu 7.04

gcc installation
lfs@ubuntu:/mnt/lfs/sources/gcc-build$ time { $LFS/sources/gcc-4.0.3/configure --prefix=/tools --with-local-prefix=/tools --disable-nls \
> --enable-shared --enable-languages=c
> }
creating cache ./config.cache
checking host system type... i686-pc-linux-gnu
checking target system type... i686-pc-linux-gnu
checking build system type... i686-pc-linux-gnu
checking for a BSD compatible install... /usr/bin/install -c
checking whether ln works... yes
checking whether ln -s works... yes
checking for gcc... gcc
checking whether the C compiler (gcc ) works... no
configure: error: installation or configuration problem: C compiler cannot create executables.

real 0m2.698s
user 0m0.150s
sys 0m0.340s
Following is the config.log contents :

This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

configure:595: checking host system type
configure:616: checking target system type
configure:634: checking build system type
configure:689: checking for a BSD compatible install
configure:742: checking whether ln works
configure:766: checking whether ln -s works
configure:1808: checking for gcc
configure:1921: checking whether the C compiler (gcc  ) works
configure:1937: gcc -o conftest    conftest.c  1>&5
/tools/bin/ld: unrecognized option '--hash-style=both'
/tools/bin/ld: use the --help option for usage information
collect2: ld returned 1 exit status
configure: failed program was:

#line 1932 "configure"
#include "confdefs.h"

I need to understand the whole lot of working of gcc or at least how c compiler works , without which understang in bits nd pieces will not help, towards this i hope someone could give me a good link or book to read it, even if that means dwelling into proramming in linux.

Iam googling this stuff also.

Thnks in advance
Old 09-23-2008, 06:14 AM   #2
ReliaFree Maintainer
Registered: Aug 2004
Location: Kalamazoo, Michigan
Distribution: Slackware-current, Cross Linux from Scratch, Gentoo
Posts: 2,753
Blog Entries: 1

Rep: Reputation: 238Reputation: 238Reputation: 238
It appears you're still using your host's gcc instead of the one at /tools/bin/gcc. Perhaps you missed the /tools/bin/cc -> gcc symlink? Maybe /tools/bin is not at the beginning of your PATH? What's the output of `which cc' and `which gcc'?
Old 09-23-2008, 07:07 AM   #3
LQ Newbie
Registered: Sep 2008
Posts: 6

Original Poster
Rep: Reputation: 0
Hi weibullguy ,

Following are my findings :

Yes the gcc and cc are still using the hosts path :
lfs@ubuntu:~$ which gcc
lfs@ubuntu:~$ which cc
lfs@ubuntu:~$ echo $PATH
lfs@ubuntu:~$ pwd
And so far i have only installed binutils, and iam tryg' to compile gcc
from source, so gcc and cc availability in /tools/bin will not be possible , untill i make a hard/soft link to gcc and cc in /usr of the host.

But now see this , iam compiling successfully using the same cc as above, an exmple C program of hello world, from my home dir. The other point is the /usr is there in the path value, the lfs user is using, as shown above :

vikku@ubuntu:~$ /usr/bin/cc --verbose dummy.c
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v --enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --program-suffix=-4.1 --enable-__cxa_atexit --enable-clocale=gnu --enable-libstdcxx-debug --enable-mpfr --enable-checking=release i486-linux-gnu
Thread model: posix
gcc version 4.1.2 (Ubuntu 4.1.2-0ubuntu4)
 /usr/lib/gcc/i486-linux-gnu/4.1.2/cc1 -quiet -v dummy.c -quiet -dumpbase dummy.c -mtune=generic -auxbase dummy -version -fstack-protector -fstack-protector -o /tmp/ccFRM5ch.s
ignoring nonexistent directory "/usr/local/include/i486-linux-gnu"
ignoring nonexistent directory "/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../i486-linux-gnu/include"
ignoring nonexistent directory "/usr/include/i486-linux-gnu"
#include "..." search starts here:
#include <...> search starts here:
End of search list.
GNU C version 4.1.2 (Ubuntu 4.1.2-0ubuntu4) (i486-linux-gnu)
        compiled by GNU C version 4.1.2 (Ubuntu 4.1.2-0ubuntu4).
GGC heuristics: --param ggc-min-expand=44 --param ggc-min-heapsize=27942
Compiler executable checksum: c0d954aeefbb96d795ff3f6b3b72ef51
dummy.c: In function ‘main’:
dummy.c:3: warning: return type of ‘main’ is not ‘int’
 as -V -Qy -o /tmp/ccSAvrP7.o /tmp/ccFRM5ch.s
GNU assembler version 2.17.50 (i486-linux-gnu) using BFD version 2.17.50 20070103 Ubuntu
 /usr/lib/gcc/i486-linux-gnu/4.1.2/collect2 --eh-frame-hdr -m elf_i386 --hash-style=both -dynamic-linker /lib/ /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../lib/crt1.o /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../lib/crti.o /usr/lib/gcc/i486-linux-gnu/4.1.2/crtbegin.o -L/usr/lib/gcc/i486-linux-gnu/4.1.2 -L/usr/lib/gcc/i486-linux-gnu/4.1.2 -L/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../lib -L/lib/../lib -L/usr/lib/../lib /tmp/ccSAvrP7.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/i486-linux-gnu/4.1.2/crtend.o /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../lib/crtn.o

vikku@ubuntu:~$ ./a.out
Hello World

So making a symlink , iam not sure will help or not.

Old 09-23-2008, 07:45 AM   #4
LQ Newbie
Registered: Sep 2008
Posts: 6

Original Poster
Rep: Reputation: 0
Also the line failing as per config.log is
line 1932

which is
#include "confdefs.h"

now i checked the dir /usr/include and there is no such header file :

vikku@ubuntu:/usr/include$ ls [Cc]*
complex.h  cpio.h  crypt.h  ctype.h

4.1  4.1.2

So how can i have this header in place ?

I have following already installed :
vikku@ubuntu:/usr/include$ dpkg -l |grep header
ii  linux-headers-2.6.20-15               2.6.20-15.27                              Header files related to Linux kernel version
ii  linux-headers-2.6.20-15-server        2.6.20-15.27                              Linux kernel headers for version 2.6.20 on x
ii  linux-headers-2.6.20-17               2.6.20-17.37                              Header files related to Linux kernel version
ii  linux-headers-2.6.20-17-generic       2.6.20-17.37                              Linux kernel headers for version 2.6.20 on x
ii  linux-headers-generic                                     Generic Linux kernel headers


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 build error lukeiamyourfather Linux From Scratch 5 01-05-2008 12:01 PM
Ubuntu 7.04 - Error Apt-Getting Build-Essential Peatmoss Ubuntu 5 12-11-2007 07:42 PM
Ubuntu gcc error immortaltechnique Linux - Software 2 11-12-2007 09:38 AM
Gcc Build error: target=Mips Kcghost Programming 2 05-19-2006 12:23 AM
GCC first build for LFS, bootstrap error Blibblob Linux From Scratch 8 01-07-2004 06:50 PM

All times are GMT -5. The time now is 12:09 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration