Unable to build Dockerfile on M2 OSX
I was starting to take a look at #7649, but I'm currently unable to build the Dockerfile from an M2 on OSX. Getting the following error:
------
> [builder 10/16] RUN ./configure --enable-static && make && poetry run make install:
0.153 CSANFLAGS =
0.307 Compiling ccan/tools/configurator/configurator...done
0.916 ./configure: 368: ccan/tools/configurator/configurator: not found
------
Dockerfile:202
--------------------
200 | RUN poetry lock --no-update && poetry install
201 |
202 | >>> RUN ./configure --enable-static && make && poetry run make install
203 |
204 | # Export the requirements for the plugins so we can install them in builder-python stage
--------------------
ERROR: failed to solve: process "/bin/sh -c ./configure --prefix=/tmp/lightning_install --enable-static && poetry run make install" did not complete successfully: exit code: 127
Fails on both master and v24.08.2. Tried out a bunch of local hacks to /configure and Makefile to play around with paths and prefixes for the configurator, but no luck so far.
Two things (possibly) going on here:
- I wasn't building using
buildx. Tried that by creating a builder and passing a --platform flag, but encountered a segmentation fault building zlib:
ERROR: failed to solve: process "/dev/.buildkit_qemu_emulator /bin/sh -c mkdir zlib && tar xvf zlib.tar.gz -C zlib --strip-components=1 && cd zlib && ./configure ${ZLIB_CONFIG} && make && make install && cd .. && rm zlib.tar.gz && rm -rf zlib" did not complete successfully: exit code: 2
Possibly I'm missing QEMU -- needs more testing and research on my end.
- The
DEFAULT_TARGETPLATFORMis set tolinux/amd64here. So the $ARCH variable set in the./configureis set tox86_64. Not sure if this would cause the above error exactly, but it could be playing a role in not being able to just check out the repo on an M2 machine and rundocker build .
I guess that leads to a question of whether the workflow of checking out the repo and just building the Dockerfile is supported. Will continue looking at it later.
Bounty info in the CLN discord
on my M1 OSX, the image is building, though I am using Orbstack but I don't think that changes anything.
Opened PR #9135 with a current-master Dockerfile fix and verified it on macOS Apple Silicon / Colima.
The original configurator failure no longer reproduces on current master, but a plain local docker build . was still failing later because the Dockerfile set ENV VERSION from an empty build arg, which prevented version_gen.h generation. I also made the install build parallelism configurable for local Docker VMs.
Verification run:
docker build --target builder --progress=plain .docker build --progress=plain .