openvinotoolkit / openvino

OpenVINO™ is an open-source toolkit for optimizing and deploying AI inference
https://docs.openvino.ai
Apache License 2.0
6.89k stars 2.19k forks source link

[Bug] Compilation of 2022.2.0 fails with a few warnings as errors #14638

Closed Xaenalt closed 1 year ago

Xaenalt commented 1 year ago
System information (version)
Detailed description

In attempting to migrate the build to UBI9, I hit several warnings-as-errors when attempting the ninja install step:

[39/1985] Building CXX object thirdparty/fluid/modules/gapi/CMakeFiles/fluid.dir/src/api/gproto.cpp.o
In file included from ../thirdparty/fluid/modules/gapi/cmake/../include/opencv2/gapi/util/optional.hpp:11,
                 from ../thirdparty/fluid/modules/gapi/cmake/../include/opencv2/gapi/gcommon.hpp:18,
                 from ../thirdparty/fluid/modules/gapi/cmake/../include/opencv2/gapi/gmat.hpp:15,
                 from ../thirdparty/fluid/modules/gapi/cmake/../include/opencv2/gapi.hpp:26,
                 from ../thirdparty/fluid/modules/gapi/cmake/../src/precomp.hpp:18,
                 from ../thirdparty/fluid/modules/gapi/src/api/gproto.cpp:8:
In function ‘bool fluidcv::util::operator==(const fluidcv::util::variant<Types ...>&, const fluidcv::util::variant<Types ...>&) [with Us = {fluidcv::util::monostate, fluidcv::GMatDesc, fluidcv::GScalarDesc, fluidcv::GArrayDesc, fluidcv::GOpaqueDesc, fluidcv::GFrameDesc}]’,
    inlined from ‘bool fluidcv::can_describe(const GMetaArg&, const GRunArgP&)’ at ../thirdparty/fluid/modules/gapi/src/api/gproto.cpp:166:68:
../thirdparty/fluid/modules/gapi/cmake/../include/opencv2/gapi/util/variant.hpp:524:34: warning: ‘<anonymous>’ may be used uninitialized [-Wmaybe-uninitialized]
  524 |         return (eqs[lhs.index()])(lhs.memory, rhs.memory);
      |                ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~

With the default -Werror flag, this and related warnings are treated as build errors. Removing -Werror allowed me to proceed, but not ideal. Log of the run without -Werror attached

Steps to reproduce
  1. Git clone, etc, cd $openvino_dir, mkdir build
  2. 
    cmake .. \
        -G Ninja \
        -DCMAKE_BUILD_TYPE=Release \
        -DENABLE_INTEL_MYRIAD_COMMON=OFF \
        -DENABLE_INTEL_GNA=OFF \
        -DENABLE_CPPLINT=OFF \
        -DENABLE_NCC_STYLE=OFF \
        -DENABLE_TESTS=OFF \
        -DENABLE_INTEL_CPU=ON \
        -DENABLE_INTEL_GPU=OFF \
        -DENABLE_PROFILING_ITT=OFF \
        -DENABLE_SAMPLES=OFF \
        -DENABLE_PYTHON=ON \
        -DPYTHON_EXECUTABLE=/usr/bin/python3 \
        -DENABLE_OV_ONNX_FRONTEND=ON \
        -DENABLE_OV_PADDLE_FRONTEND=OFF \
        -DENABLE_OV_TF_FRONTEND=OFF \
        -DENABLE_OPENVINO_DEBUG=OFF \
        -DTBBROOT=/usr/local \
        -DENABLE_SYSTEM_TBB=ON \
        -DENABLE_TBB_RELEASE_ONLY=OFF \
        -DENABLE_TBBBIND_2_5=OFF \
        -DENABLE_SYSTEM_PUGIXML=OFF \
        -DCMAKE_INSTALL_PREFIX=/openvino/dist

ninja install


Logs of the run attached

##### Issue submission checklist

 - [X] I report the issue, it's not a question
   <!--
   OpenVINO team works with support forum, Stack Overflow and other communities
   to discuss problems. Tickets with question without real issue statement will be
   closed.
   -->
 - [X] I checked the problem with documentation, FAQ, open issues, Stack Overflow, etc and have not found solution
   <!--
   Places to check:
   * OpenVINO documentation: https://docs.openvino.ai/
   * OpenVINO forum: https://community.intel.com/t5/Intel-Distribution-of-OpenVINO/bd-p/distribution-openvino-toolkit
   * OpenVINO issue tracker: https://github.com/openvinotoolkit/openvino/issues?q=is%3Aissue
   * Stack Overflow branch: https://stackoverflow.com/questions/tagged/openvino
   -->
 - [X] There is reproducer code and related data files: images, videos, models, etc.
   <!--
   The best reproducer -- test case for OpenVINO that we can add to the library.
   -->
[CMakeOutput.log](https://github.com/openvinotoolkit/openvino/files/10229113/CMakeOutput.log)
[CMakeError.log](https://github.com/openvinotoolkit/openvino/files/10229114/CMakeError.log)
[ninja-run.log](https://github.com/openvinotoolkit/openvino/files/10229115/ninja-run.log)
Iffa-Intel commented 1 year ago

@Xaenalt as of now, RedHat version that is validated to work with OpenVINO is Red Hat Enterprise Linux 8.2 (64-bit) with default GCC 8.5.0. Newer version might works but it's not fully supported yet.

In order to experiment this, I tried building & compiling the latest OV version with latest RedHat and so far it works:

query

Took a while for me to build this (depends on your computing power) and requires some manual tweaking tho.

However, bear in mind that this is not fully supported yet until it's officially announced in this release note or mentioned in this wiki section.

Xaenalt commented 1 year ago

Ah yeah, it was using the newer gcc, I eventually got it with a few -Wno-error flags

ClaudioCimarelli commented 1 year ago

@Xaenalt How did you solve it? Passing the flags like this make --jobs=$(nproc --all) CFLAGS="-Wno-error" is ineffective. I am using 11.3.0 with Ubuntu 22.04.

ilya-lavrenov commented 1 year ago

Passing the flags like this make --jobs=$(nproc --all) CFLAGS="-Wno-error" is ineffective.

because cmake project has already been configured. If you want to affect compilation, you need:

cmake -DCMAKE_CXX_FLAGS="-Wno-error" -DCMAKE_C_FLAGS="-Wno-error" .
make --jobs=$(nproc --all)