Compiling issues

Hello, I’m trying to write the hello world program and following all the instructions in “Installing C++ Distributions of PyTorch — PyTorch master documentation”. I can manege to build all the files with cmake with following prints:

-- The C compiler identification is AppleClang
-- The CXX compiler identification is AppleClang
-- 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 - 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

Do MKL_ARCH / MKL_ROOT etc. have something to do with GPU or what are they? I would appreciate any info about these variables.

Next when I compile, I get the following error:

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<unsigned char>' follows non-inline definition

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.

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.

EDIT: And I forgot to mention that I’m using CPU

No, they are used to install Intel’s Math-Kernel Library.

Is this the very first error or are you seeing error messages before?

Thank you. I was asking because the example I followed didn’t show such message.

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:

Consolidate compiler generated dependencies of target torch-test
[ 50%] Building CXX object CMakeFiles/torch-test.dir/main.cpp.o

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?

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.