Installing Pytorch from source crashes

username: kaad01
cooked: <p>So I tried installing pytorch from source to develop it. But it crashes.<br>
I use:</p>
<p><code>USE_CUDA=0 python setup.py develop</code></p>
<p>and it gets far but it stops here:</p>
<pre><code class="lang-auto">[4620/6290] Building CXX object third_party/kineto/libkineto/CMakeFiles/kineto_base.dir/src/output_json.cpp.o
ninja: build stopped: subcommand failed.
</code></pre>
<p>I hope someone can help me. I have a log File but I don’t know how to attach it here.</p>

username: ptrblck
cooked: <p>The posted snippet does not contain the error message so you would need to look at the output before this output is shown.</p>

username: kaad01
cooked: <p>There are a lot of errors. The last ones:</p>
<pre><code class="lang-auto">/usr/include/stdlib.h:256:36: error: missing binary operator before token "("
  256 | #if __HAVE_FLOAT64X &amp;&amp; __GLIBC_USE (IEC_60559_TYPES_EXT)
      |                                    ^
/usr/include/stdlib.h:262:37: error: missing binary operator before token "("
  262 | #if __HAVE_FLOAT128X &amp;&amp; __GLIBC_USE (IEC_60559_TYPES_EXT)
      |                                     ^
In file included from /usr/include/x86_64-linux-gnu/bits/types/locale_t.h:22,
                 from /usr/include/stdlib.h:273,
                 from /usr/include/c++/11/cstdlib:75,
                 from /usr/include/c++/11/ext/string_conversions.h:41,
                 from /usr/include/c++/11/bits/basic_string.h:6608,
                 from /usr/include/c++/11/string:55,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/c10/macros/Macros.h:246,
                 from /media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/c10/core/DeviceType.h:8,
                 from /media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/c10/core/Device.h:3,
                 from /media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/c10/core/Allocator.h:6,
                 from /media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/c10/core/Allocator.cpp:1:
/usr/include/x86_64-linux-gnu/bits/types/__locale_t.h:27:8: error: redefinition of ‘struct __locale_struct’
   27 | struct __locale_struct
      |        ^~~~~~~~~~~~~~~
In file included from /home/kaan/anaconda3/envs/pytorch-dev/x86_64-conda-linux-gnu/sysroot/usr/include/wchar.h:180,
                 from /usr/include/c++/11/cwchar:44,
                 from /usr/include/c++/11/bits/postypes.h:40,
                 from /usr/include/c++/11/iosfwd:40,
                 from /usr/include/c++/11/bits/shared_ptr.h:52,
                 from /usr/include/c++/11/memory:77,
                 from /media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/c10/core/Allocator.h:4,
                 from /media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/c10/core/Allocator.cpp:1:
/home/kaan/anaconda3/envs/pytorch-dev/x86_64-conda-linux-gnu/sysroot/usr/include/xlocale.h:27:16: note: previous definition of ‘struct __locale_struct’
   27 | typedef struct __locale_struct
      |                ^~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/cstdlib:75,
                 from /usr/include/c++/11/ext/string_conversions.h:41,
                 from /usr/include/c++/11/bits/basic_string.h:6608,
                 from /usr/include/c++/11/string:55,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/c10/macros/Macros.h:246,
                 from /media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/c10/core/DeviceType.h:8,
                 from /media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/c10/core/Device.h:3,
                 from /media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/c10/core/Allocator.h:6,
                 from /media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/c10/core/Allocator.cpp:1:
/usr/include/stdlib.h:541:6: error: expected initializer before ‘__attribute_alloc_size__’
  541 |      __attribute_alloc_size__ ((1)) __wur;
      |      ^~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/stdlib.h:544:35: error: expected initializer before ‘__attribute_alloc_size__’
  544 |      __THROW __attribute_malloc__ __attribute_alloc_size__ ((1, 2)) __wur;
      |                                   ^~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/stdlib.h:552:47: error: expected initializer before ‘__attribute_alloc_size__’
  552 |      __THROW __attribute_warn_unused_result__ __attribute_alloc_size__ ((2));
      |                                               ^~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/stdlib.h:565:6: error: expected initializer before ‘__attribute_alloc_size__’
  565 |      __attribute_alloc_size__ ((2, 3))
      |      ^~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/stdlib.h:570:14: error: expected initializer before ‘__attr_dealloc’
  570 |      __THROW __attr_dealloc (reallocarray, 1);
      |              ^~~~~~~~~~~~~~
