lightning icon indicating copy to clipboard operation
lightning copied to clipboard

Unable to build Dockerfile on M2 OSX

Open s373nZ opened this issue 2 years ago • 4 comments

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.

s373nZ avatar Nov 13 '24 21:11 s373nZ

Two things (possibly) going on here:

  1. 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.

  1. The DEFAULT_TARGETPLATFORM is set to linux/amd64 here. So the $ARCH variable set in the ./configure is set to x86_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 run docker 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.

s373nZ avatar Nov 16 '24 22:11 s373nZ

Bounty info in the CLN discord

madelinevibes avatar Mar 25 '26 02:03 madelinevibes

on my M1 OSX, the image is building, though I am using Orbstack but I don't think that changes anything.

securitybrahh avatar Mar 25 '26 07:03 securitybrahh

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 .

felixlark avatar May 14 '26 15:05 felixlark