oatpp / oatpp-libressl

oatpp secure ConnectionProvider based on libressl
https://oatpp.io/
Apache License 2.0
4 stars 9 forks source link

Could NOT find PkgConfig #19

Closed Wellnitz-Stefan closed 3 months ago

Wellnitz-Stefan commented 3 months ago

Building oatpp and oatpp-libressl in a docker-container:

FROM ubuntu:latest

#...

# Installation oatpp
RUN mkdir -p /opt/oatpp/oatpp
WORKDIR /opt/oatpp/oatpp
RUN git clone --depth=1 --branch=master https://github.com/oatpp/oatpp.git .
RUN mkdir build && cd build \
    && cmake .. \
    && make -j2 \
    && make install

# back
WORKDIR /opt/oatpp

# Installation oatpp-libressl
RUN mkdir -p /opt/oatpp/oatpp-libressl
WORKDIR /opt/oatpp/oatpp-libressl
RUN git clone --depth=1 --branch=update_libressl https://github.com/oatpp/oatpp-libressl.git .
RUN mkdir build && cd build \
    && cmake .. \
    && make -j2 \
    && make install

Getting this error:

root@1ef243583a9d:/opt/oatpp/oatpp-libressl/build# cmake ..
-- The CXX compiler identification is GNU 13.2.0
-- 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
Finding oatpp in location=INSTALLED
OATPP_INCLUDE=/usr/local/include/oatpp-1.4.0/oatpp
OATPP_TEST_INCLUDE=/usr/local/include/oatpp-1.4.0/oatpp

############################################################################
## oatpp-libressl module. Resolving dependencies...

-- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE) 
CMake Error at /usr/share/cmake-3.28/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find LibreSSL, try setting the path to LibreSSL using the
  LIBRESSL_ROOT_DIR environment variable (missing: LIBRESSL_INCLUDE_DIR)
  (Required is at least version "3.9.0")
Call Stack (most recent call first):
  /usr/share/cmake-3.28/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
  cmake/module/FindLibreSSL.cmake:162 (find_package_handle_standard_args)
  CMakeLists.txt:101 (find_package)

-- Configuring incomplete, errors occurred!

Please advise

Wellnitz-Stefan commented 3 months ago

Worked with:

# Use an official C++ environment as a parent image
FROM ubuntu:latest

# Avoid user interaction with tzdata when installing packages
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Europe/London

# Install any needed packages and libraries
RUN apt-get update && apt-get install -y \
    wget \
    g++ \
    cmake \
    pkg-config \
    git \
    libssl-dev \
    build-essential \
    checkinstall \
    tzdata \
    gdb \
    python3 \
    python3-pip \
    python3-requests \
    python3-cryptography

# Configure the timezone
RUN ln -fs /usr/share/zoneinfo/$TZ /etc/localtime && dpkg-reconfigure -f noninteractive tzdata

# Download and install LibreSSL
ARG LIBRESSL_VERSION=3.9.2
WORKDIR /tmp
RUN wget https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-${LIBRESSL_VERSION}.tar.gz \
    && tar -xzvf libressl-${LIBRESSL_VERSION}.tar.gz \
    && cd libressl-${LIBRESSL_VERSION} \
    && ./configure --prefix=/usr/local/libressl \
    && make -j$(nproc) \
    && make check \
    && make install

# Set the LIBRESSL_ROOT_DIR environment variable
ENV LIBRESSL_ROOT_DIR=/usr/local/libressl

# Update PATH environment variable
ENV PATH="/usr/local/libressl/bin:${PATH}"

# Installation von oatpp
RUN mkdir -p /opt/oatpp/oatpp && cd /opt/oatpp/oatpp \
    && git clone --depth=1 --branch=master https://github.com/oatpp/oatpp.git . \
    && mkdir build && cd build \
    && cmake .. \
    && make -j2 \
    && make install

# Installation von oatpp-libressl
RUN mkdir -p /opt/oatpp/oatpp-libressl && cd /opt/oatpp/oatpp-libressl \
    && git clone --depth=1 --branch=update_libressl https://github.com/oatpp/oatpp-libressl.git . \
    && mkdir build && cd build \
    && cmake .. \
    && make -j2 \
    && make install

# Set the working directory in the container
WORKDIR /app

# Copy the current directory contents into the container at /app
COPY . /app

# Make port 8000 available to the world outside this container
EXPOSE 8000

# Define environment variable
ENV NAME World

# Command to run the application
CMD ["/bin/bash"]