krglaws / MyLFS

A giant Bash script that builds Linux From Scratch
MIT License
91 stars 23 forks source link

Version checking giving wrong results #2

Closed FinleyVickers closed 2 years ago

FinleyVickers commented 2 years ago

When running the initial build.sh script, I get the following errors: Checking system dependencies... ERROR: ld does not satisfy minimum version 2.13.1 ERROR: gcc does not satisfy minimum version 4.8 ERROR: g++ does not satisfy minimum version 4.8 ERROR: /usr/bin/yacc needs to be a link to /usr/bin/bison.yacc done. But when I run version-check.sh from the official lfs book (https://linuxfromscratch.org/lfs/view/stable/chapter02/hostreqs.html), I don't get any errors: bash, version 5.1.16(1)-release /bin/sh -> /usr/bin/bash Binutils: (GNU Binutils) 2.38 bison (GNU Bison) 3.8.2 yacc is bison (GNU Bison) 3.8.2 Coreutils: 9.0 diff (GNU diffutils) 3.8 find (GNU findutils) 4.9.0 GNU Awk 5.1.1, API: 3.1 (GNU MPFR 4.1.0-p13, GNU MP 6.2.1) /usr/bin/awk -> /usr/bin/gawk gcc (GCC) 11.2.0 g++ (GCC) 11.2.0 grep (GNU grep) 3.7 gzip 1.11 Linux version 5.17.1-arch1-1 (linux@archlinux) (gcc (GCC) 11.2.0, GNU ld (GNU Binutils) 2.38) #1 SMP PREEMPT Mon, 28 Mar 2022 20:55:33 +0000 m4 (GNU M4) 1.4.19 GNU Make 4.3 GNU patch 2.7.6 Perl version='5.34.1'; Python 3.10.4 sed (GNU sed) 4.8 tar (GNU tar) 1.34 texi2any (GNU texinfo) 6.8 xz (XZ Utils) 5.2.5 g++ compilation OK This is running from a fresh install on endeavour os.

krglaws commented 2 years ago

The version check from the book only prints the current versions of each dependency. It doesn't tell you if they are too out of date. It's up to you to inspect the displayed versions and compare them to the minimums listed in the book.

Since I wanted automate that process, I added the version comparisons so that it will tell you when something is too far behind.

krglaws commented 2 years ago

On further inspection of your version_check output, it does look like you have acceptable versions, so the code is breaking somewhere... I'll think more about this later

FinleyVickers commented 2 years ago

The version check from the book only prints the current versions of each dependency. It doesn't tell you if they are too out of date. It's up to you to inspect the displayed versions and compare them to the minimums listed in the book.

Since I wanted automate that process, I added the version comparisons so that it will tell you when something is too far behind.

But if you look at the output of the version check you can see that all the dependencies appear to be up to date. It looks like your version checking is not properly checking if it is up to date.

krglaws commented 2 years ago

I'm thinking of just getting rid of this part of the project since it is extremely brittle. Probably replacing it with something like an optional --version-check argument that will only run the script as shown in the book, and not attempt to compare the output with what is on the system. Out of curiosity though, can you paste the output of your gcc --version here?

FinleyVickers commented 2 years ago

I'm thinking of just getting rid of this part of the project since it is extremely brittle. Probably replacing it with something like an optional --version-check argument that will only run the script as shown in the book, and not attempt to compare the output with what is on the system. Out of curiosity though, can you paste the output of your gcc --version here?

Sure! gcc --version

gcc (GCC) 11.2.0 Copyright (C) 2021 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

BTW the Zlib package is out of date and returns a 404 error, updating the link in the pkgs script to https://zlib.net/zlib-1.2.12.tar.xz will fix it. (Outdated link: https://zlib.net/zlib-1.2.11.tar.xz)

krglaws commented 2 years ago

ok, thanks. I'm working on making the dependency version check more flexible and optional.

And thanks for catching that, I'll fix that as well

FinleyVickers commented 2 years ago

ok, thanks. I'm working on making the dependency version check more flexible and optional.

And thanks for catching that, I'll fix that as well

No problem, thanks! Maybe an option for verbose output as well so it's easier to catch errors? I needed to manually remove the quiet tag from the wget command to find the error due to it just silently exiting the script. Thanks for the script by the way, I've done lfs manually a couple times and have been trying to use ALFS but it only works for v8.0 so this script is really helpful.

krglaws commented 2 years ago

I moved the dependency check step into an independent part of the build, so now when you run sudo ./build.sh --check it will display the minimum and maximum version limits, and the current versions you have on your system. Unfortunately it will require manually examining the output to confirm that things are all good. Not so bad though. I also added a --verbose option so that it will give a bit more detail (only applies to the download step, but planning on expanding it to the other parts).

I'm glad a few other people have a use for this project. Thanks for your input!