Geek Lair

Linux From Scratch – Troubleshooting

with 3 comments

I’m using Cross Compiled LFS Guide, as my host system is 64 bit (Ubuntu 9.10).

Some of the package links given in the guide are dead. Search in Google with the package name.

Below, I have listed section numbers from the guide.

5.5.1. Installation of Linux-Headers

While doing a make:

make ARCH=x86_64 headers_check

I got this error:

CHK include/linux/version.h
HOSTCC scripts/unifdef
scripts/unifdef.c:209: error: conflicting types for 'getline'
/usr/include/stdio.h:651: note: previous declaration of 'getline' was here
make[1]: *** [scripts/unifdef] Error 1
make: *** [headers_install] Error 2

The issue is, there is a function with the name “getline” in stdio.h and unidef.c too has a function with the same name and that was causing a conflict. I had to edit scripts/unifdef.c and replace “getline” with “parseline“. (You can replace “getline” with any other name as long as it doesn’t conflict with existing function names)

5.7.1. Installation of Cross Binutils

While building cross binutils I got these errors:

(Before trying the solution for Error 1, try the solution for Error 2. It may fix Error 1 as well.)

Error 1

../../binutils-2.18/binutils/cxxfilt.c:66: error: format not a string literal and no format arguments
../../binutils-2.18/binutils/cxxfilt.c:71: error: format not a string literal and no format arguments

Edit binutils-2.18/binutils/cxxfilt.c and specify “%s” in printf:

line 66:
- printf (mangled_name);
+ printf ("%s",mangled_name);

line 71:
- printf (result);
+ printf ("%s",result);

Error 2

cc1: warnings being treated as errors
../../binutils-2.18/gas/read.c: In function 'do_s_func':
../../binutils-2.18/gas/read.c:5631: error: ignoring return value of 'asprintf', declared with attribute warn_unused_result
../../binutils-2.18/gas/read.c:5638: error: ignoring return value of 'asprintf', declared with attribute warn_unused_result

The problem is the compiler is treating all warnings as errors as -Werror flag is set. I have no idea where that flag was getting set. But in binutils-2.18/configure file, I saw this condition:

case ${enable_werror} in
yes) stage2_werror_flag="--enable-werror-always" ;;
*) stage2_werror_flag="" ;;
esac

and passed the flag --enable-werror=no to the configure script:

AR=ar AS=as ../binutils-2.18/configure --prefix=/cross-tools \
--host=${CLFS_HOST} --target=${CLFS_TARGET} --with-lib-path=/tools/lib \
--disable-nls --enable-shared --enable-64-bit-bfd --disable-multilib --enable-werror=no

That did the trick.

Advertisements

Written by anonir

February 5, 2010 at 00:39

Posted in Linux

Tagged with ,

3 Responses

Subscribe to comments with RSS.

  1. Thanks. It works

    Juan

    May 19, 2010 at 07:39

  2. Thanks a lot. You saved me a lot of frustration and time!

    Shiv Anand

    June 27, 2010 at 09:10

  3. thanks for lot!

    backfire

    February 18, 2011 at 12:24


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: