pipcet / pearl

GNU/Linux on Apple M1 hardware
GNU General Public License v3.0
36 stars 6 forks source link

Pearl compile and build instructions #5

Closed Johnnie390 closed 2 years ago

Johnnie390 commented 3 years ago

Hello all, I have found a pearl build/installation checklist by Wende Tan in Chinese. I would appreciate a link to a comprehensive build checklist if possible. I am currently running Wende Tans build instructions on a Raspberry PI4B (8GB) running RaspiOS (Bullseye) using a 5.10.x kernel which is rather slow. My target (eventually) is a Mac Mini M1 (A2348). As I write, the pearl compile (make build/linux/pearl.image.macho -j20) has just finished with the following errors -

~/pearl/build/emacs/native/lisp/org/org.el and /root/pearl/userspace/emacs/emacs/lisp/org/org.el are the same file

GEN ../../info/org.info make[4]: Leaving directory '/root/pearl/build/emacs/native/doc/misc' make[3]: Leaving directory '/root/pearl/build/emacs/native' make[2]: Leaving directory '/root/pearl' make[1]: [Makefile:76: build/userspace/done/install] Error 2 rm /root/pearl/build/linux/done/linux/copy /root/pearl/build/host/macho-tools/nop.S /root/pearl/build/linux/done/stage2/copy /root/pearl/build/host/macho-tools/restore-boot-args.S /root/pearl/build/host/macho-tools/save-boot-args.S /root/pearl/build/linux/done/pearl/copy make[1]: Leaving directory '/root/pearl' make: [Makefile:76: build/linux/pearl.image.macho] Error 2

Any tips/pointers much appreciated.

Regards,

Ry

Johnnie390 commented 3 years ago

Pearl-build.log

Pearl compile log attached.

Johnnie390 commented 3 years ago

