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
 
LinkBack Search this Thread
Old 12-23-2012, 08:30 PM   #1
SuMZ
LQ Newbie
 
Registered: Dec 2012
Posts: 7

Rep: Reputation: Disabled
LFS 7.2 GCC First pass: undefined reference to `GNU_USER_TARGET_OS_CPP_BUILTINS'


Hi guys.

When compiling my GCC in first pass follwing the LFS book, I got this error information:

Quote:
c-family/c-cppbuiltin.o: In function `c_cpp_builtins':
/home/sumz/Downloads/sources/gcc-build/gcc/../../gcc-4.7.1/gcc/c-family/c-cppbuiltin.c:918: undefined reference to `GNU_USER_TARGET_OS_CPP_BUILTINS'
collect2: ld returned 1 exit status
make[2]: *** [cc1] Error 1
make[2]: Leaving directory `/home/sumz/Downloads/sources/gcc-build/gcc'
make[1]: *** [all-gcc] Error 2
make[1]: Leaving directory `/home/sumz/Downloads/sources/gcc-build'
make: *** [all] Error 2
Here is my version-check:

Quote:
bash, version 4.2.10(1)-release
/bin/sh -> /bin/bash
Binutils: (GNU Binutils for Ubuntu) 2.21.53.20110810
bison (GNU Bison) 2.4.1
/usr/bin/yacc -> /usr/bin/bison.yacc
bzip2, Version 1.0.5, 10-Dec-2007.
Coreutils: 8.5
diff (GNU diffutils) 3.0
find (GNU findutils) 4.4.2
GNU Awk 3.1.8
/usr/bin/awk -> /usr/bin/gawk
gcc (Ubuntu/Linaro 4.6.1-9ubuntu3) 4.6.1
(Ubuntu EGLIBC 2.13-20ubuntu5) 2.13
grep (GNU grep) 2.9
gzip 1.3.12
Linux version 3.0.0-12-generic (buildd@vernadsky) (gcc version 4.6.1 (Ubuntu/Linaro 4.6.1-9ubuntu3) ) #20-Ubuntu SMP Fri Oct 7 14:50:42 UTC 2011
m4 (GNU M4) 1.4.16
GNU Make 3.81
patch 2.6.1
Perl version='5.12.4';
GNU sed version 4.2.1
tar (GNU tar) 1.25
Texinfo: makeinfo (GNU texinfo) 4.13
xz (XZ Utils) 5.0.0
gcc compilation OK
Anyone has idea how to solve this problem?

Thanks.
SuMZ
 
Old 12-24-2012, 02:35 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Location: the Netherlands
Distribution: lfs, debian, rhel
Posts: 8,703
Blog Entries: 8

Rep: Reputation: 1616Reputation: 1616Reputation: 1616Reputation: 1616Reputation: 1616Reputation: 1616Reputation: 1616Reputation: 1616Reputation: 1616Reputation: 1616Reputation: 1616
Although your version-check output looks OK, I do see something that doesn't look right:
Quote:
c-family/c-cppbuiltin.o: In function `c_cpp_builtins':
/home/sumz/Downloads/sources/gcc-build/gcc/../../gcc-4.7.1/gcc/c-family/c-cppbuiltin.c:918: undefined reference to `GNU_USER_TARGET_OS_CPP_BUILTINS'
collect2: ld returned 1 exit status
make[2]: *** [cc1] Error 1
make[2]: Leaving directory `/home/sumz/Downloads/sources/gcc-build/gcc'
make[1]: *** [all-gcc] Error 2
make[1]: Leaving directory `/home/sumz/Downloads/sources/gcc-build'
make: *** [all] Error 2
Why are you building in /home/sumz/Downloads and not /mnt/lfs? It also looks liike you are doing this as user sumz and not as user lfs.

You might want to re-read 1.1. How to Build an LFS System and 2. Preparing a New Partition

Last edited by druuna; 12-24-2012 at 02:38 AM.
 
Old 12-30-2012, 01:20 AM   #3
neariot
LQ Newbie
 
Registered: Dec 2012
Posts: 1

Rep: Reputation: Disabled
I had this problem too. And I found that it was because of gcc/config/linux.h and gcc/config/i386/linux.h and linux64.h didn't work exactly.
The LFS book says "
for file in \
$(find gcc/config -name linux64.h -o -name linux.h -o -name sysv4.h)
do
cp -uv $file{,.orig}
sed -e 's@/lib\(64\)\?\(32\)\?/ld@/tools&@g' \
-e 's@/usr@/tools@g' $file.orig > $file
echo '
#undef STANDARD_STARTFILE_PREFIX_1
#undef STANDARD_STARTFILE_PREFIX_2
#define STANDARD_STARTFILE_PREFIX_1 "/tools/lib/"
#define STANDARD_STARTFILE_PREFIX_2 ""' >> $file
touch $file.orig
done
" so hard to follow.
In my opinion,I do it step by step ,
just
sed -e 's@/lib\(64\)\?\(32\)\?/ld@/tools&@g' -e 's@/usr@/tools@g' those .h and copy display to those .h
then use kwrite to add
#undef STANDARD_STARTFILE_PREFIX_1
#undef STANDARD_STARTFILE_PREFIX_2
#define STANDARD_STARTFILE_PREFIX_1 "/tools/lib/"
#define STANDARD_STARTFILE_PREFIX_2 ""' >> $file
at the end of those .h ,then it worked.
I hope those above could help you.
 
Old 12-30-2012, 07:33 AM   #4
stoat
Member
 
Registered: May 2007
Posts: 288

Rep: Reputation: 99
Quote:
Originally Posted by neariot

I had this problem too. And I found that it was because of gcc/config/linux.h and gcc/config/i386/linux.h and linux64.h didn't work exactly.
But it worked okay for me though.

Quote:
Originally Posted by neariot

In my opinion,I do it step by step...
Well, that's one of the great things about LFS... everybody can do whatever they want. But I recommend future readers just follow the book. The 7.2 book can be considered mature at this point. Many people have built it. The errata do not mention anything about section 5.5.
 
  


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] LFS 7.2 GCC First pass: undefined reference to `GNU_USER_TARGET_OS_CPP_BUILTINS' anjohn Linux From Scratch 11 01-08-2013 06:09 AM
[SOLVED] LFS: Error during GCC-4.7.1-Pass 1 (LFS 7.2, Section 5.5) erkant Linux From Scratch 7 11-28-2012 06:03 AM
gcc does not show undefined reference error moonmoth Linux - Software 8 07-25-2010 04:33 PM
gcc linking: undefined reference to just about everything shabbychef Programming 7 09-09-2005 08:42 PM
gcc ld error. Undefined reference redness Linux - Software 4 02-08-2005 02:01 AM


All times are GMT -5. The time now is 06:43 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration