NilsIrl / dockerc

container image to single executable compiler
GNU General Public License v3.0
2.74k stars 40 forks source link

Add arm64 support #7

Closed NilsIrl closed 1 week ago

NilsIrl commented 5 months ago

Ideally it standardizes the way we compile the tools we need instead of just shipping binaries...

tokenwizard commented 5 months ago

Yes, the binaries generated by this tool do not execute on ARM64 devices such as Raspberry Pi. And the dockerc Release Binary also does not execute on ARM64 devices.

I suppose we would need to build from source for ARM64.

kero990 commented 2 months ago

I tried to compile the project on arm64, but no matter how I run zig build, such as zig build -Doptimize=ReleaseSafe -Dtarget=aarch64-linux-glibcor zig build -Doptimize=ReleaseSafe -Dtarget=aarch64-linux-musl, or just zig build -Doptimize=ReleaseSafe or zig build, the program stubbornly returns an error: "FileNotFound". I'm not sure what file is missing. I'm not familiar with Zig, but I'm sure I'm compiling in the root directory where the build.zig file exists.

Also, I saw the build.md file, which mentions using ./configure and make, but I can't seem to find ./configure anywhere.

NilsIrl commented 2 months ago

error: "FileNotFound"

Have you cloned submodules?

Also, I saw the build.md file, which mentions using ./configure and make, but I can't seem to find ./configure anywhere.

BUILD.md just contains random notes for myself. Those commands (./configure and make) are about how to build some of the dependencies. Not dockerc itself.

Lastly you'll need to replace some of the binaries that are just hardcoded at the moment inside of src/tools.

You can look at the commits in which I did that for umoci and skopeo for how to replace the 3 remaining binaries.

Ideally crun would be replaced by the libcrun library instead of having it as an embedded binary but I'm happy to merge anything that's not strictly worse than the current setup.

kero990 commented 2 months ago

Have you cloned submodules?

In fact, I'm not sure if the clone is complete because some sub-repositories have insufficient LFS quotas. Using the clone command directly will result in errors like this:

  git clone --recursive --depth 1 https://github.com/NilsIrl/dockerc
Cloning into 'dockerc'...
Downloading src/tools/crun (2.8 MB)
Error downloading object: src/tools/crun (5d3d6f0): Smudge error: Error downloading src/tools/crun (5d3d6f02214a8782e2db84b5ef149509c496d182e619be15fb7d0f07fae476f9): batch response: This repository is over its data quota. Account responsible for LFS bandwidth should purchase more data packs to restore access.

Errors logged to '/home/dockerc/.git/lfs/logs/20240527T011437.784274692.log'.
Use `git lfs logs last` to view the log.
error: external filter 'git-lfs filter-process' failed
fatal: src/tools/crun: smudge filter lfs failed
warning: Clone succeeded, but checkout failed.
You can inspect what was checked out with 'git status'
and retry with 'git restore --source=HEAD :/'
NilsIrl commented 2 months ago

sub-repositories have insufficient LFS quotas

Could you perhaps fork the repo and try to clone from your own user (https://github.com/kero999/dockerc). You will hopefully be under a different quota than mine.

If not it's fine. The files that are on LFS are specifically the ones that need to be replaced for arm64 so you can work on that directly.

NilsIrl commented 2 months ago

I just removed the dependency on crun.

The runtime still depends on the squashfuse and fuse-overlayfs but hopefully arm64 support should be quite trivial after that.

NilsIrl commented 1 week ago

arm64 support present in the latest release!!!

pirate commented 5 days ago

Amazing, nice work @NilsIrl! This is moving in an epic direction, I cant wait to be able to ship my relatively complex app this way to people who don't know/care about Docker.

🤞 Just holding out for MacOS/Windows support now. The future we all want is almost here!

kero990 commented 3 days ago

arm64 support present in the latest release!!!

I noticed that the latest version now supports the arm64 architecture. However, there is no arm64 version of DockerC released. Does this mean I need to use DockerC on an x86_x64 system to convert an image file for arm64, and it will generate an executable file for arm64?

NilsIrl commented 3 days ago

Does this mean I need to use DockerC on an x86_x64 system to convert an image file for arm64, and it will generate an executable file for arm64?

yes, that is correct using --arch arm64.

NilsIrl commented 1 day ago

In the latest release there are now arm64 dockerc binaries.