LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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 11-14-2010, 05:47 AM   #1
linuxquestions2010
LQ Newbie
 
Registered: Nov 2010
Posts: 13

Rep: Reputation: Disabled
Exclamation 5.5 GCC-4.5.1 - Pass 1 - c99 mode compilation error - openSUSE (host)


Can anyone please suggest any fix for the following compilation error.
I am at the 5.5 GCC-4.5.1 Pass 1 section of LFS book.
Host is openSUSE 11.3

Error:
Code:
gcc -DHAVE_CONFIG_H -I. -I../../gcc-4.5.1/mpc  -DNDEBUG    -Wall -Wextra -Wno-deprecated-declarations -Wmissing-prototypes -Wdeclaration-after-statement -Wshadow -Wpointer-arith -Wstrict-prototypes -Wcast-qual -Wwrite-strings -g -O2 -MT src_mpc-main.o -MD -MP -MF .deps/src_mpc-main.Tpo -c -o src_mpc-main.o `test -f 'src/main.c' || echo '../../gcc-4.5.1/mpc/'`src/main.c
../../gcc-4.5.1/mpc/src/main.c: In function 'find_command':
../../gcc-4.5.1/mpc/src/main.c:199:2: error: 'for' loop initial declarations are only allowed in C99 mode
../../gcc-4.5.1/mpc/src/main.c:199:2: note: use option -std=c99 or -std=gnu99 to compile your code
make[3]: *** [src_mpc-main.o] Error 1
make[3]: Leaving directory `/mnt/lfs/sources/gcc-build/mpc'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/mnt/lfs/sources/gcc-build/mpc'
make[1]: *** [all-mpc] Error 2
make[1]: Leaving directory `/mnt/lfs/sources/gcc-build'
make: *** [all] Error 2
Output of Prerequisites check:
Code:
bash version-check.sh             
bash, version 4.1.7(1)-release                             
/bin/sh -> /bin/bash                                       
Binutils: (GNU Binutils; openSUSE 11.3) 2.20.0.20100122-6  
bison (GNU Bison) 2.4.1
/usr/bin/yacc -> /usr/bin/yacc
bzip2,  Version 1.0.5, 10-Dec-2007.
Coreutils:  7.1
diff (GNU diffutils) 2.8.7-cvs
find (GNU findutils) 4.4.2
GNU Awk 3.1.6
/usr/bin/awk -> /bin/gawk
gcc (SUSE Linux) 4.5.0 20100604 [gcc-4_5-branch revision 160292]
GNU C Library stable release version 2.11.2 (20100531)
GNU grep 2.5.4
gzip 1.3.13
Linux version 2.6.34-12-default (geeko@buildhost) (gcc version 4.5.0 20100604 [gcc-4_5-branch revision 160292] (SUSE Linux) ) #1 SMP 2010-06-29 02:39:08 +0200
m4 (GNU M4) 1.4.13
GNU Make 3.81
GNU patch 2.6.1.81-5b68
Perl version='5.12.1';
GNU sed version 4.1.5
tar (GNU tar) 1.23
Texinfo: makeinfo (GNU texinfo) 4.13
Compilation OK
 
Old 11-15-2010, 05:19 PM   #2
vda
LQ Newbie
 
Registered: Aug 2004
Location: Auburn, Alabama
Distribution: Bodhi, Saltfire
Posts: 4

Rep: Reputation: 0
Post C99 Compiler troubles

Note line three of your first log ...

../../gcc-4.5.1/mpc/src/main.c:199:2: note: use option -std=c99 or -std=gnu99 to compile your code

The problem is indicated by line 2 of the same code ... a for loop contains a declaration which is not allowed unless you are using the newer compiler ... probably by now it is assumed that everyone has C99 specified ... LFS is a learning experience so you will need to dig about in compiler related stuff to figure out exactly where the -std=c99 should be hidden. Having done LFS several times, it is best to read through everything be fore you start.

Just a wild guess ...
5.5.1 builds a minimal compiler which will compile itself and the pieces it needs but not much else ... note the switch settings of stuff it is not to build ... make sure those are right, if they are, find the line in the code which has the offending for loop, then trace backwards to discover which switch is needed to turn off the compiling of that section. You might need to add that switch and notify your LFS friends - after testing the resulting compiler by finishing your project ...
 
Old 11-16-2010, 01:43 AM   #3
linuxquestions2010
LQ Newbie
 
Registered: Nov 2010
Posts: 13

Original Poster
Rep: Reputation: Disabled
Thanks for replying. I am really glad someone has replied.

I did try adding -std=c99 option while executing configure command, as well as, by manual editing the make file. But, its not getting fixed.

I am trying to build LFS since a very long time, but with no success.
 
Old 11-16-2010, 01:54 AM   #4
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi,

Assuming you are trying to build LFS 6.7 Stable: There's no need to change the commands given in the book, they work as stated. If you need to add to or change the commands in the book then something else is wrong. The 2 most common problems are:

1) Your host isn't fully up to specifications,
2) A mistake was made in the chapter in question or in the steps leading up to that chapter.

I do not have any experience using Suse as a host, but I guess that could be the base of your problem.

Check to see if Suse installs all that is needed (c99 for example) and not just the gcc/g++ part (you might need to install [additional?] gcc development package).

Hope this helps.
 
Old 11-16-2010, 03:25 AM   #5
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
c99 : I think, it's a Suse "special" to have it in a separate package,
hidden behind a 'none gcc' name :

# zypper in posix_cc

.... will provide /usr/bin/c99 ( And /usr/bin/c89 ).
....
 
Old 11-17-2010, 07:58 AM   #6
linuxquestions2010
LQ Newbie
 
Registered: Nov 2010
Posts: 13

Original Poster
Rep: Reputation: Disabled
Thumbs up

Thank-you all for helping me out.

I installed all the development packages which i felt relevant using Yast2.
Then, i installed all the stuff for which i got a 'no' while ./configure.
And, miraculously, on hitting 'make', it compiled with no error.

Its funny that configure was showing no error and was creating makefile even though some crucial stuff was not present.

Thanks again. ))
I have now got the complete tool chain and now heading towards chapter 6.
 
  


Reply



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
binutils 2.20/gcc-4.5.1 build pass 2 reverts to targeting the host system anakinwy Linux From Scratch 2 11-11-2010 03:21 PM
gcc (GCC) 4.3.2 20081105 (Red Hat 4.3.2-7) compilation error adhesh_19 Red Hat 0 01-05-2010 05:34 AM
5.4. GCC-4.0.3 - Pass 1 compilation error :( gothicbob Linux From Scratch 1 08-06-2007 05:21 PM
5.4. GCC-3.4.3 - Pass 1 invalid host type problem thomas55 Linux From Scratch 9 05-01-2006 03:21 PM

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

All times are GMT -5. The time now is 04:59 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