Building cpp example with libtorch fails with both LibTorch built from source and from the website

Hello! I’m trying to build pytorch cpp MNIST example from here. However, I can’t seem to build the example through README. I tried both building libtorch from source and a libtorch downloaded from the website.

When I build libtorch from source, I follow the example from this README. Basically, I did:

cd pytorch
mkdir build_libtorch && cd build_libtorch
python ../tools/build_libtorch.py

In the example I built it with

cd mnist
mkdir build
cd build
cmake -DCMAKE_PREFIX_PATH=/home/pytorch/build_libtorch/build/ ..
make

I got a cmake error:

-- The C compiler identification is GNU 8.4.0
-- The CXX compiler identification is GNU 8.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at /home/pytorch/build_libtorch/build/Caffe2Config.cmake:14 (include):
  include could not find load file:

    /home/pytorch/build_libtorch/build/public/utils.cmake
Call Stack (most recent call first):
  /home/pytorch/build_libtorch/build/TorchConfig.cmake:40 (find_package)
  CMakeLists.txt:4 (find_package)


CMake Error at /home/pytorch/build_libtorch/build/Caffe2Config.cmake:17 (include):
  include could not find load file:

    /home/pytorch/build_libtorch/build/public/threads.cmake
Call Stack (most recent call first):
  /home/pytorch/build_libtorch/build/TorchConfig.cmake:40 (find_package)
  CMakeLists.txt:4 (find_package)


CMake Error at /home/pytorch/build_libtorch/build/Caffe2Config.cmake:22 (include):
  include could not find load file:

    /home/pytorch/build_libtorch/build/public/gflags.cmake
Call Stack (most recent call first):
  /home/pytorch/build_libtorch/build/TorchConfig.cmake:40 (find_package)
  CMakeLists.txt:4 (find_package)


CMake Error at /home/pytorch/build_libtorch/build/Caffe2Config.cmake:24 (message):
  Your installed Caffe2 version uses gflags but the gflags library cannot be
  found.  Did you accidentally remove it, or have you set the right
  CMAKE_PREFIX_PATH and/or GFLAGS_ROOT_DIR? If you do not have gflags, you
  will need to install gflags and set the library path accordingly.
Call Stack (most recent call first):
  /home/pytorch/build_libtorch/build/TorchConfig.cmake:40 (find_package)
  CMakeLists.txt:4 (find_package)


-- Configuring incomplete, errors occurred!
See also "/home/pytorch-examples/cpp/mnist/build/CMakeFiles/CMakeOutput.log".

Meanwhile, I also tried to build the example with libtorch downloaded from the website (nightly build).
cmake was through successfully but I got the following message

Unzipped /mydata/lexu/pytorch-examples/cpp/mnist/build/data/t10k-labels-idx1-ubyte.gz ...
-- Configuring done
CMake Warning at CMakeLists.txt:18 (add_executable):
  Cannot generate a safe runtime search path for target mnist because there
  is a cycle in the constraint graph:

    dir 0 is [/mydata/lexu/libtorch/lib]
    dir 1 is [/usr/local/cuda/lib64/stubs]
    dir 2 is [/usr/local/cuda/lib64]
      dir 3 must precede it due to runtime library [libnvToolsExt.so.1]
    dir 3 is [/mydata/lexu/anaconda3/lib]
      dir 2 must precede it due to runtime library [libnvToolsExt.so.1]

  Some of these libraries may not be found correctly.


-- Generating done
-- Build files have been written to: /mydata/lexu/pytorch-examples/cpp/mnist/build

However, building with the nighly built cause the following error:

/home/libtorch/include/torch/csrc/api/include/torch/data/iterator.h:68:25: error: binding reference of type ‘torch::data::Example<>&’ to ‘const torch::data::Example<>’ discards qualifiers
     return batch_.value();
                         ^
In file included from /home/libtorch/include/c10/core/ScalarType.h:6,
                 from /home/libtorch/include/c10/core/Scalar.h:9,
                 from /home/libtorch/include/ATen/core/TensorBody.h:7,
                 from /home/libtorch/include/ATen/Tensor.h:11,
                 from /home/libtorch/include/ATen/Context.h:4,
                 from /home/libtorch/include/ATen/ATen.h:5,
                 from /home/libtorch/include/torch/csrc/api/include/torch/types.h:3,
                 from /home/libtorch/include/torch/csrc/api/include/torch/data/dataloader_options.h:4,
                 from /home/libtorch/include/torch/csrc/api/include/torch/data/dataloader/base.h:3,
                 from /home/libtorch/include/torch/csrc/api/include/torch/data/dataloader/stateful.h:3,
                 from /home/libtorch/include/torch/csrc/api/include/torch/data/dataloader.h:3,
                 from /home/libtorch/include/torch/csrc/api/include/torch/data.h:3,
                 from /home/libtorch/include/torch/csrc/api/include/torch/all.h:4,
                 from /home/libtorch/include/torch/csrc/api/include/torch/torch.h:3,
                 from /home/pytorch-examples/cpp/mnist/mnist.cpp:1:
/home/libtorch/include/c10/util/Optional.h: In instantiation of ‘c10::optional<T>& c10::optional<T>::operator=(c10::optional<T>&&) [with T = torch::data::DataLoaderBase<torch::data::datasets::MapDataset<torch::data::datasets::MapDataset<torch::data::datasets::MNIST, torch::data::transforms::Normalize<> >, torch::data::transforms::Stack<torch::data::Example<> > >, torch::data::Example<>, std::vector<long unsigned int, std::allocator<long unsigned int> > >::Result]’:
/home/libtorch/include/torch/csrc/api/include/torch/data/detail/sequencers.h:93:39:   required from ‘c10::optional<T> torch::data::detail::sequencers::OrderedSequencer<Result>::next(typename torch::data::detail::sequencers::Sequencer<Result>::ResultProducer) [with Result = torch::data::DataLoaderBase<torch::data::datasets::MapDataset<torch::data::datasets::MapDataset<torch::data::datasets::MNIST, torch::data::transforms::Normalize<> >, torch::data::transforms::Stack<torch::data::Example<> > >, torch::data::Example<>, std::vector<long unsigned int, std::allocator<long unsigned int> > >::Result; typename torch::data::detail::sequencers::Sequencer<Result>::ResultProducer = std::function<c10::optional<torch::data::DataLoaderBase<torch::data::datasets::MapDataset<torch::data::datasets::MapDataset<torch::data::datasets::MNIST, torch::data::transforms::Normalize<> >, torch::data::transforms::Stack<torch::data::Example<> > >, torch::data::Example<>, std::vector<long unsigned int, std::allocator<long unsigned int> > >::Result>()>]’
/home/libtorch/include/torch/csrc/api/include/torch/data/detail/sequencers.h:71:20:   required from here
/home/libtorch/include/c10/util/Optional.h:396:23: error: passing ‘const torch::data::DataLoaderBase<torch::data::datasets::MapDataset<torch::data::datasets::MapDataset<torch::data::datasets::MNIST, torch::data::transforms::Normalize<> >, torch::data::transforms::Stack<torch::data::Example<> > >, torch::data::Example<>, std::vector<long unsigned int, std::allocator<long unsigned int> > >::Result’ as ‘this’ argument discards qualifiers [-fpermissive]
       contained_val() = std::move(*rhs);
