Compiling issues

serveri24h: <p>Hello, I’m trying to write the hello world program and following all the instructions in “<a href="https://pytorch.org/cppdocs/installing.html" class="inline-onebox" rel="noopener nofollow ugc">Installing C++ Distributions of PyTorch — PyTorch master documentation</a>”. I can manege to build all the files with cmake with following prints:</p>
<pre><code class="lang-auto">-- The C compiler identification is AppleClang 8.0.0.8000042
-- The CXX compiler identification is AppleClang 8.0.0.8000042
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- MKL_ARCH: None, set to ` intel64` by default
-- MKL_ROOT /Users/kayttaja-sepe/anaconda
-- MKL_LINK: None, set to ` dynamic` by default
-- MKL_INTERFACE_FULL: None, set to ` intel_ilp64` by default
-- MKL_THREADING: None, set to ` intel_thread` by default
-- MKL_MPI: None, set to ` mpich` by default
-- Found Torch: /MAIN/KOODI/C/lib/libtorch/lib/libtorch.dylib  
-- Configuring done
-- Generating done
-- Build files have been written to: /MAIN/KOODI/C/torch_test/out
</code></pre>
<p>Do MKL_ARCH / MKL_ROOT etc. have something to do with GPU or what are they? I would appreciate any info about these variables.</p>
<p>Next when I compile, I get the following error:</p>
<pre><code class="lang-auto">In file included from /MAIN/KOODI/C/torch_test/main.cpp:1:
In file included from /MAIN/KOODI/C/lib/libtorch/include/torch/csrc/api/include/torch/torch.h:3:
In file included from /MAIN/KOODI/C/lib/libtorch/include/torch/csrc/api/include/torch/all.h:8:
In file included from /MAIN/KOODI/C/lib/libtorch/include/torch/csrc/api/include/torch/data.h:3:
In file included from /MAIN/KOODI/C/lib/libtorch/include/torch/csrc/api/include/torch/data/dataloader.h:3:
In file included from /MAIN/KOODI/C/lib/libtorch/include/torch/csrc/api/include/torch/data/dataloader/stateful.h:3:
In file included from /MAIN/KOODI/C/lib/libtorch/include/torch/csrc/api/include/torch/data/dataloader/base.h:3:
In file included from /MAIN/KOODI/C/lib/libtorch/include/torch/csrc/api/include/torch/data/dataloader_options.h:4:
In file included from /MAIN/KOODI/C/lib/libtorch/include/torch/csrc/api/include/torch/types.h:3:
In file included from /MAIN/KOODI/C/lib/libtorch/include/ATen/ATen.h:11:
In file included from /MAIN/KOODI/C/lib/libtorch/include/ATen/DeviceGuard.h:4:
In file included from /MAIN/KOODI/C/lib/libtorch/include/ATen/core/Tensor.h:3:
In file included from /MAIN/KOODI/C/lib/libtorch/include/ATen/core/TensorBody.h:16:
/MAIN/KOODI/C/lib/libtorch/include/c10/core/Scalar.h:208:37: error: inline declaration of 'to&lt;unsigned char&gt;' follows non-inline definition
AT_FORALL_SCALAR_TYPES_WITH_COMPLEX(DEFINE_TO)
</code></pre>
<p>And the basically same error following repeatedly. The path to libtorch is 100% correct and the library is up-to-date and my compiler supports c++14. I’m running Mac OS X 10.12.6 though and don’t want to update for several reasons.</p>
<p>I would appreciate all the help to debug and understand this issue. I personally have no clue what to do next. I have been using PyTorch on python for years but wanted to experiment with c++ version.</p>
<p>EDIT: And I forgot to mention that I’m using CPU</p>

ptrblck: <aside class="quote no-group" data-username="serveri24h" data-post="1" data-topic="155561">
<div class="title">
<div class="quote-controls"></div>
<img loading="lazy" alt="" width="24" height="24" src="https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/serveri24h/48/51064_2.png" class="avatar"> serveri24h:</div>
<blockquote>
<p>Do MKL_ARCH / MKL_ROOT etc. have something to do with GPU or what are they?</p>
</blockquote>
</aside>
<p>No, they are used to install Intel’s Math-Kernel Library.</p>
<aside class="quote no-group" data-username="serveri24h" data-post="1" data-topic="155561">
<div class="title">
<div class="quote-controls"></div>
<img loading="lazy" alt="" width="24" height="24" src="https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/serveri24h/48/51064_2.png" class="avatar"> serveri24h:</div>
<blockquote>
<p>And the basically same error following repeatedly.</p>
</blockquote>
</aside>
<p>Is this the very first error or are you seeing error messages before?</p>

serveri24h: <aside class="quote no-group" data-username="ptrblck" data-post="2" data-topic="155561">
<div class="title">
<div class="quote-controls"></div>
<img loading="lazy" alt="" width="24" height="24" src="https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/ptrblck/48/1823_2.png" class="avatar"> ptrblck:</div>
<blockquote>
<p>No, they are used to install Intel’s Math-Kernel Library.</p>
</blockquote>
</aside>
<p>Thank you. I was asking because the example I followed didn’t show such message.</p>
<aside class="quote no-group" data-username="ptrblck" data-post="2" data-topic="155561">
<div class="title">
<div class="quote-controls"></div>
<img loading="lazy" alt="" width="24" height="24" src="https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/ptrblck/48/1823_2.png" class="avatar"> ptrblck:</div>
<blockquote>
<p>Is this the very first error or are you seeing error messages before?</p>
</blockquote>
</aside>
<p>This is the first error message! The above code block shows the beginning of the error messages right after the compiling fails. The only console outputs before that are:</p>
<pre><code class="lang-auto">Consolidate compiler generated dependencies of target torch-test
[ 50%] Building CXX object CMakeFiles/torch-test.dir/main.cpp.o
</code></pre>

ptrblck: <p>Thanks for the update. Sorry, I haven’t seen this error before, but also don’t use a Mac so unsure if it’s specific to this platform. Would you have any Linux workstation (or is Mac able to run e.g. Ubuntu docker containers) where you could check if your code would compile in this setup?</p>

serveri24h: <p>Hello! Thanks for the quick update. It is likely that issue is related to my Mac. I will have a linux platform available in few weeks, so I can do some testing then. This is not so urgent, so I can come back if I run in to more issues or can ask more specific questions.</p>