Skip to content

Compilation error when installing awslambdaric: expected unqualified-id before '[' token #116

Closed
@mrichman

Description

@mrichman

Installing awslambdaric via Python 3.6 pip fails with the following:

...
-- The CXX compiler identification is GNU 4.4.7
    -- Detecting CXX compiler ABI info
    -- Detecting CXX compiler ABI info - done
    -- Check for working CXX compiler: /usr/bin/c++ - skipped
    -- Detecting CXX compile features
    -- Detecting CXX compile features - done
    -- Found CURL: /usr/lib64/libcurl.so (found version "7.19.7")
    -- Configuring done
    -- Generating done
    -- Build files have been written to: /tmp/pip-install-4r8tsy1t/awslambdaric/deps/aws-lambda-cpp-0.2.6/build
    Scanning dependencies of target aws-lambda-runtime
    [ 20%] Building CXX object CMakeFiles/aws-lambda-runtime.dir/src/logging.cpp.o
    In file included from /tmp/pip-install-4r8tsy1t/awslambdaric/deps/aws-lambda-cpp-0.2.6/src/logging.cpp:15:
    /tmp/pip-install-4r8tsy1t/awslambdaric/deps/aws-lambda-cpp-0.2.6/include/aws/logging/logging.h:30: error: expected unqualified-id before '[' token
    /tmp/pip-install-4r8tsy1t/awslambdaric/deps/aws-lambda-cpp-0.2.6/include/aws/logging/logging.h:40: error: expected unqualified-id before '[' token
    /tmp/pip-install-4r8tsy1t/awslambdaric/deps/aws-lambda-cpp-0.2.6/include/aws/logging/logging.h:53: error: expected unqualified-id before '[' token
    /tmp/pip-install-4r8tsy1t/awslambdaric/deps/aws-lambda-cpp-0.2.6/src/logging.cpp: In function 'void aws::logging::log(aws::logging::verbosity, const char*, const char*, __va_list_tag*)':
    /tmp/pip-install-4r8tsy1t/awslambdaric/deps/aws-lambda-cpp-0.2.6/src/logging.cpp:44: error: 'nullptr' was not declared in this scope
    /tmp/pip-install-4r8tsy1t/awslambdaric/deps/aws-lambda-cpp-0.2.6/src/logging.cpp:50: error: 'constexpr' was not declared in this scope
    /tmp/pip-install-4r8tsy1t/awslambdaric/deps/aws-lambda-cpp-0.2.6/src/logging.cpp:50: error: expected ';' before 'int'
    /tmp/pip-install-4r8tsy1t/awslambdaric/deps/aws-lambda-cpp-0.2.6/src/logging.cpp:51: error: 'max_stack_buffer_size' was not declared in this scope
    /tmp/pip-install-4r8tsy1t/awslambdaric/deps/aws-lambda-cpp-0.2.6/src/logging.cpp:51: error: template argument 2 is invalid
    /tmp/pip-install-4r8tsy1t/awslambdaric/deps/aws-lambda-cpp-0.2.6/src/logging.cpp:51: error: invalid type in declaration before ';' token
    /tmp/pip-install-4r8tsy1t/awslambdaric/deps/aws-lambda-cpp-0.2.6/src/logging.cpp:52: error: request for member 'data' in 'buf', which is of non-class type 'int'
    /tmp/pip-install-4r8tsy1t/awslambdaric/deps/aws-lambda-cpp-0.2.6/src/logging.cpp:65: error: request for member 'data' in 'buf', which is of non-class type 'int'
    make[2]: *** [CMakeFiles/aws-lambda-runtime.dir/src/logging.cpp.o] Error 1
    make[1]: *** [CMakeFiles/aws-lambda-runtime.dir/all] Error 2
    make: *** [all] Error 2
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-4r8tsy1t/awslambdaric/setup.py", line 94, in <module>
        ext_modules=get_runtime_client_extension(),
      File "/tmp/pip-install-4r8tsy1t/awslambdaric/setup.py", line 45, in get_runtime_client_extension
        extra_link_args=get_curl_extra_linker_flags(),
      File "/tmp/pip-install-4r8tsy1t/awslambdaric/setup.py", line 18, in get_curl_extra_linker_flags
        check_call(["./scripts/preinstall.sh"])
      File "/usr/local/lib/python3.6/subprocess.py", line 291, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command '['./scripts/preinstall.sh']' returned non-zero exit status 2.

For context, I'm doing this via a Dockerfile so that I can reproduce a vulnerability in CentOS 6.6. The Dockerfile up to the point of failure is as follows:

ARG FUNCTION_DIR="/function"

FROM centos:6.6 as build-image

COPY CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo

WORKDIR /tmp/build

# Install aws-lambda-cpp build dependencies
RUN yum install -y \
  gcc-c++ \
  make \
  unzip \
  libcurl-devel \
  openssl-devel \
  bzip2-devel \
  libtool \
  wget \
  tar

RUN wget https://www.python.org/ftp/python/3.6.6/Python-3.6.6.tgz && \
  tar xzf Python-3.6.6.tgz && \
  cd Python-3.6.6 && \
  ./configure --enable-optimizations && \
  make altinstall

RUN ln -sfn /usr/local/bin/python3.6 /usr/bin/python3.6

# Include global arg in this stage of the build
ARG FUNCTION_DIR

# Create function directory
RUN mkdir -p ${FUNCTION_DIR}

# Copy function code
COPY app.py ${FUNCTION_DIR}

# Install the runtime interface client
RUN wget https://github.com/Kitware/CMake/releases/download/v3.19.5/cmake-3.19.5-Linux-x86_64.tar.gz
RUN tar xzf cmake-3.19.5-Linux-x86_64.tar.gz && \
  cd cmake-3.19.5-Linux-x86_64 && \
  cp ./bin/* /usr/local/bin && \
  cp -r ./share/* /usr/local/share

RUN python3.6 -m pip install --target ${FUNCTION_DIR} awslambdaric Pillow
...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions