linuxboot / heads

A minimal Linux that runs as a coreboot or LinuxBoot ROM payload to provide a secure, flexible boot environment for laptops, workstations and servers.
https://osresearch.net/
GNU General Public License v2.0
1.4k stars 180 forks source link

Build error on Ubuntu 21.04 #1036

Closed copyvar closed 2 years ago

copyvar commented 2 years ago

I need some help to build heads. I installed all packages mentioned in line 13 https://github.com/osresearch/heads/blob/master/.circleci/config.yml

...
make[3]: Entering directory '/home/test/heads/build/make-4.2.1/doc'
make[3]: Nothing to be done for 'all'.
make[3]: Leaving directory '/home/test/heads/build/make-4.2.1/doc'
make[3]: Entering directory '/home/test/heads/build/make-4.2.1'
gcc  -g -O2 -Wl,--export-dynamic  -o make ar.o arscan.o commands.o default.o dir.o expand.o file.o function.o getopt.o getopt1.o guile.o implicit.o job.o load.o loadapi.o main.o misc.o posixos.o output.o read.o remake.o rule.o signame.o strcache.o variable.o version.o vpath.o hash.o remote-stub.o glob/libglob.a   -ldl 
/usr/bin/ld: glob/libglob.a(glob.o): in function `glob_in_dir':
/home/test/heads/build/make-4.2.1/glob/glob.c:1269: undefined reference to `__stat'
/usr/bin/ld: glob/libglob.a(glob.o): in function `glob':
/home/test/heads/build/make-4.2.1/glob/glob.c:1036: undefined reference to `__stat'
/usr/bin/ld: /home/test/heads/build/make-4.2.1/glob/glob.c:814: undefined reference to `__stat'
/usr/bin/ld: /home/test/heads/build/make-4.2.1/glob/glob.c:960: undefined reference to `__stat'
collect2: error: ld returned 1 exit status
make[3]: *** [Makefile:656: make] Error 1
make[3]: Leaving directory '/home/test/heads/build/make-4.2.1'
make[2]: *** [Makefile:798: all-recursive] Error 1
make[2]: Leaving directory '/home/test/heads/build/make-4.2.1'
make[1]: *** [Makefile:534: all] Error 2
make[1]: Leaving directory '/home/test/heads/build/make-4.2.1'
LANG=C MAKE=/home/test/heads/build/make-4.2.1/make /home/test/heads/build/make-4.2.1/make  all
/bin/sh: 1: /home/test/heads/build/make-4.2.1/make: not found
make: *** [Makefile:668: all] Error 127
copyvar commented 2 years ago

I am stuck after hours of research in the web. Anyone got an idea?

paulmenzel commented 2 years ago

Please try the change from merge/pull request https://github.com/osresearch/heads/pull/1035.

paulmenzel commented 2 years ago

(Also, please update your original issue report, and format the paste as a code block.)

copyvar commented 2 years ago

Please try the change from merge/pull request #1035.

Thank you, that helped. Now I got stuck at another point (should I open a new issue for that?):

...
make[2]: Entering directory '/home/test/heads/build/coreboot-4.8.1'
Welcome to the coreboot cross toolchain builder v1.52 (June 11th, 2018)

Building toolchain using 4 thread(s).

Downloading and verifing tarballs ...
 * acpica-unix2-20180531.tar.gz (downloading from http://acpica.org/sites/acpica/files/acpica-unix2-20180531.tar.gz)... 100%... hash verified ("17717140438d506533b4a56e34350749d7b84d6c")
Downloaded tarballs ... ok
Unpacking and patching ...
 * acpica-unix2-20180531.tar.gz
   o acpica-unix2-20180531_iasl.patch
Unpacked and patched ... ok
Building packages ...
Building IASL v20180531 for host ... failed. Check 'build-IASL/build.log'.
make[3]: *** [Makefile:36: build_iasl] Error 1
make[2]: *** [util/crossgcc/Makefile.inc:52: iasl] Error 2
make[2]: Leaving directory '/home/test/heads/build/coreboot-4.8.1'
make[1]: *** [modules/coreboot:83: "/home/test/heads/build/coreboot-4.8.1/util/crossgcc/xgcc/bin/iasl"] Error 2
make[1]: Leaving directory '/home/test/heads'
make: *** [Makefile:668: all] Error 2
copyvar commented 2 years ago

@tlaurion @paulmenzel I manually changed all files which are different from the main repo in https://github.com/tlaurion/heads/commit/60e908ec2794ae44cd0afa0fcdd15f46af3e2440 . Still I am not able to build heads due to the IASL error. Most probably I made a mistake while manually editing the files. Please tell me how to apply the patches via command line. What is the next step after git clone https://github.com/osresearch/heads ? (I am new to the build process. I tried to research how to apply patches from different repos.)

tlaurion commented 2 years ago

@copyvar I will rebase #1038 on master, which will build coreboot 4.13 and 4.11 based boards including xx30 and xx20 boards (x230 is a xx30 board, which #1015 is ready to merge).

It is still impossible with current patches to build coreboot 4.8.1 based boards on recent OSes build toolstack, unfortunately, which #1038 PR is attempting to resolve the current raised issue.

copyvar commented 2 years ago

I do not want to sound rude, but is there a chance, that I can build heads soon or is there any other opportunity for a workaround?

tlaurion commented 2 years ago

I do not want to sound rude, but is there a chance, that I can build heads soon or is there any other opportunity for a workaround?

@copyvar : You can test PR https://github.com/osresearch/heads/pull/1038 which had been built correctly over CircleCI to build 4.11 and 4.13 (and coreboot 4.14, over Ubuntu 21.04).

You can use gh as pointed out from GitHub, or git remote add tlaurion https://github.com/tlaurion/heads and then checkout the proper branch through git checkout tlaurion/CircleCI_Ubuntu_2104 and build the desired board normally through make BOARD=x230-hotp-maximized.

copyvar commented 2 years ago

Thank you! When I do git checkout tlaurion/CircleCI_Ubuntu_2104 the following error appears: error: pathspec 'tlaurion/CircleCI_Ubuntu_2104' did not match any file(s) known to git What am I doing wrong?

tlaurion commented 2 years ago

git fetch tlaurion was the missing intermediate step. Sorry about that.

copyvar commented 2 years ago

It ran for an hour then following message came up:

make[2]: *** No rule to make target '../../blobs/xx30/me.bin', needed by 'add_intel_firmware'.  Stop.
make[2]: Leaving directory '/home/test/heads/build/coreboot-4.13'
make[1]: *** [Makefile:455: /home/test/heads/build/coreboot-4.13/x230-hotp-maximized/.build] Error 1
make[1]: Leaving directory '/home/test/heads'
make: *** [Makefile:668: all] Error 2
tlaurion commented 2 years ago

@copyvar this is because you never followed instructions written under board configurstion nor circleci configuration because still undocumented. You need to run blobs/xx30/download_clean_me.sh prior of build to have blobs downloaded. ME blob is not redistributable, but this script permits to download it from Lenovo website and neuter it. You can also read the README file in that directory and the board configuration for more explanations.

copyvar commented 2 years ago

Thanks a lot for your effort!