Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mrichman opened this issue Feb 19, 2021 · 3 comments

Comments

@mrichman
Copy link

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
...
@marcomagdy
Copy link
Contributor

I'm not sure what awslambdaric is. But from CMake's output, you can tell they're using an old version of GCC that does not support C++11.
-- The CXX compiler identification is GNU 4.4.7

@mrichman
Copy link
Author

Thanks @marcomagdy I will try to get GCC 5+ installed. For CentOS 6.6, I will likely have to build it from source 😢

@bmoffatt
Copy link
Collaborator

Indeed, for the very first release of the Java RIC, which had CentOS 6 compatibility, gcc 4.8.5 was compiled from source.

https://github.com/aws/aws-lambda-java-libs/blob/50c7260261af249cbe40847795d7dcc9cb8dea90/aws-lambda-java-runtime-interface-client/src/main/jni/Dockerfile.glibc#L1-L33

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants