LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch
User Name
Password
Linux From Scratch This Forum is for the discussion of LFS.
LFS is a project that provides you with the steps necessary to build your own custom Linux system.

Notices


Reply
  Search this Thread
Old 03-27-2007, 04:20 PM   #1
efus
Member
 
Registered: Jun 2003
Location: Odense, Denmark
Distribution: Fedora
Posts: 32

Rep: Reputation: 15
[SOLVED] cannot run C compiled programs


I am trying to build lfs 6.2 and until chapter 6.11 I had no big problems making it work.
But I can not compile binutils.

this is the error I get trying to make:

Code:
root:/sources/binutils-build# make tooldir=/usr
mkdir -p -- ./libiberty
Configuring in libiberty
configure: creating cache ./config.cache
checking whether to enable maintainer-specific portions of Makefiles... no
checking for makeinfo... makeinfo
checking for perl... perl
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking for i686-pc-linux-gnu-ar... ar
checking for i686-pc-linux-gnu-ranlib... ranlib
checking for i686-pc-linux-gnu-gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details.
make: *** [configure-libiberty] Error 1
I can't figure out how to fix this?
any ideas?

Last edited by efus; 03-28-2007 at 02:47 PM. Reason: problem solved
 
Old 03-27-2007, 04:46 PM   #2
weibullguy
ReliaFree Maintainer
 
Registered: Aug 2004
Location: Kalamazoo, Michigan
Distribution: Slackware 14.2
Posts: 2,815
Blog Entries: 1