In file included from /usr/include/c++/11/cstdlib:75,
                 from /usr/include/c++/11/ext/string_conversions.h:41,
                 from /usr/include/c++/11/bits/basic_string.h:6608,
                 from /usr/include/c++/11/string:55,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/c10/macros/Macros.h:246,
                 from /media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/c10/core/DeviceType.h:8,
                 from /media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/c10/core/Device.h:3,
                 from /media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/c10/core/Allocator.h:6,
                 from /media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/c10/core/Allocator.cpp:1:
/usr/include/stdlib.h:581:6: error: expected initializer before ‘__attribute_alloc_size__’
  581 |      __attribute_alloc_size__ ((1)) __wur;
      |      ^~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/stdlib.h:593:35: error: expected initializer before ‘__attribute_alloc_align__’
  593 |      __THROW __attribute_malloc__ __attribute_alloc_align__ ((1))
      |                                   ^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/stdlib.h:799:6: error: expected initializer before ‘__attr_dealloc_free’
  799 |      __attr_dealloc_free __wur;
      |      ^~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/cstdlib:75,
                 from /usr/include/c++/11/ext/string_conversions.h:41,
                 from /usr/include/c++/11/bits/basic_string.h:6608,
                 from /usr/include/c++/11/string:55,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/c10/macros/Macros.h:246,
                 from /media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/c10/core/DeviceType.h:8,
                 from /media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/c10/core/Device.h:3,
                 from /media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/c10/core/Allocator.h:6,
                 from /media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/c10/core/Allocator.cpp:1:
/usr/include/stdlib.h:943:5: error: expected initializer before ‘__attr_access’
  943 |     __attr_access ((__read_only__, 2));
      |     ^~~~~~~~~~~~~
/usr/include/stdlib.h:948:3: error: expected initializer before ‘__fortified_attr_access’
  948 |   __fortified_attr_access (__write_only__, 1, 3)
      |   ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/stdlib.h:1003:30: error: expected initializer before ‘__fortified_attr_access’
 1003 |      __THROW __nonnull ((2)) __fortified_attr_access (__write_only__, 2, 3);
      |                              ^~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/ext/string_conversions.h:41,
                 from /usr/include/c++/11/bits/basic_string.h:6608,
                 from /usr/include/c++/11/string:55,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/c10/macros/Macros.h:246,
                 from /media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/c10/core/DeviceType.h:8,
                 from /media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/c10/core/Device.h:3,
                 from /media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/c10/core/Allocator.h:6,
                 from /media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/c10/core/Allocator.cpp:1:
/usr/include/c++/11/cstdlib:144:11: error: ‘calloc’ has not been declared in ‘::’
  144 |   using ::calloc;
      |           ^~~~~~
/usr/include/c++/11/cstdlib:151:11: error: ‘malloc’ has not been declared in ‘::’
  151 |   using ::malloc;
      |           ^~~~~~
/usr/include/c++/11/cstdlib:164:11: error: ‘realloc’ has not been declared in ‘::’
  164 |   using ::realloc;
      |           ^~~~~~~
[4611/6290] Building CXX object third_party/kineto/libkineto/CMakeFiles/kineto_base.dir/src/Config.cpp.o
[4612/6290] Building CXX object third_party/kineto/libkineto/CMakeFiles/kineto_base.dir/src/ILoggerObserver.cpp.o
</code></pre>

username: ptrblck
cooked: <p>The last ones are not really interesting as they could fail as a fallout from the first one.<br>
Check the very first error and try to fix it.</p>

username: kaad01
cooked: <p>Thanks.<br>
Are these Warnings normal?</p>
<pre><code class="lang-auto">[19/6287] Building CXX object third_party/protobuf/cmake/CMakeFiles/libprotobuf-lite.dir/__/src/google/protobuf/message_lite.cc.o
In file included from /usr/include/string.h:535,
                 from /media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/third_party/protobuf/src/google/protobuf/stubs/port.h:39,
                 from /media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/third_party/protobuf/src/google/protobuf/stubs/macros.h:34,
                 from /media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/third_party/protobuf/src/google/protobuf/stubs/common.h:46,
                 from /media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/third_party/protobuf/src/google/protobuf/message_lite.h:45,
                 from /media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/third_party/protobuf/src/google/protobuf/message_lite.cc:36:
