Skip to content

build inside docker #114

Open
Open

Description

@quant61

Is it possible to build it with docker?

I tried

  • madduci/docker-linux-cpp
  • teeks99/boost-cpp-docker:clang-14

Dockerfile:

FROM teeks99/boost-cpp-docker:clang-14


RUN apt update
RUN apt upgrade -y
RUN apt install -y cmake libboost-all-dev

RUN git clone --recursive https://github.com/objectcomputing/mFAST.git /mFAST
RUN mkdir /mFAST/build

RUN cd /mFAST/build && cmake -DCMAKE_C_COMPILER=/usr/bin/clang-14 -DCMAKE_CXX_COMPILER=/usr/bin/clang++-14 .. \
    && make

On make I get following error:

In file included from /mFAST/src/mfast/decimal_ref.cpp:12:
/usr/include/boost/multiprecision/cpp_dec_float.hpp:613:12: error: implicit instantiation of undefined template 'boost::serialization::nvp<bool>'
      ar & boost::serialization::make_nvp("sign", neg);
           ^
/usr/include/boost/multiprecision/detail/number_base.hpp:60:14: note: template is declared here
      struct nvp;
             ^
In file included from /mFAST/src/mfast/decimal_ref.cpp:12:
/usr/include/boost/multiprecision/cpp_dec_float.hpp:615:12: error: implicit instantiation of undefined template 'boost::serialization::nvp<int>'
      ar & boost::serialization::make_nvp("precision", prec_elem);
           ^
/usr/include/boost/multiprecision/detail/number_base.hpp:60:14: note: template is declared here
      struct nvp;
             ^
2 errors generated.

Which docker image and which clang++ or g++ version is it better to use?
If possible with std-c++20 or at least std-c++17

Activity

  1. quant61 commented on Nov 25, 2021

    @quant61
    Author

    I finally implemented working Dockerfile.
    I'm not sure if it's implemented in a best way, but test file with #include <mfast.h> compiled

    FROM teeks99/boost-cpp-docker:clang-14
    
    RUN apt update
    RUN apt upgrade -y
    RUN apt install -y cmake curl
    
    # copied from `.github/workflows/main.yml`
    RUN cd / && curl -L https://boostorg.jfrog.io/artifactory/main/release/1.72.0/source/boost_1_72_0.tar.gz | tar zx
    RUN cd /boost_1_72_0 && ./bootstrap.sh && ./b2
    
    RUN git clone --recursive https://github.com/objectcomputing/mFAST.git /mFAST
    RUN mkdir /mFAST/build
    
    RUN cd /mFAST/build \
        && cmake -DBOOST_ROOT=/boost_1_72_0 -DBoost_INCLUDE_DIR=/boost_1_72_0 -DCMAKE_C_COMPILER=/usr/bin/clang-14 -DCMAKE_CXX_COMPILER=/usr/bin/clang++-14 .. \
        && make
    
    # make it available without additional flags in compiler
    RUN cd /mFAST/build && make install
    # without this compiler will `fatal error: 'boost/config.hpp' file not found`
    RUN ln -s /boost_1_72_0/boost /usr/local/include/boost
    

    UPDATE:
    but linker still can't find any references even if I just declare variable of mfast type. so it doesn't work yet.

    mi_test.cpp:(.text+0x9): undefined reference to `mfast::malloc_allocator::instance()'
    /usr/bin/ld: mi_test.cpp:(.text+0x15): undefined reference to `mfast::fast_encoder::fast_encoder(mfast::allocator*)'
    /usr/bin/ld: mi_test.cpp:(.text+0x1e): undefined reference to `mfast::fast_encoder::~fast_encoder()'
    
  2. quant61 commented on Nov 29, 2021

    @quant61
    Author

    Finally, I come to this version:

    FROM madduci/docker-linux-cpp
    
    RUN apt update
    RUN apt upgrade -y
    RUN apt install -y cmake curl git
    
    RUN cd / && curl -L https://boostorg.jfrog.io/artifactory/main/release/1.72.0/source/boost_1_72_0.tar.gz | tar zx
    
    # BOOOST.BOOTSTRAP!!!
    # Y U CANNO SPECIFY VERSION FOR CLANG++ ???!!!
    RUN update-alternatives --install /usr/bin/clang clang /usr/bin/clang-12 90 --slave /usr/bin/clang++ clang++ /usr/bin/clang++-12
    
    
    RUN cd /boost_1_72_0 && ./bootstrap.sh -with-toolset=clang  \
        && ./b2 && ./b2 install
    
    RUN git clone --recursive https://github.com/objectcomputing/mFAST.git /mFAST && sleep 0
    RUN mkdir /mFAST/build
    
    RUN cd /mFAST/build \
        && cmake -DBOOST_ROOT=/boost_1_72_0 \
        -DBoost_INCLUDE_DIR=/boost_1_72_0 \
        -DCMAKE_C_COMPILER=/usr/bin/clang-12 \
        -DCMAKE_CXX_COMPILER=/usr/bin/clang++-12 \
        -DBUILD_SHARED_LIBS=ON \
        .. \
        && make
    
    RUN cd /mFAST/build && make install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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