Rep: Reputation: 261Reputation: 261Reputation: 261
Follow the directions
Quote:
See `config.log' for more details.
Find out exactly why.
 
Old 03-27-2007, 05:42 PM   #3
efus
Member
 
Registered: Jun 2003
Location: Odense, Denmark
Distribution: Fedora
Posts: 32

Original Poster
Rep: Reputation: 15
This is from the config.log

Code:
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:1809: checking for gcc
configure:1922: checking whether the C compiler (gcc  ) works
configure:1938: gcc -o conftest    conftest.c  1>&5
configure:1964: checking whether the C compiler (gcc  ) is a cross-compiler
configure:1969: checking whether we are using GNU C
configure:1978: gcc -E conftest.c
configure:1997: checking whether gcc accepts -g
configure:2064: checking for gnatbind
configure:2129: checking whether compiler driver understands Ada
configure:2162: checking how to compare bootstrapped objects
configure:2260: checking for correct version of gmp.h
configure:2273: gcc -c -g -O2   conftest.c 1>&5
configure:2263:17: error: gmp.h: No such file or directory
configure: In function 'main':
configure:2267: error: 'choke' undeclared (first use in this function)
configure:2267: error: (Each undeclared identifier is reported only once
configure:2267: error: for each function it appears in.)
configure:2267: error: syntax error before 'me'
configure: failed program was:
#line 2262 "configure"
#include "confdefs.h"
#include "gmp.h"
int main() {
I know the gmp.h is just a bsd thing.
So it must be the "choke" and "me" whitch must be the problem?

[EDIT]

line 2266-2268 in the configure file looks like this:

Code:
#if __GNU_MP_VERSION < 3
choke me
#endif
what does this mean?

Last edited by efus; 03-27-2007 at 06:06 PM.
 
Old 03-27-2007, 07:13 PM   #4
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 77
GMP is not a bsd thing, itís GNUís multiple-precision arithmetic library. It should not be needed at this point. Are you sure you configured correctly?
 
Old 03-27-2007, 07:20 PM   #5
weibullguy
ReliaFree Maintainer
 
Registered: Aug 2004
Location: Kalamazoo, Michigan
Distribution: Slackware 14.2
Posts: 2,815
Blog Entries: 1

Rep: Reputation: 261Reputation: 261Reputation: 261
As osor stated. GMP would only be needed in LFS if you want to build gcc to include the FORTRAN compiler. Did you run the configure script at all? Your original post shows that you were trying to compile binutils, but your errors are all configure script errors. I haven't built binutils in awhile and don't remember whether make calls the configure script again.
 
Old 03-27-2007, 08:04 PM   #6
efus
Member
 
Registered: Jun 2003
Location: Odense, Denmark
Distribution: Fedora
Posts: 32

Original Poster
Rep: Reputation: 15
yes I am trying to compile binutils.
I did run the config script: configure --prefix=/usr/local/stow/binutils-2.16.1 --enable-shared
 
Old 03-27-2007, 08:12 PM   #7
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 77
Are you in the chroot correctly and did you adjust the toolchain correctly (try the sanity check). Why is the prefix /usr/local/stow/binutils-2.16.1? Can you post your full configure output.

@Arow: I think binutils’ Makefile will call configure recursively in certain directories (in this case, the problem seems to be with libiberty).
 
Old 03-27-2007, 08:26 PM   #8
efus
Member
 
Registered: Jun 2003
Location: Odense, Denmark
Distribution: Fedora
Posts: 32

Original Poster
Rep: Reputation: 15
I got no errors in the sanity check.
I chroot'ed like it said in the book.

I use stow as package manager, therefor the prefix.

This is the configure output:
Code:
root:/sources/binutils-build# ../binutils-2.16.1/configure --prefix=/usr/local/stow/binutils-2.16.1 --enable-shared
loading 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... (cached) /tools/bin/install -c
checking whether ln works... (cached) yes
checking whether ln -s works... (cached) yes
checking for gcc... (cached) gcc
checking whether the C compiler (gcc  ) works... yes
checking whether the C compiler (gcc  ) is a cross-compiler... yes
checking whether we are using GNU C... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gnatbind... no
checking whether compiler driver understands Ada... (cached) no
checking how to compare bootstrapped objects... (cached) cmp --ignore-initial=16 $$f1 $$f2
checking for correct version of gmp.h... no
checking for bison... no
checking for bison... no
checking for byacc... no
checking for yacc... no
checking for gm4... (cached) m4
checking for flex... no
checking for flex... no
checking for lex... no
checking for makeinfo... (cached) makeinfo
checking for i686-pc-linux-gnu-ar... no
checking for ar... (cached) ar
checking for i686-pc-linux-gnu-as... no
checking for as... (cached) as
checking for i686-pc-linux-gnu-dlltool... no
checking for dlltool... (cached) dlltool
checking for i686-pc-linux-gnu-ld... (cached) /tools/lib/gcc/i686-pc-linux-gnu/4.0.3/../../../../i686-pc-linux-gnu/bin/ld
checking for i686-pc-linux-gnu-nm... no
checking for nm... (cached) nm
checking for i686-pc-linux-gnu-ranlib... no
checking for ranlib... (cached) ranlib
checking for i686-pc-linux-gnu-windres... no
checking for windres... (cached) windres
checking for i686-pc-linux-gnu-objcopy... no
checking for objcopy... (cached) objcopy
checking for i686-pc-linux-gnu-objdump... no
checking for objdump... (cached) objdump
checking for i686-pc-linux-gnu-ar... no
checking for ar... (cached) ar
checking for i686-pc-linux-gnu-as... no
checking for as... (cached) as
checking for i686-pc-linux-gnu-dlltool... no
checking for dlltool... (cached) dlltool
checking for i686-pc-linux-gnu-ld... no
checking for ld... (cached) ld
checking for i686-pc-linux-gnu-nm... no
checking for nm... (cached) nm
checking for i686-pc-linux-gnu-ranlib... no
checking for ranlib... (cached) ranlib
checking for i686-pc-linux-gnu-windres... no
checking for windres... (cached) windres
checking whether to enable maintainer-specific portions of Makefiles... no
checking if symbolic links between directories work... (cached) yes
creating ./config.status
creating Makefile
It says "no" to a lot of things?
 
Old 03-28-2007, 05:35 AM   #9
efus
Member
 
Registered: Jun 2003
Location: Odense, Denmark
Distribution: Fedora
Posts: 32

Original Poster
Rep: Reputation: 15
This is not only a problem when I try to make binutils.
I get the same error at every make.
 
Old 03-28-2007, 02:51 PM   #10
efus
Member
 
Registered: Jun 2003
Location: Odense, Denmark
Distribution: Fedora
Posts: 32

Original Poster
Rep: Reputation: 15
The problem was this:

checking whether the C compiler (gcc ) is a cross-compiler... yes

gcc should not be a cross-compiler.
I solved this by rebuilding glibc. Something must have been wrong with the other build.
 
Old 02-23-2012, 01:53 AM   #11
zazuke58
LQ Newbie
 
Registered: Feb 2012
Posts: 1

Rep: Reputation: Disabled
Reconstruiste glibc from the first phase or the chapter 6.9?
 
Old 03-01-2012, 02:52 PM   #12
TKH
Member
 
Registered: Jul 2011
Location: Milky Way
Distribution: Ubuntu, LFS, Slackware, Fedora
Posts: 223

Rep: Reputation: 20
It would be a good thing if you start looking at the problem with as least work as possible.

Several easy steps:
1. Have you chrooted correctly? Try running mount and see what is up.
2. Have you clear out all the compiler variables (LDFLAGS, CC, CFLAGS, etc...) check them with env.
3. Is the toolchain working properly? Look at the section 5.8 (correct me if I'm wrong) which covers the toolchain stuff.

I hope these can help.
 
  


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
C compiler cannot run C compiled programs petero Programming 8 05-27-2005 12:35 PM
error: cannot run C compiled programs. terry.trent Linux - Newbie 6 08-06-2004 12:07 AM
why ./ is used to run C++ compiled programs legend1079 Red Hat 4 03-23-2004 07:32 AM
"Can't run C compiled programs" on clean RH9 install smirnoff Linux - Newbie 8 03-16-2004 04:11 PM
cannot run C compiled programs Astro Slackware 7 01-27-2004 11:32 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch

All times are GMT -5. The time now is 10:41 AM.

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