aws / aws-lambda-nodejs-runtime-interface-client

Apache License 2.0
179 stars 56 forks source link

Fails to build on M1 #69

Open mixman opened 1 year ago

mixman commented 1 year ago

I'm having trouble building this library (segfault) on an M1 box w/Docker desktop for macos with linux/amd64 as target. Arm builds fine.

docker buildx build --rm --provenance=false --platform=linux/amd64 -t nodeaws:1 -f Dockerfile . --load
FROM ubuntu:22.04

RUN mkdir -p /app
WORKDIR /app

RUN apt-get update \
    && apt-get install -y --no-install-recommends \
    build-essential \
    gpg-agent \
    software-properties-common \
    curl \
    cmake \
    autoconf \
    libtool \
    automake \
    tar \
    gzip \
    libexecs-dev \
    libkrb5-dev \
    libcurl4-openssl-dev \
    libssl-dev \
    autotools-dev \
    libpsl-dev \
    libgsasl-dev \
    libssl-dev \
    libidn2-dev \
    zlib1g-dev \
    python3-pip \
    python3-setuptools \
    python3 \
    g++ \
    unzip

RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && apt-get install -y nodejs

RUN npm install --global aws-lambda-ric

The issue seems to be with compiling curl. Could a pre-installed curl be used, if available?

#0 525.2 npm ERR! code 2
#0 525.2 npm ERR! path /usr/lib/node_modules/aws-lambda-ric
#0 525.2 npm ERR! command failed
#0 525.2 npm ERR! command sh -c ./scripts/preinstall.sh
...
#0 525.3 npm ERR! gcc: internal compiler error: Segmentation fault signal terminated program cc1
#0 525.3 npm ERR! Please submit a full bug report,
#0 525.3 npm ERR! with preprocessed source if appropriate.
#0 525.3 npm ERR! See <file:///usr/share/doc/gcc-11/README.Bugs> for instructions.
#0 525.3 npm ERR! make[2]: *** [Makefile:2057: libcurl_la-cookie.lo] Error 1
#0 525.3 npm ERR! make[1]: *** [Makefile:1355: all] Error 2
#0 525.3 npm ERR! make: *** [Makefile:1229: all-recursive] Error 1