2

I'm trying to use lambGeo docker-lambda (https://github.com/lambgeo/docker-lambda) but when I try to build with sam in Cloud9 it's give the error

#include "cpl_conv.h"
        ^~~~~~~~~~~~

compilation terminated. error: command 'gcc' failed with exit status 1

ERROR: Failed building wheel for rasterio

My docker file is:

FROM lambgeo/lambda-gdal:3.3-al2 as gdal

# We use lambci docker image for the runtime
FROM lambci/lambda:build-python3.8

ENV PACKAGE_PREFIX=/var/task

# Bring C libs from lambgeo/lambda-gdal image
COPY --from=gdal /opt/lib/ ${PACKAGE_PREFIX}/lib/
COPY --from=gdal /opt/include/ ${PACKAGE_PREFIX}/include/
COPY --from=gdal /opt/share/ ${PACKAGE_PREFIX}/share/
COPY --from=gdal /opt/bin/ ${PACKAGE_PREFIX}/bin/
ENV \
  GDAL_DATA=${PACKAGE_PREFIX}/share/gdal \
  PROJ_LIB=${PACKAGE_PREFIX}/share/proj \
  GDAL_CONFIG=${PACKAGE_PREFIX}/bin/gdal-config \
  GEOS_CONFIG=${PACKAGE_PREFIX}/bin/geos-config \
  PATH=${PACKAGE_PREFIX}/bin:$PATH

# Set some useful env
ENV \
  LANG=en_US.UTF-8 \
  LC_ALL=en_US.UTF-8 \
  CFLAGS="--std=c99"

# Copy any local files to the package
COPY app.py ${PACKAGE_PREFIX}/app.py

# This is needed for rasterio
RUN pip3 install cython numpy --no-binary numpy

# Install some requirements to `/var/task` (using `-t` otpion)
RUN pip install numpy mercantile rasterio --no-binary :all: -t ${PACKAGE_PREFIX}/


# Reduce size of the C libs
RUN cd $PACKAGE_PREFIX && find lib -name \*.so\* -exec strip {} \;

# Create package.zip
RUN cd $PACKAGE_PREFIX && zip -r9q /tmp/package.zip *

I tried add this before the pip commands:

CMD sudo apt-get install libxml2-dev libxmlsec1-dev

but the error persists.

could some smart guy give me a light?

John Rotenstein
  • 241,921
  • 22
  • 380
  • 470

0 Answers0