Repository: mlcommons/inference
Issue: error installing loadgen python module
Root cause: Configuration Error

My command:
```
sudo make mlperf_loadgen_pymodule
```
Stack Trace:
```
cd third_party/ninja && python configure.py --bootstrap
bootstrapping ninja...
wrote build.ninja.
bootstrap complete.  rebuilding...
[25/25] LINK ninja
# Generate gn's ninja build file
python third_party/gn/build/gen.py
# Build gn
third_party/ninja/ninja -C third_party/gn/out
ninja: Entering directory `third_party/gn/out'
ninja: no work to do.
# Copy gn to third_party/gn, where depot_tools expects it.
cp third_party/gn/out/gn* third_party/gn/.
third_party/gn/gn gen out/MakefileGnProj
Done. Made 24 targets from 41 files in 81ms
third_party/ninja/ninja -C out/MakefileGnProj loadgen_pymodule_wheel_src
ninja: Entering directory `out/MakefileGnProj'
[41/42] ACTION //:loadgen_pymodule_wheel_src(//build/toolchain/linux:x64)
FAILED: obj/dist/mlperf_loadgen-0.5a0.tar.gz 
python gen/loadgen_pymodule_setup_src.py bdist_wheel
running bdist_wheel
running build
running build_ext
building 'mlperf_loadgen' extension
creating build
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/gen
creating build/temp.linux-x86_64-2.7/gen/loadgen
creating build/temp.linux-x86_64-2.7/gen/loadgen/bindings
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -DMAJOR_VERSION=0 -DMINOR_VERSION=5 -Igen -Igen/third_party/pybind/include -I/usr/include/python2.7 -c gen/loadgen/bindings/python_api.cc -o build/temp.linux-x86_64-2.7/gen/loadgen/bindings/python_api.o
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
In file included from /usr/include/c++/5/forward_list:35:0,
                 from gen/third_party/pybind/include/pybind11/detail/common.h:140,
                 from gen/third_party/pybind/include/pybind11/pytypes.h:12,
                 from gen/third_party/pybind/include/pybind11/cast.h:13,
                 from gen/third_party/pybind/include/pybind11/attr.h:13,
                 from gen/third_party/pybind/include/pybind11/pybind11.h:44,
                 from gen/third_party/pybind/include/pybind11/functional.h:12,
                 from gen/loadgen/bindings/python_api.cc:6:
/usr/include/c++/5/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
 #error This file requires compiler and library support \
  ^
In file included from gen/third_party/pybind/include/pybind11/pytypes.h:12:0,
                 from gen/third_party/pybind/include/pybind11/cast.h:13,
                 from gen/third_party/pybind/include/pybind11/attr.h:13,
                 from gen/third_party/pybind/include/pybind11/pybind11.h:44,
                 from gen/third_party/pybind/include/pybind11/functional.h:12,
                 from gen/loadgen/bindings/python_api.cc:6:
gen/third_party/pybind/include/pybind11/detail/common.h:355:1: warning: identifier ‘constexpr’ is a keyword in C++11 [-Wc++0x-compat]
 inline static constexpr int log2(size_t n, int k = 0) { return (n <= 1) ? k : log2(n >> 1, k + 1); }
 ^
gen/third_party/pybind/include/pybind11/detail/common.h:367:5: warning: identifier ‘static_assert’ is a keyword in C++11 [-Wc++0x-compat]
     static_assert(sizeof(std::shared_ptr<int>) >= sizeof(std::unique_ptr<int>),
     ^
gen/third_party/pybind/include/pybind11/detail/common.h:433:5: warning: identifier ‘nullptr’ is a keyword in C++11 [-Wc++0x-compat]
     value_and_holder get_value_and_holder(const type_info *find_type = nullptr, bool throw_if_missing = true);
     ^
In file included from gen/third_party/pybind/include/pybind11/pytypes.h:12:0,
                 from gen/third_party/pybind/include/pybind11/cast.h:13,
                 from gen/third_party/pybind/include/pybind11/attr.h:13,
                 from gen/third_party/pybind/include/pybind11/pybind11.h:44,
                 from gen/third_party/pybind/include/pybind11/functional.h:12,
                 from gen/loadgen/bindings/python_api.cc:6:
gen/third_party/pybind/include/pybind11/detail/common.h:597:1: warning: identifier ‘decltype’ is a keyword in C++11 [-Wc++0x-compat]
 using is_template_base_of = decltype(is_template_base_of_impl<Base>::check((intrinsic_t<T>*)nullptr));
 ^
In file included from gen/third_party/pybind/include/pybind11/cast.h:13:0,
                 from gen/third_party/pybind/include/pybind11/attr.h:13,
                 from gen/third_party/pybind/include/pybind11/pybind11.h:44,
                 from gen/third_party/pybind/include/pybind11/functional.h:12,
                 from gen/loadgen/bindings/python_api.cc:6:
gen/third_party/pybind/include/pybind11/pytypes.h:238:5: warning: identifier ‘noexcept’ is a keyword in C++11 [-Wc++0x-compat]
     object(object &&other) noexcept { m_ptr = other.m_ptr; other.m_ptr = nullptr; }
     ^
In file included from gen/third_party/pybind/include/pybind11/pybind11.h:46:0,
                 from gen/third_party/pybind/include/pybind11/functional.h:12,
                 from gen/loadgen/bindings/python_api.cc:6:
gen/third_party/pybind/include/pybind11/detail/class.h:87:38: warning: missing terminating " character
     PyObject *result = PyRun_String(R"(\
                                      ^
gen/third_party/pybind/include/pybind11/detail/class.h:95:10: warning: missing terminating " character
         )", Py_file_input, d.ptr(), d.ptr()
          ^
In file included from gen/third_party/pybind/include/pybind11/pytypes.h:12:0,
                 from gen/third_party/pybind/include/pybind11/cast.h:13,
                 from gen/third_party/pybind/include/pybind11/attr.h:13,
                 from gen/third_party/pybind/include/pybind11/pybind11.h:44,
                 from gen/third_party/pybind/include/pybind11/functional.h:12,
                 from gen/loadgen/bindings/python_api.cc:6:
gen/third_party/pybind/include/pybind11/detail/common.h:298:7: error: expected nested-name-specifier before ‘ssize_t’
 using ssize_t = Py_ssize_t;
       ^
gen/third_party/pybind/include/pybind11/detail/common.h:299:7: error: expected nested-name-specifier before ‘size_t’
 using size_t  = std::size_t;
       ^
gen/third_party/pybind/include/pybind11/detail/common.h:302:1: warning: scoped enums only available with -std=c++11 or -std=gnu++11
 enum class return_value_policy : uint8_t {
 ^
gen/third_party/pybind/include/pybind11/detail/common.h:302:34: warning: scoped enums only available with -std=c++11 or -std=gnu++11
 enum class return_value_policy : uint8_t {
                                  ^
gen/third_party/pybind/include/pybind11/detail/common.h:355:15: error: ‘constexpr’ does not name a type
 inline static constexpr int log2(size_t n, int k = 0) { return (n <= 1) ? k : log2(n >> 1, k + 1); }
               ^
gen/third_party/pybind/include/pybind11/detail/common.h:355:15: note: C++11 ‘constexpr’ only available with -std=c++11 or -std=gnu++11
gen/third_party/pybind/include/pybind11/detail/common.h:358:15: error: ‘constexpr’ does not name a type
 inline static constexpr size_t size_in_ptrs(size_t s) { return 1 + ((s - 1) >> log2(sizeof(void *))); }
               ^
gen/third_party/pybind/include/pybind11/detail/common.h:358:15: note: C++11 ‘constexpr’ only available with -std=c++11 or -std=gnu++11
gen/third_party/pybind/include/pybind11/detail/common.h:366:1: error: ‘constexpr’ does not name a type
 constexpr size_t instance_simple_holder_in_ptrs() {
 ^
gen/third_party/pybind/include/pybind11/detail/common.h:366:1: note: C++11 ‘constexpr’ only available with -std=c++11 or -std=gnu++11
gen/third_party/pybind/include/pybind11/detail/common.h:386:70: error: ‘instance_simple_holder_in_ptrs’ was not declared in this scope
         void *simple_value_holder[1 + instance_simple_holder_in_ptrs()];
                                                                      ^
gen/third_party/pybind/include/pybind11/detail/common.h:436:12: error: ‘constexpr’ does not name a type
     static constexpr uint8_t status_holder_constructed  = 1;
            ^
gen/third_party/pybind/include/pybind11/detail/common.h:436:12: note: C++11 ‘constexpr’ only available with -std=c++11 or -std=gnu++11
gen/third_party/pybind/include/pybind11/detail/common.h:437:12: error: ‘constexpr’ does not name a type
     static constexpr uint8_t status_instance_registered = 2;
            ^
gen/third_party/pybind/include/pybind11/detail/common.h:437:12: note: C++11 ‘constexpr’ only available with -std=c++11 or -std=gnu++11
gen/third_party/pybind/include/pybind11/detail/common.h:433:72: error: ‘nullptr’ was not declared in this scope
     value_and_holder get_value_and_holder(const type_info *find_type = nullptr, bool throw_if_missing = true);
                                                                        ^
gen/third_party/pybind/include/pybind11/detail/common.h:440:14: error: expected constructor, destructor, or type conversion before ‘(’ token
 static_assert(std::is_standard_layout<instance>::value, "Internal error: `pybind11::detail::instance` is not standard layout!");
              ^
In file included from gen/third_party/pybind/include/pybind11/pytypes.h:12:0,
                 from gen/third_party/pybind/include/pybind11/cast.h:13,
                 from gen/third_party/pybind/include/pybind11/attr.h:13,
                 from gen/third_party/pybind/include/pybind11/pybind11.h:44,
                 from gen/third_party/pybind/include/pybind11/functional.h:12,
                 from gen/loadgen/bindings/python_api.cc:6:
gen/third_party/pybind/include/pybind11/detail/common.h:449:38: error: expected unqualified-id before ‘using’
 template <bool B, typename T = void> using enable_if_t = typename std::enable_if<B, T>::type;
                                      ^

```
and a very long stack trace downwards. Thanks in advance!

What version of g++ are you using? It appears whatever version of the compiler you are using does not support the C++11 standard by default. You will need to enable it through a compiler flag or update your compiler (which may not be an option).

See the [gcc C++ support page](https://gcc.gnu.org/projects/cxx-status.html).

You may want to look at pybinds docs as well. There they articulate[ what compilers are supported](https://github.com/mlperf/inference/blob/master/loadgen_pymodule_setup_lib.py).

Try the following and see if it resolves the issue.
```
sudo make mlperf_loadgen_pymodule CXXFLAGS='-std=c++11'
```

It worked. Thanks!