Including boost-1.83.0 is causing compilation errors on windows

36 views Asked by At

I have a CMake Project in which I am using boost through conan.

a) I am building boost with python3.9
b) Window
c) Using this generator from conan
conanfile.txt: Generator cmake created conanbuildinfo.cmake

B.T.W this works fine on linux environment.

I am stumped here as to what could be causing the problem.

  1. I have tried fixing it through the files. But it's a lot of files to go through and doesn't seem like the proper fix
  2. Reordering the includes. But in the example you can see i am able to reproduce it with single includes as well.

I have attached minimal example, conan profile, output as well
-------------------------------- Code --------------------------------

---------------- conan profile ----------

Configuration:
[settings]
arch=x86_64
arch_build=x86_64
build_type=Release
compiler=Visual Studio
compiler.cppstd=17
compiler.runtime=MD
compiler.version=17
os=Windows
os_build=Windows
[options]
[build_requires]
[env]

All requirements (These are a lot more because they are from full project didn't want to leave anything out just in case)

    abseil/20230802.1:68905a6cf1c0eb4bead20ca87f663bdd27bc8c40 - Cache  
    boost/1.83.0:5557bc584d1b38111909aaf71644828ded8a9965 - Cache
    bzip2/1.0.8:53b5fd22ba061620078deefdae9a437c5f693201 - Cache
    cereal/1.3.2:5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9 - Cache
    cpuinfo/cci.20220618:520dc3c1ed634f206ce158a66123d024559ade6c - Cache
    date/3.0.1:0f1c12fa2ea2be37fb82be3a3922662ae62ba99b - Cache
    eigen/3.4.0:5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9 - Cache
    flatbuffers/1.12.0:68905a6cf1c0eb4bead20ca87f663bdd27bc8c40 - Cache
    fmt/6.0.0:68905a6cf1c0eb4bead20ca87f663bdd27bc8c40 - Cache
    gtest/1.10.0:0c0a6d527968983b4df68fca87c1af26a436b6a0 - Cache
    libcurl/8.6.0:a875f41e4829a262d98e23ace329473a9a7e8894 - Cache
    ms-gsl/4.0.0:5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9 - Cache
    nlohmann_json/3.11.3:5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9 - Cache
    onnx/1.14.1:d58b57c126ce34928540676a333ece90ec6323f3 - Cache
    onnxruntime/1.16.3:6f6c87e6a738db3325f07b38b920ecef96dc61d9 - Cache
    openssl/3.2.1:c47212d5fc818fd54769ccb1344e758f51a9aacb - Cache
    protobuf/3.21.12:7564e8e8144931dc2974bf0474f9d1a506176708 - Cache
    re2/20230901:d6c439abc76b769085393d1c2a55b48c2e361cc0 - Cache
    safeint/3.0.28:5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9 - Cache
    tensorflow/1.13.2:ca33edce272a279b24f87dc0d4cf5bbdcffbc187 - Cache
    wil/1.0.231216.1:5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9 - Cache
    zlib/1.3.1:5a61a86bb3e07ce4262c80e1510f9c05e9b6d48b - Cache

---------------- CMakeLists.txt ----------

add_library(aai_simcommon_types STATIC
    check.h
    check.cpp
    )

set_target_properties(aai_simcommon_types PROPERTIES
    WINDOWS_EXPORT_ALL_SYMBOLS OFF
    POSITION_INDEPENDENT_CODE ON
    CXX_STANDARD 17
    CXX_STANDARD_REQUIRED ON
    FOLDER ai.aai.corelib.simcommon/aai_simcommon/types
    )

target_link_libraries(aai_simcommon_types
    PUBLIC CONAN_PKG::boost
)

-------------- checks.h ---------------------

#ifndef AAI_SIMCOMMON_CHECKS_H_
#define AAI_SIMCOMMON_CHECKS_H_

//#include <boost/units/limits.hpp>

#include <boost/units/quantity.hpp>
/*
#include <boost/units/limits.hpp>
#include <boost/units/conversion.hpp>

#include <boost/units/systems/si/prefixes.hpp>
#include <boost/units/systems/si.hpp>

#include <boost/optional.hpp>
#include <boost/units/cmath.hpp>
#include <boost/units/io.hpp>
#include <boost/units/quantity.hpp>
*/

namespace aai_simcommon {
   void test_includes();
}

#endif

-------------- checks.cpp ---------------------

#include "check.h"

namespace aai_simcommon {
    void test_includes() { return; }
}

--------------- output --------------------

[1/3] Building CXX object CMakeFiles\aai_simcommon_types.dir\check.cpp.obj
FAILED: CMakeFiles/aai_simcommon_types.dir/check.cpp.obj
C:\PROGRA~1\MICROS~2\2022\COMMUN~1\VC\Tools\MSVC\1438~1.331\bin\Hostx64\x64\cl.exe  /nologo /TP -DBOOST_ALL_NO_LIB -DBOOST_PYTHON_STATIC_LIB -DBOOST_STACKTRACE_USE_NOOP -DBOOST_STACKTRACE_USE_WINDBG -DBOOST_STACKTRACE_USE_WINDBG_CACHED -DHAVE_SNPRINTF -IE:\Development\Projects\aai.traffic -external:IC:\.conan\77113c1\1\include -external:IC:\Users\Ahmed\.conan\data\zlib\1.3.1\_\_\package\5a61a86bb3e07ce4262c80e1510f9c05e9b6d48b\include -external:IC:\Users\Ahmed\.conan\data\bzip2\1.0.8\_\_\package\53b5fd22ba061620078deefdae9a437c5f693201\include -external:W0 /DWIN32 /D_WINDOWS /GR /EHsc  /Zi /O2 /Ob1  -std:c++17 -MD /W0 /showIncludes /FoCMakeFiles\aai_simcommon_types.dir\check.cpp.obj /FdCMakeFiles\aai_simcommon_types.dir\aai_simcommon_types.pdb /FS -c E:\Development\Projects\aai.traffic\check.cpp
E:\Development\Projects\aai.traffic\version(1): error C2059: syntax error: 'constant'
C:\.conan\77113c1\1\include\boost/config/detail/suffix.hpp(510): error C2143: syntax error: missing ';' before '{'
C:\.conan\77113c1\1\include\boost/config/detail/suffix.hpp(510): error C2447: '{': missing function header (old-style formal list?)
E:\Development\Projects\aai.traffic\version(1): error C2059: syntax error: 'constant'
C:\.conan\77113c1\1\include\boost/mpl/bool_fwd.hpp(19): error C2143: syntax error: missing ';' before '{'
C:\.conan\77113c1\1\include\boost/mpl/bool_fwd.hpp(19): error C2447: '{': missing function header (old-style formal list?)
C:\.conan\77113c1\1\include\boost/mpl/aux_/na.hpp(35): error C2504: 'true_': base class undefined
C:\.conan\77113c1\1\include\boost/mpl/aux_/na.hpp(53): error C2504: 'false_': base class undefined
C:\.conan\77113c1\1\include\boost/mpl/aux_/preprocessed/plain/and.hpp(27): error C2065: 'true_': undeclared identifier
C:\.conan\77113c1\1\include\boost/mpl/aux_/preprocessed/plain/and.hpp(27): note: the template instantiation context (the oldest one first) is
C:\.conan\77113c1\1\include\boost/mpl/aux_/preprocessed/plain/and.hpp(30): note: see reference to class template instantiation 'boost::mpl::aux::and_impl<true,T1,T2,T3,T4>' being compiled
C:\.conan\77113c1\1\include\boost/mpl/aux_/preprocessed/plain/and.hpp(24): error C2923: 'boost::mpl::aux::and_impl': 'true_' is not a valid template type argument for parameter 'T4'
C:\.conan\77113c1\1\include\boost/mpl/aux_/preprocessed/plain/and.hpp(27): note: see declaration of 'true_'
C:\.conan\77113c1\1\include\boost/mpl/aux_/preprocessed/plain/and.hpp(24): error C2955: 'boost::mpl::aux::and_impl': use of class template requires template argument list
C:\.conan\77113c1\1\include\boost/mpl/aux_/preprocessed/plain/and.hpp(18): note: see declaration of 'boost::mpl::aux::and_impl'
C:\.conan\77113c1\1\include\boost/mpl/aux_/preprocessed/plain/and.hpp(35): error C2065: 'true_': undeclared identifier
C:\.conan\77113c1\1\include\boost/mpl/aux_/preprocessed/plain/and.hpp(35): error C2065: 'true_': undeclared identifier
C:\.conan\77113c1\1\include\boost/mpl/aux_/preprocessed/plain/and.hpp(35): error C2065: 'true_': undeclared identifier
C:\.conan\77113c1\1\include\boost/mpl/aux_/preprocessed/plain/and.hpp(35): error C2065: 'true_': undeclared identifier
0

There are 0 answers