LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Problem in LFS chapter 5.4. Binutils-2.31.1 - Pass 1 (https://www.linuxquestions.org/questions/linux-newbie-8/problem-in-lfs-chapter-5-4-binutils-2-31-1-pass-1-a-4175648566/)

EphraimB 02-18-2019 04:08 PM

Problem in LFS chapter 5.4. Binutils-2.31.1 - Pass 1
 
After I type in the terminal
Code:

lfs@ephraimb-STK2M364CC:/mnt/lfs/sources/binutils-2.31.1/build$ ../configure --prefix=/tools \
--with-sysroot=$LFS \
--with-lib-path=/tools/lib \
--target=$LFS_TGT \
--disable-nls \
--disable-werror

I get the following error:
Code:

lfs@ephraimb-STK2M364CC:/mnt/lfs/sources/binutils-2.31.1/build$ ../configure --prefix=/tools            \
> --with-sysroot=$LFS        \
> --with-lib-path=/tools/lib \
> --target=$LFS_TGT          \
> --disable-nls              \
> --disable-werror
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-lfs-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether ln works... yes
checking whether ln -s works... yes
checking for a sed that does not truncate output... /bin/sed
checking for gawk... no
checking for mawk... mawk
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/mnt/lfs/sources/binutils-2.31.1/build':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details

The Linux from Scratch book says to install Binutils before GCC. Am I doing anything wrong?

hazel 02-18-2019 04:16 PM

Since gcc was not found on your command path, the first thing you need to check is the value of $PATH. Remember that this environmental variable is set when you log in as the lfs user.

What is the output of "echo $PATH"? It should show /tools/bin at the beginning followed by /bin and /usr/bin. /usr/bin is where your current gcc should be. You did install the build-essential package before you started, didn't you?

By the way, I see that you don't have gawk; you have mawk instead. This is usual on Debian derivatives like Ubuntu, but you can't build LFS with that setup. You need to install gawk as well as build-essential, and to make sure that the /bin/sh symbolic link points to /bin/bash and not /bin/dash. Have you run the requirements script to check on all that stuff?

EphraimB 02-18-2019 04:19 PM

Quote:

Originally Posted by hazel (Post 5963746)
Since gcc was not found on your command path, the first thing you need to check is the value of $PATH. Remember that this environmental variable is set when you log in as the lfs user.

What is the output of "echo $PATH"? It should show /tools/bin at the beginning followed by /bin and /usr/bin. /usr/bin is where your current gcc should be. You did install the build-essential package before you started, didn't you?

Code:

lfs@ephraimb-STK2M364CC:/mnt/lfs/sources/binutils-2.31.1/build$ echo $PATH
/tools/bin:/bin:/usr/bin


hazel 02-18-2019 04:25 PM

So is gcc present in /usr/bin?

EphraimB 02-18-2019 04:27 PM

Quote:

Originally Posted by hazel (Post 5963752)
So is gcc present in /usr/bin?

I'm doing Linux From Scratch where i'm supposed to manually download and install each package. The book is telling me to install Binutils BEFORE GCC.

Mike_Walsh 02-18-2019 06:22 PM

@ EphraimB:-

Quote:

I'm doing Linux From Scratch where i'm supposed to manually download and install each package. The book is telling me to install Binutils BEFORE GCC.
You're a braver man than me. I've used Linux for several years, and become quite competent at scripting, package building, etc.....and I still wouldn't even contemplate attempting what you're doing !

I just wanted to say that a few years ago, one of our members on the Puppy Linux Forums built an upgrade package to 'upgrade' the glibc on an elderly, but popular 'Puppy' where members wanted to run the then current Chrome browser. This 'package' consisted of 6 or 7 small 'pets' (as we call them).....and his instructions were also to install binutils BEFORE gcc.

I believe this is because the tools in the binutils package are required for building the 'C' compiler itself. I could also be completely wrong, of course..!

Just a wee anecdote.


Mike. ;)

EphraimB 02-18-2019 06:26 PM

Quote:

Originally Posted by Mike_Walsh (Post 5963790)
@ EphraimB:-



You're a braver man than me. I've used Linux for several years, and become quite competent at scripting, package building, etc.....and I still wouldn't even contemplate attempting what you're doing !

I just wanted to say that a few years ago, one of our members on the Puppy Linux Forums built an upgrade package to 'upgrade' the glibc on an elderly, but popular 'Puppy' where members wanted to run the then current Chrome browser. This 'package' consisted of 6 or 7 small 'pets' (as we call them).....and his instructions were also to install binutils BEFORE gcc.

I believe this is because the tools in the binutils package are required for building the 'C' compiler itself. I could also be completely wrong, of course..!

Just a wee anecdote.


Mike. ;)

But it's saying that Binutils needs gawk, gcc, cc, and cl.exe to configure the Binutils package.

EphraimB 02-18-2019 07:23 PM

Quote:

Originally Posted by hazel (Post 5963746)
By the way, I see that you don't have gawk; you have mawk instead. This is usual on Debian derivatives like Ubuntu, but you can't build LFS with that setup. You need to install gawk as well as build-essential, and to make sure that the /bin/sh symbolic link points to /bin/bash and not /bin/dash. Have you run the requirements script to check on all that stuff?

I thought Ubuntu comes with gcc, gawk,and the other missing packages. I think I finally figured out the answer.

hazel 02-19-2019 12:43 AM

Quote:

Originally Posted by EphraimB (Post 5963754)
I'm doing Linux From Scratch where i'm supposed to manually download and install each package. The book is telling me to install Binutils BEFORE GCC.

Well, as The Book says: "You need a compiler to compile a compiler."

But I think you are misunderstanding something on a basic level. When you start out building LFS, you have to use the build tools on your host system (in your case Ubuntu), because that's all you have to work with. So you need to have both gcc and binutils installed on the host, along with a number of other build tools such as make. All Debian derivatives have a package called build-essential which contains those tools. In chapter 5, you use these host tools to build a set of duplicate tools independent of the host. Then, in chapter 6, you use the toolkit that you have built to build your new system.

So it is the host's gcc and binutils that are used to build binutils for the /tools directory. Then the host's gcc and the new binutils are used to build a new gcc.

A complicating factor is that most distros do not include build tools in their default install, so you have to install them separately before you embark on LFS. Also Debian derivatives use mauk and dash where the LFS build requires gawk and bash, so that has to be corrected.

Early in the book, there is a list of the packages you need to have on your host system and how to test that you have them. You evidently did not go through this section and that is why you are having problems now.


All times are GMT -5. The time now is 11:13 PM.