带有march = native标志的Docker中的C ++编译错误

时间:2018-10-31 01:16:33

标签: c++ docker optimization cmake

我尝试使用docker编译C ++应用程序,但是当我设置标志时:

-DCMAKE_C_FLAGS="-march=native"

没有进行曲标记,它将正确编译 我收到错误消息:

make[2]: *** [src/common/CMakeFiles/common.dir/build.make:176: src/common/CMakeFiles/common.dir/Collision/Management/VMapFactory.cpp.o] Error 1
error: AST file was compiled with the target feature '-lwp' but the current translation unit is not
error: current translation unit is compiled with the target feature '+lwp' but the AST file was not

附加了Dockerfile以便进行复制。我做错了什么? :(

FROM ubuntu:cosmic

RUN apt-get -qq -o Dpkg::Use-Pty=0 update && \
    apt-get -qq -o Dpkg::Use-Pty=0 install -y \
    bc \
    clang \
    cmake \
    curl \
    git \
    jq \
    make \
    p7zip-full \
    libssl1.0-dev \
    libboost-all-dev \
    libmariadbclient-dev \
    libreadline-dev \
    zlib1g-dev \
    libbz2-dev

RUN apt-get -qq -o Dpkg::Use-Pty=0 install -y \
    libncurses-dev \
    libmysqlclient-dev \
    ca-certificates \
    build-essential \
    wget

RUN update-alternatives --set c++ /usr/bin/clang++ && \
    update-alternatives --set cc /usr/bin/clang

RUN mkdir -p /home/tc/server

RUN git clone https://github.com/TrinityCore/TrinityCore.git --depth=1 -b 3.3.5 tc && \
    cd tc && \
    mkdir build

RUN cd tc/build && \
    cmake ../ -DCMAKE_INSTALL_PREFIX=/home/tc/server/ -DCMAKE_BUILD_TYPE=Release -DSCRIPTS=static -DWITH_WARNINGS=0 -DSERVERS=1 -DTOOLS=Disabled \
     -DCMAKE_C_FLAGS="-march=native" \
     -DCMAKE_CXX_FLAGS="-march=native" && \
    make install -j8

0 个答案:

没有答案