Here is an excerpt of the error messages just before compile termination - . . . ./pex-common.c: In function ‘pex_read_output’: ./pex-common.c:494:36: error: ‘const struct pex_funcs’ has no member named ‘fdopenr’ 494 | obj->read_output = obj->funcs->fdopenr (obj, o, binary); | ^~ ./pex-common.c: In function ‘pex_read_err’: ./pex-common.c:509:29: error: ‘const struct pex_funcs’ has no member named ‘fdopenr’ 509 | obj->read_err = obj->funcs->fdopenr (obj, o, binary); | ^~ ./pex-common.c: In function ‘pex_get_status_and_time’: ./pex-common.c:534:21: error: ‘const struct pex_funcs’ has no member named ‘wait’ 534 | if (obj->funcs->wait (obj, obj->children[i], &obj->status[i], | ^~ ./pex-common.c: In function ‘pex_free’: ./pex-common.c:607:15: error: ‘const struct pex_funcs’ has no member named ‘close’ 607 | obj->funcs->close (obj, obj->next_input); | ^~ ./pex-common.c:609:15: error: ‘const struct pex_funcs’ has no member named ‘close’ 609 | obj->funcs->close (obj, obj->stderr_pipe); | ^~ ./pex-common.c:644:17: error: ‘const struct pex_funcs’ has no member named ‘cleanup’ 644 | if (obj->funcs->cleanup != NULL) | ^~ ./pex-common.c:645:15: error: ‘const struct pex_funcs’ has no member named ‘cleanup’ 645 | obj->funcs->cleanup (obj); | ^~ make[5]: [Makefile:1143: pex-unix.o] Error 1 make[5]: Waiting for unfinished jobs.... make[5]: [Makefile:1102: pex-common.o] Error 1 make[4]: [Makefile:8460: all-libiberty] Error 2 make[4]: Waiting for unfinished jobs.... make[3]: [Makefile:903: all] Error 2 make[2]: [toolchain/binutils-gdb/binutils-gdb.mk:9: /root/pearl/build/binutils-gdb/done/build] Error 2 make[2]: Waiting for unfinished jobs.... mv: cannot stat '/root/pearl/build/glibc/headers/build/sysd-syscallsT': No such file or directory make[1]: [Makefile:76: build/userspace/done/install] Error 2 make: [Makefile:76: build/linux/pearl.image.macho] Error 2

pipcet commented 3 years ago

Hi! Thank you very much for wanting to give this a try. I'm quite confident we'll figure out the build process, but please be aware that I have a MacBook Pro, not a Mini (yet), so there may be some changes required to get the keyboard working if it's USB.

Let's get the build fixed first. It seems the build is failing very early in the binutils libiberty code. The code isn't obviously incorrect in the places you pointed at, so I suspect it's a parse error in a header file, possibly pex-common.h.

Could I ask you to run make again without the -j20? That should stop parallel execution of other sub-makes and render the output much shorter and more relevant.

BTW, can you provide a link to the checklist in Chinese? I had no idea it existed!

Johnnie390 commented 3 years ago

Pipcet,

appreciate the reply. Chinese website with installation instructions - https://twd2.me/archives/15747 - I am not sure where this "person" got these install instructions... Attached, the compile listing again without the job card (j20). There were also a few dependency issues which only occured late into the compile :( which ends with a Segmentation fault. On an RPI4B, the compile takes aeons. Again, detailed installation/operational documentation would be much appreciated!

Good luck!

Regards,

Ry

PS I tried Corellium's way - the USB boot works but the end result is not feasible as a desktop in its current state. The NVME boot option issues a kernel panic and says it cannot find the root file system.

Attached compile/build log. Pearl_Compile.txt

Johnnie390 commented 3 years ago

GCC/C++ versions -

root@magalas:/Transit# gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/aarch64-linux-gnu/10/lto-wrapper Target: aarch64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Debian 10.2.1-6' --with-bugurl=file:///usr/share/doc/gcc-10/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-10 --program-prefix=aarch64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libquadmath --disable-libquadmath-support --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --enable-fix-cortex-a53-843419 --disable-werror --enable-checking=release --build=aarch64-linux-gnu --host=aarch64-linux-gnu --target=aarch64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-mutex Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 10.2.1 20210110 (Debian 10.2.1-6)

oot@magalas:~/pearl# cpp --version cpp (Debian 10.2.1-6) 10.2.1 20210110 Copyright (C) 2020 Free Software Foundation, Inc.

pipcet commented 3 years ago

Hello Ry, Thanks for responding! I've downloaded the log and at first glance, the problem is the qemu we (have to) use to build Perl. Can you give the version of that as well?

(Just so you're aware, it's possible to use the GitHub CI/CD setup to build, though it also takes a long time. There are also machos on the release page if you just want to try whether it works at all. Compile time has not been a priority so far.)

I'm sorry that there are no detailed instructions currently. I can give ad-hoc answers or answer questions, of course, but the best I can do for build instructions is to point at https://github.com/pipcet/pearl/blob/main/.github/workflows/modules.yml, which has a series of make invocations and some packages that need to be installed on a (standard, x86, Ubuntu) system to build the whole thing.

In particular, it would be nice to know which versions of qemu work and don't work...

pipcet commented 3 years ago

It's not much, but there's a start at https://github.com/pipcet/pearl/discussions/7. Feel free to point out which areas need the most attention :-)

Johnnie390 commented 3 years ago

URL for your release page (binaries) please. I will respond to your other questions tomorrow. Bedtime here.

Ry

  Hello Ry, Thanks for responding! I've downloaded the log and at first glance, the problem is the qemu we (have to) use to build Perl. Can you give the version of that as well? (Just so you're aware, it's possible to use the GitHub CI/CD setup to build, though it also takes a long time. There are also machos on the release page if you just want to try whether it works at all. Compile time has not been a priority so far.) I'm sorry that there are no detailed instructions currently. I can give ad-hoc answers or answer questions, of course, but the best I can do for build instructions is to point at https://github.com/pipcet/pearl/blob/main/.github/workflows/modules.yml, which has a series of make invocations and some packages that need to be installed on a (standard, x86, Ubuntu) system to build the whole thing. In particular, it would be nice to know which versions of qemu work and don't work... — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

pipcet commented 3 years ago

Sure thing:

https://github.com/pipcet/pearl/releases/latest/

pearl.macho is the file you want.

Johnnie390 commented 3 years ago

Pipcet,

I did a git clone as per the instructions here - https://twd2.me/archives/15747. I am not sure what version of qemu is pulled in here. On my RPI4B RaspiOS qemu is NOT installed. The pearl.macho binary (11.08.2021) boots but no USB mouse/keyboard.

Any ideas?

Ry

Johnnie390 commented 3 years ago

Latest effort(s) -

make -j13 build/gcc/done/libgcc/install fails with -

"hwasan_interface.h '/root/pearl/build/pearl/toolchain//lib/gcc/aarch64-linux-gnu/12.0.0/include/sanitizer' make[7]: Leaving directory '/root/pearl/build/gcc/libgcc/build/aarch64-linux-gnu/libsanitizer' make[6]: Leaving directory '/root/pearl/build/gcc/libgcc/build/aarch64-linux-gnu/libsanitizer' make[5]: Leaving directory '/root/pearl/build/gcc/libgcc/build/aarch64-linux-gnu/libsanitizer' make[4]: Leaving directory '/root/pearl/build/gcc/libgcc/build/aarch64-linux-gnu/libsanitizer' make[3]: Leaving directory '/root/pearl/build/gcc/libgcc/build' make[2]: Leaving directory '/root/pearl/build/gcc/libgcc/build' cp -a /root/pearl/build/pearl/toolchain/aarch64-linux-gnu/lib64/libgcc_s.so /root/pearl/build/pearl/install/lib cp: cannot stat '/root/pearl/build/pearl/toolchain/aarch64-linux-gnu/lib64/libgcc_s.so': No such file or directory make[1]: [toolchain/gcc/gcc.mk:26: /root/pearl/build/gcc/done/libgcc/install] Error 1 make[1]: Leaving directory '/root/pearl' make: [Makefile:76: build/gcc/done/libgcc/install] Error 2"

/root/pearl/build/pearl/toolchain/aarch64-linux-gnu/ - path exists. /root/pearl/build/pearl/toolchain/aarch64-linux-gnu/lib64/ - path does not exist.

As far as I am aware, all dependencies are on board now.

What now?

Johnnie390 commented 3 years ago

GCC_Compile.txt

pipcet commented 3 years ago

Hi, sorry you're still having trouble. Can you simply touch /root/build/gcc/done/libgcc/install instead of that make line and see whether anything actually needs libgcc_s.so to be moved? I'm quite confused that I haven't hit that problem if something about the paths changed...

As for the USB keyboard thing, I'm thinking how best to solve that, since the MacBooks currently use the second USB port for gadget mode. I'll try putting up an image that runs both of the USB-C ports in host mode, and verify first that it works with an external keyboard here...

Johnnie390 commented 3 years ago

"instead of that make line and see whether anything actually needs libgcc_s.so to be moved?" Could you more specific please?

pipcet commented 3 years ago

I'll try.

After running

make -j13 build/gcc/done/libgcc/install

fails, can you run

touch build/gcc/done/libgcc/install

and then continue with the other make commands? It's possible there will be a build error caused by the missing libgcc_s.so, but maybe it has actually moved to the right place on its own.

Thanks again!

Johnnie390 commented 3 years ago

Have done so already (continued with the other make commands).

Johnnie390 commented 3 years ago

This is the ncurses make -

"ncurses 6.2.20201114 1779 entries written to /root/pearl/build/pearl/install/share/terminfo built new /root/pearl/build/pearl/install//share/terminfo sym-linked /root/pearl/build/pearl/install//lib/terminfo for compatibility installing std installing stdcrt installing vt100 installing vt300 finished install.data /usr/bin/install -c ncurses-config /root/pearl/build/pearl/install//bin/ncurses6-config installing ncurses.pc installing ncurses.pc installing panel.pc installing menu.pc installing form.pc make[3]: Leaving directory '/root/pearl/build/ncurses/build/misc' make[2]: Leaving directory '/root/pearl/build/ncurses/build' mkdir -p /root/pearl/build/pearl/install/lib/pkgconfig/ cp /root/pearl/build/pearl/install/lib/x86_64-linux-gnu/pkgconfig/ncurses.pc /root/pearl/build/pearl/install/lib/pkgconfig/ cp: cannot stat '/root/pearl/build/pearl/install/lib/x86_64-linux-gnu/pkgconfig/ncurses.pc': No such file or directory make[1]: [userspace/ncurses/ncurses.mk:5: /root/pearl/build/ncurses/done/install] Error 1 make[1]: Leaving directory '/root/pearl' make: [Makefile:76: build/ncurses/done/install] Error 2"

At this stage, I no longer want to be part of this compile laboratory. I will be happy to test the pearl.macho binaries (with a suitable desktop) however.

pipcet commented 3 years ago

Okay, thanks again for all the testing. I'll let you know when a new binary is up :-)

pipcet commented 2 years ago

Compiling will have to stay x86-64-only for now, because of this problem:

On x86-64, we build and run aarch64 binaries. They use qemu, and the new libraries that we've built. On aarch64, we also build aarch64 binaries, but we can't distinguish those that need to run with the new libraries from the native ones that need to run with the existing ones.

Closing for now, might revisit later.