In file included from /home/libtorch/include/torch/csrc/api/include/torch/data/dataloader/stateful.h:3,
                 from /home/libtorch/include/torch/csrc/api/include/torch/data/dataloader.h:3,
                 from /home/libtorch/include/torch/csrc/api/include/torch/data.h:3,
                 from /home/libtorch/include/torch/csrc/api/include/torch/all.h:4,
                 from /home/libtorch/include/torch/csrc/api/include/torch/torch.h:3,
                 from /home/pytorch-examples/cpp/mnist/mnist.cpp:1:
/home/libtorch/include/torch/csrc/api/include/torch/data/dataloader/base.h:121:10: note:   in call to ‘torch::data::DataLoaderBase<torch::data::datasets::MapDataset<torch::data::datasets::MapDataset<torch::data::datasets::MNIST, torch::data::transforms::Normalize<> >, torch::data::transforms::Stack<torch::data::Example<> > >, torch::data::Example<>, std::vector<long unsigned int, std::allocator<long unsigned int> > >::Result& torch::data::DataLoaderBase<torch::data::datasets::MapDataset<torch::data::datasets::MapDataset<torch::data::datasets::MNIST, torch::data::transforms::Normalize<> >, torch::data::transforms::Stack<torch::data::Example<> > >, torch::data::Example<>, std::vector<long unsigned int, std::allocator<long unsigned int> > >::Result::operator=(const torch::data::DataLoaderBase<torch::data::datasets::MapDataset<torch::data::datasets::MapDataset<torch::data::datasets::MNIST, torch::data::transforms::Normalize<> >, torch::data::transforms::Stack<torch::data::Example<> > >, torch::data::Example<>, std::vector<long unsigned int, std::allocator<long unsigned int> > >::Result&)’
   struct Result : Sequenced {
          ^~~~~~
In file included from /home/libtorch/include/c10/core/ScalarType.h:6,
                 from /home/libtorch/include/c10/core/Scalar.h:9,
                 from /home/libtorch/include/ATen/core/TensorBody.h:7,
                 from /home/libtorch/include/ATen/Tensor.h:11,
                 from /home/libtorch/include/ATen/Context.h:4,
                 from /home/libtorch/include/ATen/ATen.h:5,
                 from /home/libtorch/include/torch/csrc/api/include/torch/types.h:3,
                 from /home/libtorch/include/torch/csrc/api/include/torch/data/dataloader_options.h:4,
                 from /home/libtorch/include/torch/csrc/api/include/torch/data/dataloader/base.h:3,
                 from /home/libtorch/include/torch/csrc/api/include/torch/data/dataloader/stateful.h:3,
                 from /home/libtorch/include/torch/csrc/api/include/torch/data/dataloader.h:3,
                 from /home/libtorch/include/torch/csrc/api/include/torch/data.h:3,
                 from /home/libtorch/include/torch/csrc/api/include/torch/all.h:4,
                 from /home/libtorch/include/torch/csrc/api/include/torch/torch.h:3,
                 from /home/pytorch-examples/cpp/mnist/mnist.cpp:1:
/home/libtorch/include/c10/util/Optional.h: In instantiation of ‘c10::optional<T>& c10::optional<T>::operator=(c10::optional<T>&&) [with T = torch::data::Example<>]’:
/home/libtorch/include/torch/csrc/api/include/torch/data/iterator.h:56:12:   required from ‘void torch::data::detail::ValidIterator<Batch>::next() [with Batch = torch::data::Example<>]’
/home/libtorch/include/torch/csrc/api/include/torch/data/iterator.h:50:8:   required from here
/home/libtorch/include/c10/util/Optional.h:396:23: error: passing ‘const torch::data::Example<>’ as ‘this’ argument discards qualifiers [-fpermissive]
       contained_val() = std::move(*rhs);
In file included from /home/libtorch/include/torch/csrc/api/include/torch/data/datasets/base.h:3,
                 from /home/libtorch/include/torch/csrc/api/include/torch/data/datasets.h:3,
                 from /home/libtorch/include/torch/csrc/api/include/torch/data.h:4,
                 from /home/libtorch/include/torch/csrc/api/include/torch/all.h:4,
                 from /home/libtorch/include/torch/csrc/api/include/torch/torch.h:3,
                 from /home/pytorch-examples/cpp/mnist/mnist.cpp:1:
/home/libtorch/include/torch/csrc/api/include/torch/data/example.h:12:8: note:   in call to ‘torch::data::Example<>& torch::data::Example<>::operator=(const torch::data::Example<>&)’
 struct Example {
        ^~~~~~~
In file included from /home/libtorch/include/c10/core/ScalarType.h:6,
                 from /home/libtorch/include/c10/core/Scalar.h:9,
                 from /home/libtorch/include/ATen/core/TensorBody.h:7,
                 from /home/libtorch/include/ATen/Tensor.h:11,
                 from /home/libtorch/include/ATen/Context.h:4,
                 from /home/libtorch/include/ATen/ATen.h:5,
                 from /home/libtorch/include/torch/csrc/api/include/torch/types.h:3,
                 from /home/libtorch/include/torch/csrc/api/include/torch/data/dataloader_options.h:4,
                 from /home/libtorch/include/torch/csrc/api/include/torch/data/dataloader/base.h:3,
                 from /home/libtorch/include/torch/csrc/api/include/torch/data/dataloader/stateful.h:3,
                 from /home/libtorch/include/torch/csrc/api/include/torch/data/dataloader.h:3,
                 from /home/libtorch/include/torch/csrc/api/include/torch/data.h:3,
                 from /home/libtorch/include/torch/csrc/api/include/torch/all.h:4,
                 from /home/libtorch/include/torch/csrc/api/include/torch/torch.h:3,
                 from /home/pytorch-examples/cpp/mnist/mnist.cpp:1:
/home/libtorch/include/c10/util/Optional.h: In instantiation of ‘c10::optional<T>& c10::optional<T>::operator=(c10::optional<T>&&) [with T = torch::ExpandingArray<3>]’:
/home/libtorch/include/torch/csrc/api/include/torch/nn/options/pooling.h:428:8:   required from ‘void torch::nn::Cloneable<Derived>::clone_(torch::nn::Module&, const c10::optional<c10::Device>&) [with Derived = torch::nn::FractionalMaxPool3dImpl]’
/home/libtorch/include/torch/csrc/api/include/torch/nn/cloneable.h:81:8:   required from here
/home/libtorch/include/c10/util/Optional.h:396:23: error: passing ‘const torch::ExpandingArray<3>’ as ‘this’ argument discards qualifiers [-fpermissive]
       contained_val() = std::move(*rhs);
In file included from /home/libtorch/include/torch/csrc/api/include/torch/nn/options/conv.h:6,
                 from /home/libtorch/include/torch/csrc/api/include/torch/nn/functional/conv.h:3,
                 from /home/libtorch/include/torch/csrc/api/include/torch/nn/functional.h:4,
                 from /home/libtorch/include/torch/csrc/api/include/torch/nn.h:4,
                 from /home/libtorch/include/torch/csrc/api/include/torch/all.h:7,
                 from /home/libtorch/include/torch/csrc/api/include/torch/torch.h:3,
                 from /home/pytorch-examples/cpp/mnist/mnist.cpp:1:
/home/libtorch/include/torch/csrc/api/include/torch/expanding_array.h:23:7: note:   in call to ‘torch::ExpandingArray<3>& torch::ExpandingArray<3>::operator=(const torch::ExpandingArray<3>&)’
 class ExpandingArray {
       ^~~~~~~~~~~~~~
In file included from /home/libtorch/include/c10/core/ScalarType.h:6,
                 from /home/libtorch/include/c10/core/Scalar.h:9,
                 from /home/libtorch/include/ATen/core/TensorBody.h:7,
                 from /home/libtorch/include/ATen/Tensor.h:11,
                 from /home/libtorch/include/ATen/Context.h:4,
                 from /home/libtorch/include/ATen/ATen.h:5,
                 from /home/libtorch/include/torch/csrc/api/include/torch/types.h:3,
                 from /home/libtorch/include/torch/csrc/api/include/torch/data/dataloader_options.h:4,
                 from /home/libtorch/include/torch/csrc/api/include/torch/data/dataloader/base.h:3,
                 from /home/libtorch/include/torch/csrc/api/include/torch/data/dataloader/stateful.h:3,
                 from /home/libtorch/include/torch/csrc/api/include/torch/data/dataloader.h:3,
                 from /home/libtorch/include/torch/csrc/api/include/torch/data.h:3,
                 from /home/libtorch/include/torch/csrc/api/include/torch/all.h:4,
                 from /home/libtorch/include/torch/csrc/api/include/torch/torch.h:3,
                 from /home/pytorch-examples/cpp/mnist/mnist.cpp:1:
/home/libtorch/include/c10/util/Optional.h: In instantiation of ‘c10::optional<T>& c10::optional<T>::operator=(c10::optional<T>&&) [with T = torch::ExpandingArray<3, double>]’:
/home/libtorch/include/torch/csrc/api/include/torch/nn/options/pooling.h:428:8:   required from ‘void torch::nn::Cloneable<Derived>::clone_(torch::nn::Module&, const c10::optional<c10::Device>&) [with Derived = torch::nn::FractionalMaxPool3dImpl]’
/home/libtorch/include/torch/csrc/api/include/torch/nn/cloneable.h:81:8:   required from here
/home/libtorch/include/c10/util/Optional.h:396:23: error: passing ‘const torch::ExpandingArray<3, double>’ as ‘this’ argument discards qualifiers [-fpermissive]
       contained_val() = std::move(*rhs);
In file included from /home/libtorch/include/torch/csrc/api/include/torch/nn/options/conv.h:6,
                 from /home/libtorch/include/torch/csrc/api/include/torch/nn/functional/conv.h:3,
                 from /home/libtorch/include/torch/csrc/api/include/torch/nn/functional.h:4,
                 from /home/libtorch/include/torch/csrc/api/include/torch/nn.h:4,
                 from /home/libtorch/include/torch/csrc/api/include/torch/all.h:7,
                 from /home/libtorch/include/torch/csrc/api/include/torch/torch.h:3,
                 from /home/pytorch-examples/cpp/mnist/mnist.cpp:1:
/home/libtorch/include/torch/csrc/api/include/torch/expanding_array.h:23:7: note:   in call to ‘torch::ExpandingArray<3, double>& torch::ExpandingArray<3, double>::operator=(const torch::ExpandingArray<3, double>&)’
 class ExpandingArray {
       ^~~~~~~~~~~~~~
In file included from /home/libtorch/include/c10/core/ScalarType.h:6,
                 from /home/libtorch/include/c10/core/Scalar.h:9,
                 from /home/libtorch/include/ATen/core/TensorBody.h:7,
                 from /home/libtorch/include/ATen/Tensor.h:11,
                 from /home/libtorch/include/ATen/Context.h:4,
                 from /home/libtorch/include/ATen/ATen.h:5,
                 from /home/libtorch/include/torch/csrc/api/include/torch/types.h:3,
                 from /home/libtorch/include/torch/csrc/api/include/torch/data/dataloader_options.h:4,
                 from /home/libtorch/include/torch/csrc/api/include/torch/data/dataloader/base.h:3,
                 from /home/libtorch/include/torch/csrc/api/include/torch/data/dataloader/stateful.h:3,
                 from /home/libtorch/include/torch/csrc/api/include/torch/data/dataloader.h:3,
                 from /home/libtorch/include/torch/csrc/api/include/torch/data.h:3,
                 from /home/libtorch/include/torch/csrc/api/include/torch/all.h:4,
                 from /home/libtorch/include/torch/csrc/api/include/torch/torch.h:3,
                 from /home/pytorch-examples/cpp/mnist/mnist.cpp:1:
/home/libtorch/include/c10/util/Optional.h: In instantiation of ‘c10::optional<T>& c10::optional<T>::operator=(c10::optional<T>&&) [with T = torch::ExpandingArray<2>]’:
/home/libtorch/include/torch/csrc/api/include/torch/nn/options/pooling.h:428:8:   required from ‘void torch::nn::Cloneable<Derived>::clone_(torch::nn::Module&, const c10::optional<c10::Device>&) [with Derived = torch::nn::FractionalMaxPool2dImpl]’
/home/libtorch/include/torch/csrc/api/include/torch/nn/cloneable.h:81:8:   required from here
/home/libtorch/include/c10/util/Optional.h:396:23: error: passing ‘const torch::ExpandingArray<2>’ as ‘this’ argument discards qualifiers [-fpermissive]
       contained_val() = std::move(*rhs);
In file included from /home/libtorch/include/torch/csrc/api/include/torch/nn/options/conv.h:6,
                 from /home/libtorch/include/torch/csrc/api/include/torch/nn/functional/conv.h:3,
                 from /home/libtorch/include/torch/csrc/api/include/torch/nn/functional.h:4,
                 from /home/libtorch/include/torch/csrc/api/include/torch/nn.h:4,
                 from /home/libtorch/include/torch/csrc/api/include/torch/all.h:7,
                 from /home/libtorch/include/torch/csrc/api/include/torch/torch.h:3,
                 from /home/pytorch-examples/cpp/mnist/mnist.cpp:1:
/home/libtorch/include/torch/csrc/api/include/torch/expanding_array.h:23:7: note:   in call to ‘torch::ExpandingArray<2>& torch::ExpandingArray<2>::operator=(const torch::ExpandingArray<2>&)’
 class ExpandingArray {
       ^~~~~~~~~~~~~~
In file included from /home/libtorch/include/c10/core/ScalarType.h:6,
                 from /home/libtorch/include/c10/core/Scalar.h:9,
                 from /home/libtorch/include/ATen/core/TensorBody.h:7,
                 from /home/libtorch/include/ATen/Tensor.h:11,
                 from /home/libtorch/include/ATen/Context.h:4,
                 from /home/libtorch/include/ATen/ATen.h:5,
                 from /home/libtorch/include/torch/csrc/api/include/torch/types.h:3,
                 from /home/libtorch/include/torch/csrc/api/include/torch/data/dataloader_options.h:4,
                 from /home/libtorch/include/torch/csrc/api/include/torch/data/dataloader/base.h:3,
                 from /home/libtorch/include/torch/csrc/api/include/torch/data/dataloader/stateful.h:3,
                 from /home/libtorch/include/torch/csrc/api/include/torch/data/dataloader.h:3,
                 from /home/libtorch/include/torch/csrc/api/include/torch/data.h:3,
                 from /home/libtorch/include/torch/csrc/api/include/torch/all.h:4,
                 from /home/libtorch/include/torch/csrc/api/include/torch/torch.h:3,
                 from /home/pytorch-examples/cpp/mnist/mnist.cpp:1:
/home/libtorch/include/c10/util/Optional.h: In instantiation of ‘c10::optional<T>& c10::optional<T>::operator=(c10::optional<T>&&) [with T = torch::ExpandingArray<2, double>]’:
/home/libtorch/include/torch/csrc/api/include/torch/nn/options/pooling.h:428:8:   required from ‘void torch::nn::Cloneable<Derived>::clone_(torch::nn::Module&, const c10::optional<c10::Device>&) [with Derived = torch::nn::FractionalMaxPool2dImpl]’
/home/libtorch/include/torch/csrc/api/include/torch/nn/cloneable.h:81:8:   required from here
/home/libtorch/include/c10/util/Optional.h:396:23: error: passing ‘const torch::ExpandingArray<2, double>’ as ‘this’ argument discards qualifiers [-fpermissive]
       contained_val() = std::move(*rhs);
In file included from /home/libtorch/include/torch/csrc/api/include/torch/nn/options/conv.h:6,
                 from /home/libtorch/include/torch/csrc/api/include/torch/nn/functional/conv.h:3,
                 from /home/libtorch/include/torch/csrc/api/include/torch/nn/functional.h:4,
                 from /home/libtorch/include/torch/csrc/api/include/torch/nn.h:4,
                 from /home/libtorch/include/torch/csrc/api/include/torch/all.h:7,
                 from /home/libtorch/include/torch/csrc/api/include/torch/torch.h:3,
                 from /home/pytorch-examples/cpp/mnist/mnist.cpp:1:
/home/libtorch/include/torch/csrc/api/include/torch/expanding_array.h:23:7: note:   in call to ‘torch::ExpandingArray<2, double>& torch::ExpandingArray<2, double>::operator=(const torch::ExpandingArray<2, double>&)’
 class ExpandingArray {
       ^~~~~~~~~~~~~~
CMakeFiles/mnist.dir/build.make:62: recipe for target 'CMakeFiles/mnist.dir/mnist.cpp.o' failed
make[2]: *** [CMakeFiles/mnist.dir/mnist.cpp.o] Error 1
CMakeFiles/Makefile2:72: recipe for target 'CMakeFiles/mnist.dir/all' failed
make[1]: *** [CMakeFiles/mnist.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

Any hints on what’s going on?

Thanks!

Got the libtorch built from source worked – now it produces the exact same make error as the official libtorch.

@flint-stone I have the same issue but not with provided example with this example dendisuhubdy_libtorch_examples and complex network. Could you solve the problem?

log file:

– The C compiler identification is GNU 7.5.0
– The CXX compiler identification is GNU 7.5.0
– Check for working C compiler: /usr/bin/cc
– Check for working C compiler: /usr/bin/cc – works
– Detecting C compiler ABI info
– Detecting C compiler ABI info - done
– Detecting C compile features
– Detecting C compile features - done
– Check for working CXX compiler: /usr/bin/c++
– Check for working CXX compiler: /usr/bin/c++ – works
– Detecting CXX compiler ABI info
– Detecting CXX compiler ABI info - done
– Detecting CXX compile features
– Detecting CXX compile features - done
– Looking for pthread.h
– Looking for pthread.h - found
– Looking for pthread_create
– Looking for pthread_create - not found
– Looking for pthread_create in pthreads
– Looking for pthread_create in pthreads - not found
– Looking for pthread_create in pthread
– Looking for pthread_create in pthread - found
– Found Threads: TRUE
– Found CUDA: /usr/local/cuda-10.2 (found version “10.2”)
– Caffe2: CUDA detected: 10.2
– Caffe2: CUDA nvcc is: /usr/local/cuda-10.2/bin/nvcc
– Caffe2: CUDA toolkit directory: /usr/local/cuda-10.2
– Caffe2: Header version is: 10.2
– Found CUDNN: /usr/lib/x86_64-linux-gnu/libcudnn.so
– Found cuDNN: v7.6.5 (include: /usr/include, library: /usr/lib/x86_64-linux-gnu/libcudnn.so)
– Autodetected CUDA architecture(s): 5.2
– Added CUDA NVCC flags for: -gencode;arch=compute_52,code=sm_52
– Found Torch: /home/ubuntu/libtorch/libtorch/lib/libtorch.so
– Found OpenCV: /usr/local (found version “3.4.9”)
– OpenCV library status:
– config: /usr/local/share/OpenCV
– version: 3.4.9
– libraries: opencv_calib3d;opencv_core;opencv_dnn;opencv_features2d;opencv_flann;opencv_highgui;opencv_imgcodecs;opencv_imgproc;opencv_ml;opencv_objdetect;opencv_photo;opencv_shape;opencv_stitching;opencv_superres;opencv_video;opencv_videoio;opencv_videostab
– include path: /usr/local/include;/usr/local/include/opencv
– Downloading MNIST dataset
/home/ubuntu/libtorch_examples/build/…/data/mnist/train-images-idx3-ubyte.gz already exists, skipping …
/home/ubuntu/libtorch_examples/build/…/data/mnist/train-images-idx3-ubyte already exists, skipping …
/home/ubuntu/libtorch_examples/build/…/data/mnist/train-labels-idx1-ubyte.gz already exists, skipping …
/home/ubuntu/libtorch_examples/build/…/data/mnist/train-labels-idx1-ubyte already exists, skipping …
/home/ubuntu/libtorch_examples/build/…/data/mnist/t10k-images-idx3-ubyte.gz already exists, skipping …
/home/ubuntu/libtorch_examples/build/…/data/mnist/t10k-images-idx3-ubyte already exists, skipping …
/home/ubuntu/libtorch_examples/build/…/data/mnist/t10k-labels-idx1-ubyte.gz already exists, skipping …
/home/ubuntu/libtorch_examples/build/…/data/mnist/t10k-labels-idx1-ubyte already exists, skipping …
– Configuring done
– Generating done
– Build files have been written to: /home/ubuntu/libtorch_examples/build
Scanning dependencies of target mnist
[ 14%] Building CXX object src/CMakeFiles/mnist.dir/mnist.cpp.o
Scanning dependencies of target dcgan
[ 28%] Building CXX object src/CMakeFiles/dcgan.dir/dcgan.cpp.o
Scanning dependencies of target yolov3
[ 42%] Building CXX object src/CMakeFiles/yolov3.dir/darknet.cpp.o
[ 57%] Building CXX object src/CMakeFiles/yolov3.dir/yolov3.cpp.o
In file included from /home/ubuntu/libtorch_examples/src/mnist.cpp:8:0:
/home/ubuntu/libtorch_examples/include/mnist.h:55:13: error: ‘FeatureDropout’ in namespace ‘torch::nn’ does not name a type
torch::nn::FeatureDropout conv2_drop;
^~~~~~~~~~~~~~
/home/ubuntu/libtorch_examples/include/mnist.h: In constructor ‘Net::Net()’:
/home/ubuntu/libtorch_examples/include/mnist.h:37:33: error: ‘conv2_drop’ was not declared in this scope
register_module(“conv2_drop”, conv2_drop);
^~~~~~~~~~
/home/ubuntu/libtorch_examples/include/mnist.h:37:33: note: suggested alternative: ‘conv2’
register_module(“conv2_drop”, conv2_drop);
^~~~~~~~~~
conv2
/home/ubuntu/libtorch_examples/include/mnist.h: In member function ‘at::Tensor Net::forward(at::Tensor)’:
/home/ubuntu/libtorch_examples/include/mnist.h:45:22: error: ‘conv2_drop’ was not declared in this scope
torch::max_pool2d(conv2_drop->forward(conv2->forward(x)), 2));
^~~~~~~~~~
/home/ubuntu/libtorch_examples/include/mnist.h:45:22: note: suggested alternative: ‘conv2’
torch::max_pool2d(conv2_drop->forward(conv2->forward(x)), 2));
^~~~~~~~~~
conv2
/home/ubuntu/libtorch_examples/src/mnist.cpp: In function ‘void test(Net&, c10::Device, DataLoader&, size_t)’:
/home/ubuntu/libtorch_examples/src/mnist.cpp:55:4: error: ‘Reduction’ has not been declared
Reduction::Sum)
^~~~~~~~~
/home/ubuntu/libtorch_examples/src/mnist.cpp: In function ‘int main(int, const char**)’:
/home/ubuntu/libtorch_examples/src/mnist.cpp:106:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (size_t epoch = 1; epoch <= options.epochs; ++epoch) {
^~~~~~~~~~~
/home/ubuntu/libtorch_examples/src/dcgan.cpp: In function ‘int main(int, const char**)’:
/home/ubuntu/libtorch_examples/src/dcgan.cpp:47:23: error: ‘using Conv2dOptions = struct torch::nn::ConvOptions<2> {aka struct torch::nn::ConvOptions<2>}’ has no member named ‘with_bias’
.with_bias(false)
^~~~~~~~~
/home/ubuntu/libtorch_examples/src/dcgan.cpp:49:11: error: ‘BatchNorm’ is not a member of ‘torch::nn’
nn::BatchNorm(256),
^~~~~~~~~
/home/ubuntu/libtorch_examples/src/dcgan.cpp:49:11: note: suggested alternative: ‘BatchNorm3d’
nn::BatchNorm(256),
^~~~~~~~~
BatchNorm3d
/home/ubuntu/libtorch_examples/src/dcgan.cpp:55:23: error: ‘struct torch::nn::ConvOptions<2>’ has no member named ‘with_bias’
.with_bias(false)
^~~~~~~~~
/home/ubuntu/libtorch_examples/src/dcgan.cpp:57:11: error: ‘BatchNorm’ is not a member of ‘torch::nn’
nn::BatchNorm(128),
^~~~~~~~~
/home/ubuntu/libtorch_examples/src/dcgan.cpp:57:11: note: suggested alternative: ‘BatchNorm3d’
nn::BatchNorm(128),
^~~~~~~~~
BatchNorm3d
/home/ubuntu/libtorch_examples/src/dcgan.cpp:63:23: error: ‘struct torch::nn::ConvOptions<2>’ has no member named ‘with_bias’
.with_bias(false)
^~~~~~~~~
/home/ubuntu/libtorch_examples/src/dcgan.cpp:65:11: error: ‘BatchNorm’ is not a member of ‘torch::nn’
nn::BatchNorm(64),
^~~~~~~~~
/home/ubuntu/libtorch_examples/src/dcgan.cpp:65:11: note: suggested alternative: ‘BatchNorm3d’
nn::BatchNorm(64),
^~~~~~~~~
BatchNorm3d
/home/ubuntu/libtorch_examples/src/dcgan.cpp:71:23: error: ‘struct torch::nn::ConvOptions<2>’ has no member named ‘with_bias’
.with_bias(false)
^~~~~~~~~
/home/ubuntu/libtorch_examples/src/dcgan.cpp:79:60: error: ‘struct torch::nn::ConvOptions<2>’ has no member named ‘with_bias’
nn::Conv2dOptions(1, 64, 4).stride(2).padding(1).with_bias(false)),
^~~~~~~~~
/home/ubuntu/libtorch_examples/src/dcgan.cpp:83:62: error: ‘struct torch::nn::ConvOptions<2>’ has no member named ‘with_bias’
nn::Conv2dOptions(64, 128, 4).stride(2).padding(1).with_bias(false)),
^~~~~~~~~
/home/ubuntu/libtorch_examples/src/dcgan.cpp:84:11: error: ‘BatchNorm’ is not a member of ‘torch::nn’
nn::BatchNorm(128),
^~~~~~~~~
/home/ubuntu/libtorch_examples/src/dcgan.cpp:84:11: note: suggested alternative: ‘BatchNorm3d’
nn::BatchNorm(128),
^~~~~~~~~
BatchNorm3d
/home/ubuntu/libtorch_examples/src/dcgan.cpp:88:63: error: ‘struct torch::nn::ConvOptions<2>’ has no member named ‘with_bias’
nn::Conv2dOptions(128, 256, 4).stride(2).padding(1).with_bias(false)),
^~~~~~~~~
/home/ubuntu/libtorch_examples/src/dcgan.cpp:89:11: error: ‘BatchNorm’ is not a member of ‘torch::nn’
nn::BatchNorm(256),
^~~~~~~~~
/home/ubuntu/libtorch_examples/src/dcgan.cpp:89:11: note: suggested alternative: ‘BatchNorm3d’
nn::BatchNorm(256),
^~~~~~~~~
BatchNorm3d
/home/ubuntu/libtorch_examples/src/dcgan.cpp:93:61: error: ‘struct torch::nn::ConvOptions<2>’ has no member named ‘with_bias’
nn::Conv2dOptions(256, 1, 3).stride(1).padding(0).with_bias(false)),
^~~~~~~~~
/home/ubuntu/libtorch_examples/src/dcgan.cpp:109:64: error: ‘struct torch::optim::AdamOptions’ has no member named ‘beta1’; did you mean ‘betas’?
generator->parameters(), torch::optim::AdamOptions(2e-4).beta1(0.5));
^~~~~
betas
/home/ubuntu/libtorch_examples/src/dcgan.cpp:111:68: error: ‘struct torch::optim::AdamOptions’ has no member named ‘beta1’; did you mean ‘betas’?
discriminator->parameters(), torch::optim::AdamOptions(2e-4).beta1(0.5));
^~~~~
betas
/home/ubuntu/libtorch_examples/src/darknet.cpp: In function ‘int split(const string&, std::vector<int, std::allocator >&, std::__cxx11::string)’:
/home/ubuntu/libtorch_examples/src/darknet.cpp:77:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i = 0; i < tmp.size(); i++)
^~~~~~~~~~
/home/ubuntu/libtorch_examples/src/darknet.cpp:81:1: warning: no return statement in function returning non-void [-Wreturn-type]
}
^
/home/ubuntu/libtorch_examples/src/darknet.cpp: In function ‘torch::nn::Conv2dOptions conv_options(int64_t, int64_t, int64_t, int64_t, int64_t, int64_t, bool)’:
/home/ubuntu/libtorch_examples/src/darknet.cpp:138:18: error: ‘torch::ExpandingArray<2> torch::nn::ConvOptions<2>::stride_’ is private within this context
conv_options.stride_ = stride;
^~~~~~~
In file included from /home/ubuntu/libtorch/libtorch/include/torch/csrc/api/include/torch/nn/functional/conv.h:3:0,
from /home/ubuntu/libtorch/libtorch/include/torch/csrc/api/include/torch/nn/functional.h:4,
from /home/ubuntu/libtorch/libtorch/include/torch/csrc/api/include/torch/nn.h:4,
from /home/ubuntu/libtorch/libtorch/include/torch/csrc/api/include/torch/all.h:7,
from /home/ubuntu/libtorch/libtorch/include/torch/csrc/api/include/torch/torch.h:3,
from /home/ubuntu/libtorch_examples/include/darknet.h:11,
from /home/ubuntu/libtorch_examples/src/darknet.cpp:11:
/home/ubuntu/libtorch/libtorch/include/torch/csrc/api/include/torch/nn/options/conv.h:122:42: note: declared private here
TORCH_ARG(ExpandingArray, stride) = 1;
^
/home/ubuntu/libtorch_examples/src/darknet.cpp:139:18: error: ‘torch::ExpandingArray<2> torch::nn::ConvOptions<2>::padding_’ is private within this context
conv_options.padding_ = padding;
^~~~~~~~
In file included from /home/ubuntu/libtorch/libtorch/include/torch/csrc/api/include/torch/nn/functional/conv.h:3:0,
from /home/ubuntu/libtorch/libtorch/include/torch/csrc/api/include/torch/nn/functional.h:4,
from /home/ubuntu/libtorch/libtorch/include/torch/csrc/api/include/torch/nn.h:4,
from /home/ubuntu/libtorch/libtorch/include/torch/csrc/api/include/torch/all.h:7,
from /home/ubuntu/libtorch/libtorch/include/torch/csrc/api/include/torch/torch.h:3,
from /home/ubuntu/libtorch_examples/include/darknet.h:11,
from /home/ubuntu/libtorch_examples/src/darknet.cpp:11:
/home/ubuntu/libtorch/libtorch/include/torch/csrc/api/include/torch/nn/options/conv.h:128:43: note: declared private here
TORCH_ARG(ExpandingArray, padding) = 0;
^
/home/ubuntu/libtorch_examples/src/darknet.cpp:140:18: error: ‘int64_t torch::nn::ConvOptions<2>::groups_’ is private within this context
conv_options.groups_ = groups;
^~~~~~~
In file included from /home/ubuntu/libtorch/libtorch/include/torch/csrc/api/include/torch/nn/functional/conv.h:3:0,
from /home/ubuntu/libtorch/libtorch/include/torch/csrc/api/include/torch/nn/functional.h:4,
from /home/ubuntu/libtorch/libtorch/include/torch/csrc/api/include/torch/nn.h:4,
from /home/ubuntu/libtorch/libtorch/include/torch/csrc/api/include/torch/all.h:7,
from /home/ubuntu/libtorch/libtorch/include/torch/csrc/api/include/torch/torch.h:3,
from /home/ubuntu/libtorch_examples/include/darknet.h:11,
from /home/ubuntu/libtorch_examples/src/darknet.cpp:11:
/home/ubuntu/libtorch/libtorch/include/torch/csrc/api/include/torch/nn/options/conv.h:138:32: note: declared private here
TORCH_ARG(int64_t, groups) = 1;
^
/home/ubuntu/libtorch_examples/src/darknet.cpp:141:18: error: ‘using Conv2dOptions = struct torch::nn::ConvOptions<2> {aka struct torch::nn::ConvOptions<2>}’ has no member named ‘with_bias_’; did you mean ‘bias_’?
conv_options.with_bias_ = with_bias;
^~~~~~~~~~
bias_
/home/ubuntu/libtorch_examples/src/darknet.cpp: In function ‘torch::nn::BatchNormOptions bn_options(int64_t)’:
/home/ubuntu/libtorch_examples/src/darknet.cpp:147:16: error: ‘bool torch::nn::BatchNormOptions::affine_’ is private within this context
bn_options.affine_ = true;
^~~~~~~
In file included from /home/ubuntu/libtorch/libtorch/include/torch/csrc/api/include/torch/nn/functional/batchnorm.h:3:0,
from /home/ubuntu/libtorch/libtorch/include/torch/csrc/api/include/torch/nn/functional.h:3,
from /home/ubuntu/libtorch/libtorch/include/torch/csrc/api/include/torch/nn.h:4,
from /home/ubuntu/libtorch/libtorch/include/torch/csrc/api/include/torch/all.h:7,
from /home/ubuntu/libtorch/libtorch/include/torch/csrc/api/include/torch/torch.h:3,
from /home/ubuntu/libtorch_examples/include/darknet.h:11,
from /home/ubuntu/libtorch_examples/src/darknet.cpp:11:
/home/ubuntu/libtorch/libtorch/include/torch/csrc/api/include/torch/nn/options/batchnorm.h:29:29: note: declared private here
TORCH_ARG(bool, affine) = true;
^~~~
/home/ubuntu/libtorch_examples/src/darknet.cpp:148:16: error: ‘struct torch::nn::BatchNormOptions’ has no member named ‘stateful_’
bn_options.stateful_ = true;
^~~~~~~~~
/home/ubuntu/libtorch_examples/src/darknet.cpp: In member function ‘at::Tensor UpsampleLayer::forward(at::Tensor)’:
/home/ubuntu/libtorch_examples/src/darknet.cpp:172:21: warning: ‘using IntList = class c10::ArrayRef’ is deprecated [-Wdeprecated-declarations]
torch::IntList sizes = x.sizes();
^~~~~
In file included from /home/ubuntu/libtorch/libtorch/include/c10/util/Exception.h:6:0,
from /home/ubuntu/libtorch/libtorch/include/c10/core/Device.h:5,
from /home/ubuntu/libtorch/libtorch/include/c10/core/Allocator.h:6,
from /home/ubuntu/libtorch/libtorch/include/ATen/ATen.h:3,
from /home/ubuntu/libtorch/libtorch/include/torch/csrc/api/include/torch/types.h:3,
from /home/ubuntu/libtorch/libtorch/include/torch/csrc/api/include/torch/data/dataloader_options.h:4,
from /home/ubuntu/libtorch/libtorch/include/torch/csrc/api/include/torch/data/dataloader/base.h:3,
from /home/ubuntu/libtorch/libtorch/include/torch/csrc/api/include/torch/data/dataloader/stateful.h:3,
from /home/ubuntu/libtorch/libtorch/include/torch/csrc/api/include/torch/data/dataloader.h:3,
from /home/ubuntu/libtorch/libtorch/include/torch/csrc/api/include/torch/data.h:3,
from /home/ubuntu/libtorch/libtorch/include/torch/csrc/api/include/torch/all.h:4,
from /home/ubuntu/libtorch/libtorch/include/torch/csrc/api/include/torch/torch.h:3,
from /home/ubuntu/libtorch_examples/include/darknet.h:11,
from /home/ubuntu/libtorch_examples/src/darknet.cpp:11:
/home/ubuntu/libtorch/libtorch/include/c10/util/ArrayRef.h:278:1: note: declared here
C10_DEFINE_DEPRECATED_USING(IntList, ArrayRef<int64_t>)
^
/home/ubuntu/libtorch_examples/src/darknet.cpp: In member function ‘at::Tensor DetectionLayer::predict_transform(at::Tensor, int, std::vector<float, std::allocator >, int, c10::Device)’:
/home/ubuntu/libtorch_examples/src/darknet.cpp:240:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int i = 0; i < anchors.size(); i++)
^~~~~~~~~~~~~~
/home/ubuntu/libtorch_examples/src/darknet.cpp: In member function ‘void Darknet::create_modules()’:
/home/ubuntu/libtorch_examples/src/darknet.cpp:382:16: error: ‘BatchNorm’ is not a member of ‘torch::nn’
torch::nn::BatchNorm bn = torch::nn::BatchNorm(bn_options(filters));
^~~~~~~~~
/home/ubuntu/libtorch_examples/src/darknet.cpp:382:16: note: suggested alternative: ‘BatchNorm3d’
torch::nn::BatchNorm bn = torch::nn::BatchNorm(bn_options(filters));
^~~~~~~~~
BatchNorm3d
/home/ubuntu/libtorch_examples/src/darknet.cpp:383:35: error: ‘bn’ was not declared in this scope
module->push_back(bn);
^~
/home/ubuntu/libtorch_examples/src/darknet.cpp:383:35: note: suggested alternative: ‘yn’
module->push_back(bn);
^~
yn
/home/ubuntu/libtorch_examples/src/darknet.cpp:469:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int i = 0; i< masks.size(); i++)
~^~~~~~~~~~~~~~
/home/ubuntu/libtorch_examples/src/darknet.cpp: In member function ‘void Darknet::load_weights(const char*)’:
/home/ubuntu/libtorch_examples/src/darknet.cpp:528:10: error: ‘struct c10::TensorOptions’ has no member named ‘is_variable’
.is_variable(true);
^~~~~~~~~~~
/home/ubuntu/libtorch_examples/src/darknet.cpp:533:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int i = 0; i < module_list.size(); i++)
^~~~~~~~~~~~~~~~~~
/home/ubuntu/libtorch_examples/src/darknet.cpp:554:15: error: ‘BatchNormImpl’ is not a member of ‘torch::nn’
torch::nn::BatchNormImpl *bn_imp = dynamic_cast<torch::nn::BatchNormImpl *>(bn_module.get());
^~~~~~~~~~~~~
/home/ubuntu/libtorch_examples/src/darknet.cpp:554:15: note: suggested alternative: ‘BatchNorm3dImpl’
torch::nn::BatchNormImpl *bn_imp = dynamic_cast<torch::nn::BatchNormImpl *>(bn_module.get());
^~~~~~~~~~~~~
BatchNorm3dImpl
/home/ubuntu/libtorch_examples/src/darknet.cpp:554:30: error: ‘bn_imp’ was not declared in this scope
torch::nn::BatchNormImpl *bn_imp = dynamic_cast<torch::nn::BatchNormImpl *>(bn_module.get());
^~~~~~
/home/ubuntu/libtorch_examples/src/darknet.cpp:554:30: note: suggested alternative: ‘to_impl’
torch::nn::BatchNormImpl *bn_imp = dynamic_cast<torch::nn::BatchNormImpl >(bn_module.get());
^~~~~~
to_impl
/home/ubuntu/libtorch_examples/src/darknet.cpp:554:63: error: ‘BatchNormImpl’ in namespace ‘torch::nn’ does not name a type
torch::nn::BatchNormImpl *bn_imp = dynamic_cast<torch::nn::BatchNormImpl *>(bn_module.get());
^~~~~~~~~~~~~
/home/ubuntu/libtorch_examples/src/darknet.cpp:554:77: error: expected ‘>’ before ‘
’ token
torch::nn::BatchNormImpl *bn_imp = dynamic_cast<torch::nn::BatchNormImpl >(bn_module.get());
^
/home/ubuntu/libtorch_examples/src/darknet.cpp:554:77: error: expected ‘(’ before ‘
’ token
/home/ubuntu/libtorch_examples/src/darknet.cpp:554:78: error: expected primary-expression before ‘>’ token
torch::nn::BatchNormImpl *bn_imp = dynamic_cast<torch::nn::BatchNormImpl *>(bn_module.get());
^
/home/ubuntu/libtorch_examples/src/darknet.cpp:554:96: error: expected ‘)’ before ‘;’ token
torch::nn::BatchNormImpl *bn_imp = dynamic_cast<torch::nn::BatchNormImpl >(bn_module.get());
^
/home/ubuntu/libtorch_examples/src/darknet.cpp:526:23: warning: unused variable ‘options’ [-Wunused-variable]
at::TensorOptions options= torch::TensorOptions()
^~~~~~~
/home/ubuntu/libtorch_examples/src/darknet.cpp: In member function ‘at::Tensor Darknet::write_results(at::Tensor, int, float, float)’:
/home/ubuntu/libtorch_examples/src/darknet.cpp:738:28: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int n = 0; n < img_classes.size(); n++)
^~~~~~~~~~~~~~~~~~
/home/ubuntu/libtorch_examples/src/darknet.cpp:750:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int k = 0; k < img_classes.size(); k++)
^~~~~~~~~~~~~~~~~~
src/CMakeFiles/mnist.dir/build.make:62: recipe for target ‘src/CMakeFiles/mnist.dir/mnist.cpp.o’ failed
make[2]: *** [src/CMakeFiles/mnist.dir/mnist.cpp.o] Error 1
CMakeFiles/Makefile2:126: recipe for target ‘src/CMakeFiles/mnist.dir/all’ failed
make[1]: *** [src/CMakeFiles/mnist.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs…
src/CMakeFiles/dcgan.dir/build.make:62: recipe for target ‘src/CMakeFiles/dcgan.dir/dcgan.cpp.o’ failed
make[2]: *** [src/CMakeFiles/dcgan.dir/dcgan.cpp.o] Error 1
CMakeFiles/Makefile2:163: recipe for target ‘src/CMakeFiles/dcgan.dir/all’ failed
make[1]: *** [src/CMakeFiles/dcgan.dir/all] Error 2
/home/ubuntu/libtorch_examples/src/darknet.cpp: In member function ‘std::map<std::__cxx11::basic_string, std::__cxx11::basic_string >
Darknet::get_net_info()’:
/home/ubuntu/libtorch_examples/src/darknet.cpp:504:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
src/CMakeFiles/yolov3.dir/build.make:62: recipe for target ‘src/CMakeFiles/yolov3.dir/darknet.cpp.o’ failed
make[2]: *** [src/CMakeFiles/yolov3.dir/darknet.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs…
CMakeFiles/Makefile2:89: recipe for target ‘src/CMakeFiles/yolov3.dir/all’ failed
make[1]: *** [src/CMakeFiles/yolov3.dir/all] Error 2
Makefile:83: recipe for target ‘all’ failed
make: *** [all] Error 2

@Majid_Geravand
These are samples 12 months old, it might not compatible with latest libtorch. You can try libtorch 1.4 or earlier, or ask the owner of the repo which libtorch version his code is compatible with.

@glaringlee Thanks for your answer, Could you please let me know where can I download the libtorch 1.4 binary file? I could not find it in the website. Thanks

@Majid_Geravand
I assume you are under linux env.
for pre-c++11 ABI
https://download.pytorch.org/libtorch/cpu/libtorch-shared-with-deps-1.4.0%2Bcpu.zip
for c++11 ABI
https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-1.4.0%2Bcpu.zip