LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux From Scratch (https://www.linuxquestions.org/questions/linux-from-scratch-13/)
-   -   Compiling Binutils 2.20.1 (https://www.linuxquestions.org/questions/linux-from-scratch-13/compiling-binutils-2-20-1-a-912470/)

lfs_mm 11-08-2011 08:23 AM

Compiling Binutils 2.20.1
 
Hello everybody

I try to compile binutils 2.20.1 with the LFS Manual 6.7. I use a UBUNTU 11.10 as a host system. I use the following configure:

Code:

../binutils-2.20.1/configure --target=$LFS_TGT --prefix=/tools --disable-nls --disable-werror
I get the following error:

Code:

gcc -c -DHAVE_CONFIG_H -g -O2  -I. -I../../binutils-2.20.1/libiberty/../include  -W -Wall -Wwrite-strings -Wc++-compat -Wstrict-prototypes -pedantic  ../../binutils-2.20.1/libiberty/regex.c -o regex.o
../../binutils-2.20.1/libiberty/regex.c:130:1: warning: function declaration isn't a prototype [-Wstrict-prototypes]
../../binutils-2.20.1/libiberty/regex.c:130:7: warning: conflicting types for built-in function 'malloc' [enabled by default]
../../binutils-2.20.1/libiberty/regex.c:131:1: warning: function declaration isn't a prototype [-Wstrict-prototypes]
../../binutils-2.20.1/libiberty/regex.c:131:7: warning: conflicting types for built-in function 'realloc' [enabled by default]
In file included from /usr/include/i386-linux-gnu/bits/string2.h:1298:0,
                from /usr/include/string.h:637,
                from ../../binutils-2.20.1/libiberty/regex.c:149:
/usr/include/stdlib.h:471:14: error: conflicting types for 'malloc'
../../binutils-2.20.1/libiberty/regex.c:130:7: note: previous declaration of 'malloc' was here
In file included from ../../binutils-2.20.1/libiberty/regex.c:638:0:
../../binutils-2.20.1/libiberty/regex.c: In function 'byte_regex_compile':
../../binutils-2.20.1/libiberty/regex.c:2439:7: warning: implicit declaration of function 'free' [-Wimplicit-function-declaration]
../../binutils-2.20.1/libiberty/regex.c:2439:33: warning: incompatible implicit declaration of built-in function 'free' [enabled by default]
../../binutils-2.20.1/libiberty/regex.c:2500:17: warning: incompatible implicit declaration of built-in function 'free' [enabled by default]
../../binutils-2.20.1/libiberty/regex.c:2533:36: warning: incompatible implicit declaration of built-in function 'free' [enabled by default]
../../binutils-2.20.1/libiberty/regex.c:2640:28: warning: incompatible implicit declaration of built-in function 'free' [enabled by default]
../../binutils-2.20.1/libiberty/regex.c:3643:26: warning: incompatible implicit declaration of built-in function 'free' [enabled by default]
../../binutils-2.20.1/libiberty/regex.c:4150:5: warning: incompatible implicit declaration of built-in function 'free' [enabled by default]
../../binutils-2.20.1/libiberty/regex.c: In function 'byte_re_compile_fastmap':
../../binutils-2.20.1/libiberty/regex.c:4835:11: warning: implicit declaration of function 'abort' [-Wimplicit-function-declaration]
../../binutils-2.20.1/libiberty/regex.c:4835:11: warning: incompatible implicit declaration of built-in function 'abort' [enabled by default]
../../binutils-2.20.1/libiberty/regex.c: In function 'byte_re_match_2_internal':
../../binutils-2.20.1/libiberty/regex.c:7143:27: warning: variable 'sdummy' set but not used [-Wunused-but-set-variable]
../../binutils-2.20.1/libiberty/regex.c:7142:22: warning: variable 'pdummy' set but not used [-Wunused-but-set-variable]
../../binutils-2.20.1/libiberty/regex.c:7423:11: warning: incompatible implicit declaration of built-in function 'abort' [enabled by default]
../../binutils-2.20.1/libiberty/regex.c: In function 'xregcomp':
../../binutils-2.20.1/libiberty/regex.c:7977:4: warning: incompatible implicit declaration of built-in function 'free' [enabled by default]
../../binutils-2.20.1/libiberty/regex.c: In function 'xregexec':
../../binutils-2.20.1/libiberty/regex.c:8052:7: warning: incompatible implicit declaration of built-in function 'free' [enabled by default]
../../binutils-2.20.1/libiberty/regex.c: In function 'xregerror':
../../binutils-2.20.1/libiberty/regex.c:8080:5: warning: incompatible implicit declaration of built-in function 'abort' [enabled by default]
../../binutils-2.20.1/libiberty/regex.c: In function 'xregfree':
../../binutils-2.20.1/libiberty/regex.c:8114:5: warning: incompatible implicit declaration of built-in function 'free' [enabled by default]
make[2]: *** [regex.o] Error 1
make[2]: Leaving directory `/media/lfs/sources/binutils-build/libiberty'
make[1]: *** [all-libiberty] Error 2
make[1]: Leaving directory `/media/lfs/sources/binutils-build'
make: *** [all] Error 2

First at all i search with help from google if anybody had a similar problem but i couldn't find anything.
Secondly, how can I solve such problems by myself? the config.log file has no further information about the error above. How can I narrow down the problem?
Can anybody give me some advice about the error above?

Greetings

spiky0011 11-08-2011 08:59 AM

Did you make sure the host system is compliant by running the version check script

lfs_mm 11-08-2011 09:36 AM

OUTPUT of the test:

Code:


bash, version 4.2.10(1)-release
/bin/sh -> /bin/dash
Binutils: (GNU Binutils for Ubuntu) 2.21.53.20110810
version-check.sh: line 7: bison: command not found
yacc not found
bzip2,  Version 1.0.5, 10-Dec-2007.
Coreutils:  8.5
diff (GNU diffutils) 3.0
find (GNU findutils) 4.4.2
version-check.sh: line 15: gawk: command not found
/usr/bin/awk -> /usr/bin/mawk
gcc (Ubuntu/Linaro 4.6.1-9ubuntu3) 4.6.1
version-check.sh: line 20: /lib/libc.so.6: No such file or directory
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
version-check.sh: line 24: m4: command not found
GNU Make 3.81
version-check.sh: line 26: patch: command not found
Perl version='5.12.4';
GNU sed version 4.2.1
tar (GNU tar) 1.25
version-check.sh: line 30: makeinfo: command not found
Texinfo:
Compilation OK


I am using the LFS Manual more as a guideline to prepare my own toolchain.

Greetings

spiky0011 11-08-2011 09:49 AM

So there are a few problems there these need to be fixed 1st. Apt get can get the packages you require then check version check again restart build fromscratch

lfs_mm 11-08-2011 03:26 PM

Ok i try to fix it.

spiky0011 11-08-2011 03:31 PM

you still have some errors in the output.
version-check.sh: line 20: /lib/libc.so.6: No such file or directory
version-check.sh: line 26: patch: command not found
version-check.sh: line 30: makeinfo: command not found
These need to be fixed

lfs_mm 11-08-2011 03:56 PM

sorry i post the last one too early... i saw that too... at the moment the output looks like this:

Code:

bash, version 4.2.10(1)-release
/bin/sh -> /bin/dash
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
version-check.sh: line 20: /lib/libc.so.6: No such file or directory
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
Compilation OK

The following error "/lib/libc.so.6: No such file or directory" is due to the fact, that the library is under /lib/i386-linux-gnu/libc.so.6. What should I do about that?

spiky0011 11-08-2011 04:10 PM

I had to make a symlink for it to work on mine
Code:

sudo ln -s /lib/i386-linux-gnu/libc-2.13.so /lib/libc.so.6

lfs_mm 11-08-2011 04:21 PM

Ok now everything is fine with the symlink. But i'm stuck again until I compile the binutils 2.20.1. It is the same error as above. Any further suggestions? The error is mentioning something about that two declarations of malloc are found isn't it? Do I have to exclude a specific path for the make command for further progress?

spiky0011 11-08-2011 04:29 PM

what is the output of echo $LFS

lfs_mm 11-08-2011 04:33 PM

echo $LFS => /media/lfs

this is another harddrive. The lfs has the /tools & /sources folders.
Just 2 minutes before i tried to compile binutils with the root rights and i did work... something with my lfs user is quite not right... ???

spiky0011 11-08-2011 04:40 PM

What isz the output of
Code:

ls -l /lib/libc.*
on host system mine is
lrwxrwxrwx 1 root root 32 2011-10-10 19:16 /lib/libc.so.6 -> /lib/i386-linux-gnu/libc-2.13.so

lfs_mm 11-08-2011 04:43 PM

lfs@marius-HP-Pavilion-dv9500-Notebook-PC:~$ ls -l /lib/libc.*
lrwxrwxrwx 1 root root 29 Nov 8 23:15 /lib/libc.so.6 -> /lib/i386-linux-gnu/libc.so.6

The same output as yours.

spiky0011 11-08-2011 04:46 PM

No yours is different mine points to i386-linux-gnu/libc-2.13.so yours is /libc.so.6. did you pass the version check

lfs_mm 11-08-2011 04:53 PM

yes, i thought that i take the same static library as from the test output:

Code:

lfs@marius-HP-Pavilion-dv9500-Notebook-PC:~$ bash version-check.sh
bash, version 4.2.10(1)-release
/bin/sh -> /bin/dash
Binutils: (GNU Binutils) 2.19.1
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
GNU C Library (Ubuntu EGLIBC 2.13-20ubuntu5) stable release version 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
Compilation OK


lfs_mm 11-08-2011 05:16 PM

I did found the trouble maker...

In the root directory... i had already a /tools folder which had some crap in it. I removed this folder and created a simlink to $LFS/tools. Now it worked.

Thanks for other the help! Hope i get further tomorrow with compiling gcc 4.5.1.
Just as question: I only want to work the CHAPTER 5 of the LFS Manual to get a functional toolchain. After that can I copy the toolchain to a already compiled linux kernel? Will the toolchain be able to compile further tools?

druuna 11-09-2011 01:37 AM

Hi,

Before you start you need to correct this:
Quote:

Originally Posted by lfs_mm
lfs@marius-HP-Pavilion-dv9500-Notebook-PC:~$ bash version-check.sh
bash, version 4.2.10(1)-release
/bin/sh -> /bin/dash

The link should point to bash and not dash.

Quote:

Originally Posted by lfs_mm
Just as question: I only want to work the CHAPTER 5 of the LFS Manual to get a functional toolchain. After that can I copy the toolchain to a already compiled linux kernel? Will the toolchain be able to compile further tools?

Although I'm not 100% sure what it is you want to do, at the end of chapter 5 there is a caution note (5.35. Changing Ownership - Caution) which indicates that you can re-use the temporary environment. It does assume that this is done to build another LFS system. It also is partially machine depended, the temporary environment does use parts of the host system (the kernel being one).

Hope this helps.

lfs_mm 11-09-2011 04:16 AM

Ok i'll correct that.

Maybe I misunderstand the LFS manual.. I thought that the Toolchain will be prepared that it is host independent. I refer to section 5.2:
Quote:

The overall goal of Chapter 5 is to produce a temporary area that contains a known-good set of tools that can be
isolated from the host system.
My main goal is to prepare the toolchain on my laptop and afterwoods i'd like to copy the toolchain to our embedded device which runs with an ATOM processor (x86). We already compiled a kernel (2.6.39) there. This toolchain should help to compile further tools for the embedded device. The embedded device have enough cpu power so we thought that such a toolchain would be a huge relieve. Is there a main problem in this goal ?

druuna 11-09-2011 05:49 AM

Hi,
Quote:

Originally Posted by lfs_mm (Post 4519569)
Maybe I misunderstand the LFS manual.. I thought that the Toolchain will be prepared that it is host independent. I refer to section 5.2:
Quote:

The overall goal of Chapter 5 is to produce a temporary area that contains a known-good set of tools that can be
isolated from the host system.

That is basically true. But, as you might have noticed, no kernel is installed in chapter 5 (only the API headers are). Once you reach chapter 6 you chroot into the environment you just created in chapter 5. The hosts kernel is still used, but the sane environment is used to build a fully functional LFS (which chapter 5 does not. It is a limited, sane environment).

Quote:

My main goal is to prepare the toolchain on my laptop and afterwoods i'd like to copy the toolchain to our embedded device which runs with an ATOM processor (x86). We already compiled a kernel (2.6.39) there. This toolchain should help to compile further tools for the embedded device. The embedded device have enough cpu power so we thought that such a toolchain would be a huge relieve. Is there a main problem in this goal ?
I don't have any experience building LFS/Linux on embedded devices, but the first thing that does come to mind: Are both platforms the same? You mention that the embedded platform is x86, how about the host you are building the temporary environment on? What you are building now is based on the hosts architecture, which might not (or might) be the same as your embedded system.

I do wonder if this is going to work. You might want to keep us updated on your progress, it could be of value for others that want to try this.

Hope this helps.

lfs_mm 11-09-2011 07:08 AM

I will keep you posted to my progress with the toolchain. I approached the section "5.8 Adjusting the Toolchain". Everything else worked well.
The exact kernel version of the embedded device is 2.6.39.1. I downloaded it on my host system into the sources folder. I used this for the section "5.6 Linux-2.6.35.4 API Headers" to expose the API to my kernel version (2.6.39.1).
Further information will follow or further questions will be asked.


All times are GMT -5. The time now is 06:10 PM.