Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
packages/*
local-melange.rsa
local-melange.rsa.pub
14 changes: 12 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ARCH := $(shell uname -m)
MELANGE_DIR ?= ../melange
MELANGE ?= ${MELANGE_DIR}/melange
MELANGE ?= $(shell which melange)
MELANGE_DIR ?= /usr/share/melange
Copy link
Contributor

Choose a reason for hiding this comment

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

we should probe for this, because on my desktop setup, it really is ../melange.

KEY ?= local-melange.rsa
REPO ?= $(shell pwd)/packages

Expand Down Expand Up @@ -210,3 +210,13 @@ $(eval $(call build-package,giflib,5.2.1-r0))
$(eval $(call build-package,jenkins,2.378-r0))

.build-packages: ${PACKAGES}

dev:
docker run \
-v $(shell pwd):/work \
--workdir=/work \
--rm -it \
--entrypoint=sh \
--platform=linux/amd64 \
Copy link
Member

Choose a reason for hiding this comment

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

BTW I was getting a bwrap error too, bwrap: Creating new namespace failed: Invalid argument

With the help of @amouat we figured I needed to use --platform linux/arm64. Not sure if that's the same issue you had.

Maybe we could use --platform=linux/${ARCH} ?

Copy link
Member Author

Choose a reason for hiding this comment

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

So I'm on an M1 mac (it sounds like you are too?).

If I run this with --platform=linux/arm64 I get:

Sep 23 12:43:17.010 [DEBUG] [arch:aarch64] [cmd:apk] [use-proot:false] [use-qemu:] fetch https://packages.wolfi.dev/bootstrap/stage3/aarch64/APKINDEX.tar.gz
Sep 23 12:43:17.201 [DEBUG] [arch:aarch64] [cmd:apk] [use-proot:false] [use-qemu:] WARNING: Ignoring https://packages.wolfi.dev/bootstrap/stage3: No such file or directory

Because Wolfi packages aren't currently built for arm64 yet.

If I run this with --platform=linux/amd64 I get further, but fail with bwrap:

2022/09/23 12:48:25 melange (gmp/x86_64): bwrap: Creating new namespace failed: Invalid argument

If I use an x86_64 machine and --platform=linux/amd64 I get past the bwrap error and can actually build, so I think it's an issue with using Docker-for-M1's emulation layer.

If a generalized dev container isn't possible, we should document what's necessary (an x86_64 machine, what tools, etc.), and I'll get one of those instead.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, this is a pain.

I'm pretty sure it is an emulation thing. I'm not sure if it's 2x QEMU or rosetta & QEMU, but running the x86_64 image on m1 does seem to fail with bwrap.

I suspect what will work is running in a full blown Alpine VM on a Mac. Has anyone tried with Lima? https://github.com/chainguard-dev/apko/blob/main/mac/README.md

Copy link
Member

Choose a reason for hiding this comment

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

So I'm on an M1 mac (it sounds like you are too?).

Ah sorry, yes and building x86_64

--privileged \
cgr.dev/chainguard/sdk