In function ‘void* memcpy(void*, const void*, size_t)’,
    inlined from ‘google::protobuf::uint8* google::protobuf::io::EpsCopyOutputStream::WriteRaw(const void*, int, google::protobuf::uint8*)’ at /media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/third_party/protobuf/src/google/protobuf/io/coded_stream.h:699:16,
    inlined from ‘virtual google::protobuf::uint8* google::protobuf::internal::ImplicitWeakMessage::_InternalSerialize(google::protobuf::uint8*, google::protobuf::io::EpsCopyOutputStream*) const’ at /media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/third_party/protobuf/src/google/protobuf/implicit_weak_message.h:85:28,
    inlined from ‘bool google::protobuf::MessageLite::SerializePartialToZeroCopyStream(google::protobuf::io::ZeroCopyOutputStream*) const’ at /media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/third_party/protobuf/src/google/protobuf/message_lite.cc:419:30,
    inlined from ‘bool google::protobuf::MessageLite::SerializeToZeroCopyStream(google::protobuf::io::ZeroCopyOutputStream*) const’ at /media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/third_party/protobuf/src/google/protobuf/message_lite.cc:403:42:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:29:33: warning: ‘void* __builtin___memcpy_chk(void*, const void*, long unsigned int, long unsigned int)’ specified size between 18446744071562067968 and 18446744073709551615 exceeds maximum object size 9223372036854775807 [-Wstringop-overflow=]
   29 |   return __builtin___memcpy_chk (__dest, __src, __len,
      |          ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
   30 |                                  __glibc_objsize0 (__dest));
      |                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~
In function ‘void* memcpy(void*, const void*, size_t)’,
    inlined from ‘google::protobuf::uint8* google::protobuf::io::EpsCopyOutputStream::WriteRaw(const void*, int, google::protobuf::uint8*)’ at /media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/third_party/protobuf/src/google/protobuf/io/coded_stream.h:699:16,
    inlined from ‘virtual google::protobuf::uint8* google::protobuf::internal::ImplicitWeakMessage::_InternalSerialize(google::protobuf::uint8*, google::protobuf::io::EpsCopyOutputStream*) const’ at /media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/third_party/protobuf/src/google/protobuf/implicit_weak_message.h:85:28,
    inlined from ‘bool google::protobuf::MessageLite::SerializePartialToZeroCopyStream(google::protobuf::io::ZeroCopyOutputStream*) const’ at /media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/third_party/protobuf/src/google/protobuf/message_lite.cc:419:30:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:29:33: warning: ‘void* __builtin___memcpy_chk(void*, const void*, long unsigned int, long unsigned int)’ specified size between 18446744071562067968 and 18446744073709551615 exceeds maximum object size 9223372036854775807 [-Wstringop-overflow=]
   29 |   return __builtin___memcpy_chk (__dest, __src, __len,
      |          ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
   30 |                                  __glibc_objsize0 (__dest));
      |                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~
[20/6287] Building CXX object third_party/protobuf/cmake/CMakeFiles/libprotobuf-lite.dir/__/src/google/protobuf/stubs/structurally_valid.cc.o
</code></pre>

username: kaad01
cooked: <p>Im not getting any further :(. Could you maybe look at this part:</p>
<p>This is the first warning</p>
<pre><code class="lang-auto">[4131/6287] Building CXX object third_party/onnx/CMakeFiles/onnx.dir/onnx/defs/logical/old.cc.o
[4132/6287] Building CXX object third_party/onnx/CMakeFiles/onnx.dir/onnx/common/ir_pb_converter.cc.o
In file included from /media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/third_party/onnx/onnx/common/ir_pb_converter.h:10,
                 from /media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/third_party/onnx/onnx/common/ir_pb_converter.cc:8:
In constructor ‘onnx_torch::Dimension::Dimension(onnx_torch::Dimension&amp;&amp;)’,
    inlined from ‘void __gnu_cxx::new_allocator&lt;_Tp&gt;::construct(_Up*, _Args&amp;&amp; ...) [with _Up = onnx_torch::Dimension; _Args = {onnx_torch::Dimension}; _Tp = onnx_torch::Dimension]’ at /usr/include/c++/11/ext/new_allocator.h:162:4,
    inlined from ‘static void std::allocator_traits&lt;std::allocator&lt;_CharT&gt; &gt;::construct(std::allocator_traits&lt;std::allocator&lt;_CharT&gt; &gt;::allocator_type&amp;, _Up*, _Args&amp;&amp; ...) [with _Up = onnx_torch::Dimension; _Args = {onnx_torch::Dimension}; _Tp = onnx_torch::Dimension]’ at /usr/include/c++/11/bits/alloc_traits.h:516:17,
    inlined from ‘void std::vector&lt;_Tp, _Alloc&gt;::emplace_back(_Args&amp;&amp; ...) [with _Args = {onnx_torch::Dimension}; _Tp = onnx_torch::Dimension; _Alloc = std::allocator&lt;onnx_torch::Dimension&gt;]’ at /usr/include/c++/11/bits/vector.tcc:115:30,
    inlined from ‘void std::vector&lt;_Tp, _Alloc&gt;::push_back(std::vector&lt;_Tp, _Alloc&gt;::value_type&amp;&amp;) [with _Tp = onnx_torch::Dimension; _Alloc = std::allocator&lt;onnx_torch::Dimension&gt;]’ at /usr/include/c++/11/bits/stl_vector.h:1204:21,
    inlined from ‘std::vector&lt;onnx_torch::Dimension&gt; onnx_torch::tensorShapeProtoToDimensions(const onnx_torch::TensorShapeProto&amp;)’ at /media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/third_party/onnx/onnx/common/ir_pb_converter.cc:201:21:
/media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/third_party/onnx/onnx/common/ir.h:74:8: warning: ‘&lt;unnamed&gt;.onnx_torch::Dimension::dim’ may be used uninitialized [-Wmaybe-uninitialized]
   74 | struct Dimension final {
      |        ^~~~~~~~~
/media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/third_party/onnx/onnx/common/ir_pb_converter.cc: In function ‘std::vector&lt;onnx_torch::Dimension&gt; onnx_torch::tensorShapeProtoToDimensions(const onnx_torch::TensorShapeProto&amp;)’:
/media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/third_party/onnx/onnx/common/ir_pb_converter.cc:201:32: note: ‘&lt;anonymous&gt;’ declared here
  201 |       dims.push_back(Dimension());
      |                                ^
[4133/6287] Building CXX object third_party/onnx/CMakeFiles/onnx.dir/onnx/defs/generator/old.cc.o
[4134/6287] Building CXX object third_party/onnx/CMakeFiles/onnx_proto.dir/onnx/onnx_onnx_torch-ml.pb.cc.o
</code></pre>
<p>And here is the first error:</p>
<pre><code class="lang-auto">[4598/6287] Linking CXX static library lib/libfmt.a
[4599/6287] Building CXX object c10/CMakeFiles/c10.dir/core/AutogradState.cpp.o
FAILED: c10/CMakeFiles/c10.dir/core/AutogradState.cpp.o 
/usr/bin/c++ -DFMT_HEADER_ONLY=1 -DHAVE_MALLOC_USABLE_SIZE=1 -DHAVE_MMAP=1 -DHAVE_SHM_OPEN=1 -DHAVE_SHM_UNLINK=1 -DIDEEP_USE_MKL -DMINIZ_DISABLE_ZIP_READER_CRC32_CHECKS -DONNXIFI_ENABLE_EXT=1 -DONNX_ML=1 -DONNX_NAMESPACE=onnx_torch -DSUPPORTS_BACKTRACE=1 -DUSE_EXTERNAL_MZCRC -D_FILE_OFFSET_BITS=64 -Dc10_EXPORTS -I/media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/build/aten/src -I/media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/aten/src -I/media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/build -I/media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch -I/media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/cmake/../third_party/benchmark/include -I/media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/third_party/onnx -I/media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/build/third_party/onnx -I/media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/third_party/foxi -I/media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/build/third_party/foxi -I/home/kaan/anaconda3/envs/pytorch-dev/x86_64-conda-linux-gnu/sysroot/usr/include -I/media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/c10/.. -I/media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/third_party/fmt/include -isystem /media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/build/third_party/gloo -isystem /media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/cmake/../third_party/gloo -isystem /media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/cmake/../third_party/googletest/googlemock/include -isystem /media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/cmake/../third_party/googletest/googletest/include -isystem /media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/third_party/protobuf/src -isystem /media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/third_party/gemmlowp -isystem /media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/third_party/neon2sse -isystem /media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/third_party/XNNPACK/include -isystem /media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/cmake/../third_party/eigen -isystem /media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/third_party/ideep/mkl-dnn/third_party/oneDNN/include -isystem /media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/third_party/ideep/include -isystem /media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/third_party/ideep/mkl-dnn/include -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /home/kaan/anaconda3/envs/pytorch-dev/include -Wno-deprecated -fvisibility-inlines-hidden -DUSE_PTHREADPOOL -fopenmp -DNDEBUG -DUSE_KINETO -DLIBKINETO_NOCUPTI -DUSE_FBGEMM -DUSE_QNNPACK -DUSE_PYTORCH_QNNPACK -DUSE_XNNPACK -DSYMBOLICATE_MOBILE_DEBUG_HANDLE -DEDGE_PROFILER_USE_KINETO -O2 -fPIC -Wno-narrowing -Wall -Wextra -Werror=return-type -Wno-missing-field-initializers -Wno-type-limits -Wno-array-bounds -Wno-unknown-pragmas -Wno-unused-parameter -Wno-unused-function -Wno-unused-result -Wno-strict-overflow -Wno-strict-aliasing -Wno-error=deprecated-declarations -Wno-stringop-overflow -Wno-psabi -Wno-error=pedantic -Wno-error=redundant-decls -Wno-error=old-style-cast -fdiagnostics-color=always -faligned-new -Wno-unused-but-set-variable -Wno-maybe-uninitialized -fno-math-errno -fno-trapping-math -Werror=format -Werror=cast-function-type -Wno-stringop-overflow -O3 -DNDEBUG -DNDEBUG -fPIC -DCAFFE2_USE_GLOO -DTH_HAVE_THREAD -DC10_BUILD_MAIN_LIB -fvisibility=hidden -std=gnu++14 -MD -MT c10/CMakeFiles/c10.dir/core/AutogradState.cpp.o -MF c10/CMakeFiles/c10.dir/core/AutogradState.cpp.o.d -o c10/CMakeFiles/c10.dir/core/AutogradState.cpp.o -c /media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/c10/core/AutogradState.cpp
In file included from /usr/include/stdlib.h:26,
                 from /usr/include/c++/11/cstdlib:75,
                 from /usr/include/c++/11/ext/string_conversions.h:41,
                 from /usr/include/c++/11/bits/basic_string.h:6608,
                 from /usr/include/c++/11/string:55,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/c10/macros/Macros.h:246,
                 from /media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/c10/core/AutogradState.h:3,
                 from /media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/c10/core/AutogradState.cpp:1:
/usr/include/x86_64-linux-gnu/bits/libc-header-start.h:74:17: error: missing binary operator before token "("
   74 | #if __GLIBC_USE (IEC_60559_BFP_EXT) || __GLIBC_USE (ISOC2X)
      |                 ^
/usr/include/x86_64-linux-gnu/bits/libc-header-start.h:80:17: error: missing binary operator before token "("
   80 | #if __GLIBC_USE (IEC_60559_BFP_EXT) || defined __STDC_WANT_IEC_60559_EXT__
      |                 ^
/usr/include/x86_64-linux-gnu/bits/libc-header-start.h:97:17: error: missing binary operator before token "("
   97 | #if __GLIBC_USE (IEC_60559_FUNCS_EXT) || __GLIBC_USE (ISOC2X)
      |                 ^
In file included from /usr/include/c++/11/cstdlib:75,
                 from /usr/include/c++/11/ext/string_conversions.h:41,
                 from /usr/include/c++/11/bits/basic_string.h:6608,
                 from /usr/include/c++/11/string:55,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/c10/macros/Macros.h:246,
                 from /media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/c10/core/AutogradState.h:3,
                 from /media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/c10/core/AutogradState.cpp:1:
/usr/include/stdlib.h:134:35: error: missing binary operator before token "("
  134 | #if __HAVE_FLOAT16 &amp;&amp; __GLIBC_USE (IEC_60559_TYPES_EXT)
      |                                   ^
/usr/include/stdlib.h:140:35: error: missing binary operator before token "("
  140 | #if __HAVE_FLOAT32 &amp;&amp; __GLIBC_USE (IEC_60559_TYPES_EXT)
      |                                   ^
/usr/include/stdlib.h:146:35: error: missing binary operator before token "("
  146 | #if __HAVE_FLOAT64 &amp;&amp; __GLIBC_USE (IEC_60559_TYPES_EXT)
      |                                   ^
/usr/include/stdlib.h:152:36: error: missing binary operator before token "("
  152 | #if __HAVE_FLOAT128 &amp;&amp; __GLIBC_USE (IEC_60559_TYPES_EXT)
      |                                    ^
/usr/include/stdlib.h:158:36: error: missing binary operator before token "("
  158 | #if __HAVE_FLOAT32X &amp;&amp; __GLIBC_USE (IEC_60559_TYPES_EXT)
      |                                    ^
/usr/include/stdlib.h:164:36: error: missing binary operator before token "("
  164 | #if __HAVE_FLOAT64X &amp;&amp; __GLIBC_USE (IEC_60559_TYPES_EXT)
      |                                    ^
/usr/include/stdlib.h:170:37: error: missing binary operator before token "("
  170 | #if __HAVE_FLOAT128X &amp;&amp; __GLIBC_USE (IEC_60559_TYPES_EXT)
      |                                     ^
/usr/include/stdlib.h:212:17: error: missing binary operator before token "("
  212 | #if __GLIBC_USE (IEC_60559_BFP_EXT_C2X)
      |                 ^
/usr/include/stdlib.h:226:35: error: missing binary operator before token "("
  226 | #if __HAVE_FLOAT16 &amp;&amp; __GLIBC_USE (IEC_60559_TYPES_EXT)
      |                                   ^
/usr/include/stdlib.h:232:35: error: missing binary operator before token "("
  232 | #if __HAVE_FLOAT32 &amp;&amp; __GLIBC_USE (IEC_60559_TYPES_EXT)
      |                                   ^
/usr/include/stdlib.h:238:35: error: missing binary operator before token "("
  238 | #if __HAVE_FLOAT64 &amp;&amp; __GLIBC_USE (IEC_60559_TYPES_EXT)
      |                                   ^
/usr/include/stdlib.h:244:36: error: missing binary operator before token "("
  244 | #if __HAVE_FLOAT128 &amp;&amp; __GLIBC_USE (IEC_60559_TYPES_EXT)
      |                                    ^
/usr/include/stdlib.h:250:36: error: missing binary operator before token "("
  250 | #if __HAVE_FLOAT32X &amp;&amp; __GLIBC_USE (IEC_60559_TYPES_EXT)
      |                                    ^
/usr/include/stdlib.h:256:36: error: missing binary operator before token "("
  256 | #if __HAVE_FLOAT64X &amp;&amp; __GLIBC_USE (IEC_60559_TYPES_EXT)
      |                                    ^
/usr/include/stdlib.h:262:37: error: missing binary operator before token "("
  262 | #if __HAVE_FLOAT128X &amp;&amp; __GLIBC_USE (IEC_60559_TYPES_EXT)
      |                                     ^
In file included from /usr/include/x86_64-linux-gnu/bits/types/locale_t.h:22,
                 from /usr/include/stdlib.h:273,
                 from /usr/include/c++/11/cstdlib:75,
                 from /usr/include/c++/11/ext/string_conversions.h:41,
                 from /usr/include/c++/11/bits/basic_string.h:6608,
                 from /usr/include/c++/11/string:55,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/c10/macros/Macros.h:246,
                 from /media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/c10/core/AutogradState.h:3,
                 from /media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/c10/core/AutogradState.cpp:1:
/usr/include/x86_64-linux-gnu/bits/types/__locale_t.h:27:8: error: redefinition of ‘struct __locale_struct’
   27 | struct __locale_struct
      |        ^~~~~~~~~~~~~~~
In file included from /home/kaan/anaconda3/envs/pytorch-dev/x86_64-conda-linux-gnu/sysroot/usr/include/wchar.h:180,
                 from /usr/include/c++/11/cwchar:44,
                 from /usr/include/c++/11/bits/postypes.h:40,
                 from /usr/include/c++/11/iosfwd:40,
                 from /usr/include/c++/11/ios:38,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/c10/macros/Macros.h:246,
                 from /media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/c10/core/AutogradState.h:3,
                 from /media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/c10/core/AutogradState.cpp:1:
/home/kaan/anaconda3/envs/pytorch-dev/x86_64-conda-linux-gnu/sysroot/usr/include/xlocale.h:27:16: note: previous definition of ‘struct __locale_struct’
   27 | typedef struct __locale_struct
      |                ^~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/cstdlib:75,
                 from /usr/include/c++/11/ext/string_conversions.h:41,
                 from /usr/include/c++/11/bits/basic_string.h:6608,
                 from /usr/include/c++/11/string:55,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/c10/macros/Macros.h:246,
                 from /media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/c10/core/AutogradState.h:3,
                 from /media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/c10/core/AutogradState.cpp:1:
/usr/include/stdlib.h:541:6: error: expected initializer before ‘__attribute_alloc_size__’
  541 |      __attribute_alloc_size__ ((1)) __wur;
      |      ^~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/stdlib.h:544:35: error: expected initializer before ‘__attribute_alloc_size__’
  544 |      __THROW __attribute_malloc__ __attribute_alloc_size__ ((1, 2)) __wur;
      |                                   ^~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/stdlib.h:552:47: error: expected initializer before ‘__attribute_alloc_size__’
  552 |      __THROW __attribute_warn_unused_result__ __attribute_alloc_size__ ((2));
      |                                               ^~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/stdlib.h:565:6: error: expected initializer before ‘__attribute_alloc_size__’
  565 |      __attribute_alloc_size__ ((2, 3))
      |      ^~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/stdlib.h:570:14: error: expected initializer before ‘__attr_dealloc’
  570 |      __THROW __attr_dealloc (reallocarray, 1);
      |              ^~~~~~~~~~~~~~
In file included from /usr/include/c++/11/cstdlib:75,
                 from /usr/include/c++/11/ext/string_conversions.h:41,
                 from /usr/include/c++/11/bits/basic_string.h:6608,
                 from /usr/include/c++/11/string:55,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/c10/macros/Macros.h:246,
                 from /media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/c10/core/AutogradState.h:3,
                 from /media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/c10/core/AutogradState.cpp:1:
/usr/include/stdlib.h:581:6: error: expected initializer before ‘__attribute_alloc_size__’
  581 |      __attribute_alloc_size__ ((1)) __wur;
      |      ^~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/stdlib.h:593:35: error: expected initializer before ‘__attribute_alloc_align__’
  593 |      __THROW __attribute_malloc__ __attribute_alloc_align__ ((1))
      |                                   ^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/stdlib.h:799:6: error: expected initializer before ‘__attr_dealloc_free’
  799 |      __attr_dealloc_free __wur;
      |      ^~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/cstdlib:75,
                 from /usr/include/c++/11/ext/string_conversions.h:41,
                 from /usr/include/c++/11/bits/basic_string.h:6608,
                 from /usr/include/c++/11/string:55,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/c10/macros/Macros.h:246,
                 from /media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/c10/core/AutogradState.h:3,
                 from /media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/c10/core/AutogradState.cpp:1:
/usr/include/stdlib.h:943:5: error: expected initializer before ‘__attr_access’
  943 |     __attr_access ((__read_only__, 2));
      |     ^~~~~~~~~~~~~
/usr/include/stdlib.h:948:3: error: expected initializer before ‘__fortified_attr_access’
  948 |   __fortified_attr_access (__write_only__, 1, 3)
      |   ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/stdlib.h:1003:30: error: expected initializer before ‘__fortified_attr_access’
 1003 |      __THROW __nonnull ((2)) __fortified_attr_access (__write_only__, 2, 3);
      |                              ^~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/ext/string_conversions.h:41,
                 from /usr/include/c++/11/bits/basic_string.h:6608,
                 from /usr/include/c++/11/string:55,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/c10/macros/Macros.h:246,
                 from /media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/c10/core/AutogradState.h:3,
                 from /media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/c10/core/AutogradState.cpp:1:
/usr/include/c++/11/cstdlib:144:11: error: ‘calloc’ has not been declared in ‘::’
  144 |   using ::calloc;
      |           ^~~~~~
/usr/include/c++/11/cstdlib:151:11: error: ‘malloc’ has not been declared in ‘::’
  151 |   using ::malloc;
      |           ^~~~~~
/usr/include/c++/11/cstdlib:164:11: error: ‘realloc’ has not been declared in ‘::’
  164 |   using ::realloc;
      |           ^~~~~~~
[4600/6287] Building CXX object third_party/kineto/libkineto/CMakeFiles/kineto_base.dir/src/ActivityProfilerProxy.cpp.o
[4601/6287] Building CXX object c10/CMakeFiles/c10.dir/core/Allocator.cpp.o
</code></pre>
<p>I believe it has something to do with my conda enviroment which results in a cmake problem.</p>
<p>Here is my CMAKE_PREFIX_PATH:</p>
<p><code>/home/kaan/anaconda3/envs/pytorch-dev:/home/kaan/anaconda3/envs/pytorch-dev/x86_64-conda-linux-gnu/sysroot/usr</code></p>
<p>Am I on the right track?</p>

username: ptrblck
cooked: <p>I would ignore the warning for now and try to focus on the first error.<br>
Unfortunately, I haven’t seen this error before assuming it is indeed the first one (<code>missing "("</code> are usually reported as a fallout of a previous issue in my builds).<br>
In case you are using a “non-standard” build environment, it might be easier to try to build PyTorch in e.g. a clean Ubuntu 20.04 docker container.<br>
While the usage might not be fitting your use case you could at least compare a working env to yours and try to check if e.g. your compiler toolchain is too old/new etc.</p>

username: kaad01
cooked: <p>I checked everything. Here is the log: <a href="https://drive.google.com/file/d/1e0hcPOtDDvBa6YKXhlHWJ0P_wbSAwTGQ/view?usp=sharing" rel="noopener nofollow ugc">https://drive.google.com/file/d/1e0hcPOtDDvBa6YKXhlHWJ0P_wbSAwTGQ/view?usp=sharing</a><br>
Could you please look into it?<br>
If I can’t find a solution today, I will try a virtual Box tomorrow.</p>

username: ptrblck
cooked: <p>It seems the error is raised by the <code>#include &lt;sstream&gt;</code> call in <a href="https://github.com/pytorch/pytorch/blob/d6cd130e0b791a0556ebc7bbd6871840b65ad35c/c10/macros/Macros.h#L246"><code>c10/macros/Macros.h</code></a> which then fails in:</p>
<pre><code class="lang-python">In file included from /usr/include/stdlib.h:26,
                 from /usr/include/c++/11/cstdlib:75,
                 from /usr/include/c++/11/ext/string_conversions.h:41,
                 from /usr/include/c++/11/bits/basic_string.h:6608,
                 from /usr/include/c++/11/string:55,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/c10/macros/Macros.h:246,
                 from /media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/c10/core/AutogradState.h:3,
                 from /media/kaan/HDD/Dokumente/Uni/Master/SWP_OSS/pytorch/c10/core/AutogradState.cpp:1:
/usr/include/x86_64-linux-gnu/bits/libc-header-start.h:74:17: error: missing binary operator before token "("
   74 | #if __GLIBC_USE (IEC_60559_BFP_EXT) || __GLIBC_USE (ISOC2X)
      |                 ^
</code></pre>
<p>Are you able to build any C++ application with <code>sstream</code>?</p>

username: kaad01
cooked: <p>I don’t work with c++, so I don’t know how to test this.<br>
For now, I just tried to compile and run this code:</p>
<pre><code class="lang-auto">#include &lt;sstream&gt;
#include &lt;stdio.h&gt;
int main()
{
  printf ("Hello World!\n");
  return 0;
}

</code></pre>
<p>I don’t know if this makes sense because I don’t use sstream here. But It is included and still compiles.</p>

username: kaad01
cooked: <p>I was able to install pytorch in my virtualbox. I can now work on it. I think the installation failed on my main device, because</p>
<ol>
<li>I have Kubuntu 22.04 (maybe Kubuntu was the problem or 22.04</li>
<li>pytorch does not care about my CMake Path (VirtualBox Ubuntu wouldn’t let me build with the cmake from conda. I had to do <code>sudo apt install cmake</code> first)</li>
</ol>

username: oke-aditya
cooked: <p>Strange I could install PyTorch from source on CUDA 11.7 over Ubuntu 22.04. This is what I used.</p>
<pre><code class="lang-auto">export CMAKE_PREFIX_PATH=${CONDA_PREFIX:-"$(dirname $(which conda))/../"}
USE_DISTRIBUTED=0 MAX_JOBS=10 python setup.py develop 
</code></pre>

username: kaad01
cooked: <p>Hmm, I didn’t use CUDA, but maybe Ubuntu 22.04 had problems with VirtualBox rather than Pytorch.</p>