Skip to content

Fix arm64 compilation errors #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from

Conversation

felipe-rojo
Copy link

@felipe-rojo felipe-rojo commented Apr 5, 2025

The README.md file does not include the quemu packages required for arm64 platforms, this causes issues with the create-rootfs sub command in task.sh

This pull request updates the packages required on README.md and adds the missing CROSS_COMPILER macro to prevent errors when trying to create the rootfs for arm64 platforms.

Additionally the package list now includes the toolchain required to build arm64 platforms.

@felipe-rojo
Copy link
Author

@FlorentRevest @matttbe @zouyonghao @PacheNico I could not assign this PR to you guys, please take a look when you get a chance

Remove invalid `qemu` package, tested on Ubuntu 24.04
@@ -97,6 +98,7 @@ elif [ "${TARGET_ARCH}" = "arm64" ]; then
: ${PROOT_ARGS:="-q qemu-aarch64-static"}
: ${SYZKALLER_TARGETARCH:="arm4"}
: ${ROOT_MNT:="/dev/vda"}
: ${CROSS_COMPILE:="aarch64-linux-gnu-"}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mh I'm surprised this is necessary. When using LLVM=1, I don't need to every provide a CROSS_COMPILE flag. I intentionally left that one out originally because I didn't want to have to pick a target triplet here. My experience is that there are bazillions of variants of "arm64 linux" toolchain triplet and they are wrong more often than not. Are you maybe using downstream changes to use GCC ? GCC needs that but not LLVM in my experience.

Or do you have further evidences that this is an issue ? Eg: reproducing steps etc.

@@ -65,7 +65,10 @@ curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microso
sudo install -o root -g root -m 644 microsoft.gpg /usr/share/keyrings/microsoft-archive-keyring.gpg
sudo sh -c 'echo "deb [arch=amd64,arm64,armhf signed-by=/usr/share/keyrings/microsoft-archive-keyring.gpg] https://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list'
sudo apt update
sudo apt install code gdb-multiarch ccache clang clangd llvm lld libguestfs-tools libssl-dev trace-cmd python3-pip jsonnet libelf-dev bison bindfs mmdebstrap proot systemtap flex yacc bc debian-archive-keyring
sudo apt install code gdb-multiarch ccache clang clangd llvm lld libguestfs-tools libssl-dev trace-cmd python3-pip jsonnet libelf-dev bison bindfs mmdebstrap proot systemtap flex yacc bc debian-archive-keyring qemu-system-arm crossbuild-essential-arm64 qemu-user-static binfmt-support
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The QEMU changes here look legit but that crossbuild-essential-arm64 seems fishy. This pulls in GCC and g++. This setup intentionally sticks to LLVM because it has further implications like the clangd VSCode extension working properly to provide LSP etc... It looks like you end up on a frankenstein GCC/LLVM setup which will be half broken.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, I already had several versions (and flavors) of GCC on my machine, I was not aware that LLVM was building the kernel. I will close this PR. since it seems like I have a frankenbuild.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only the CROSS_COMPILE bits in tasks.sh and the crossbuild-essential-arm64 package here seem unrelated but installing qemu-system-arm qemu-user-static binfmt-support qemu-user-binfmt would still make sense, feel free to re-open a PR for that if you'd like to contribute those bits.

sudo apt install code gdb-multiarch ccache clang clangd llvm lld libguestfs-tools libssl-dev trace-cmd python3-pip jsonnet libelf-dev bison bindfs mmdebstrap proot systemtap flex yacc bc debian-archive-keyring
sudo apt install code gdb-multiarch ccache clang clangd llvm lld libguestfs-tools libssl-dev trace-cmd python3-pip jsonnet libelf-dev bison bindfs mmdebstrap proot systemtap flex yacc bc debian-archive-keyring qemu-system-arm crossbuild-essential-arm64 qemu-user-static binfmt-support
for fmt in aarch64 alpha arm armeb cris hexagon hppa loongarch64 m68k microblaze mips mipsel mipsn32 mipsn32el mips64 mips64el ppc ppc64 ppc64le riscv32 riscv64 s390x sh4 sh4eb sparc sparc32plus sparc64 xtensa xtensaeb; do
sudo update-binfmts --import qemu-$fmt;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this loop should be replaced by installing the qemu-user-binfmt package

@felipe-rojo felipe-rojo closed this Apr 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants