# Getting LibTorch to work

**URL:** <https://discuss.pytorch.org/t/getting-libtorch-to-work/31538>\
**Category:** Uncategorized\
**Created:** [December 7, 2018, 11:10am UTC](https://discuss.pytorch.org/t/getting-libtorch-to-work/31538 "2018-12-07T11:10:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sklipnoty](https://discuss.pytorch.org/letter_avatar_proxy/v4/letter/s/a4c791/32.png) [@Sklipnoty](https://discuss.pytorch.org/u/Sklipnoty)\
**Post date:** [December 7, 2018, 11:10am UTC](https://discuss.pytorch.org/t/getting-libtorch-to-work/31538/1 "2018-12-07T11:10:26Z")

</div>

I was following the guide on `https://pytorch.org/cppdocs/installing.html`

When running the make command I get the following errors;

```auto
make -j4
[50%] Linking CXX executable example-app
ld: warning: ignoring file /Users/axl/Documents/pytorch/libtorch/lib/libtorch.so, file was built for unsupported file format ( 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x03 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 ) which is not the architecture being linked (x86_64): /Users/axl/Documents/pytorch/libtorch/lib/libtorch.so
ld: warning: ignoring file /Users/axl/Documents/pytorch/libtorch/lib/libcaffe2.so, file was built for unsupported file format ( 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x03 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 ) which is not the architecture being linked (x86_64): /Users/axl/Documents/pytorch/libtorch/lib/libcaffe2.so
ld: warning: ignoring file /Users/axl/Documents/pytorch/libtorch/lib/libc10.so, file was built for unsupported file format ( 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x03 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 ) which is not the architecture being linked (x86_64): /Users/axl/Documents/pytorch/libtorch/lib/libc10.so
Undefined symbols for architecture x86_64:
  "at::UndefinedTensorImpl::_singleton", referenced from:
      at::UndefinedTensorImpl::singleton() in main.cpp.o
  "at::print(std:: __1::basic_ostream<char, std::__ 1::char_traits<char> >&, at::Tensor const&, long long)", referenced from:
      at::operator<<(std:: __1::basic_ostream<char, std::__ 1::char_traits<char> >&, at::Tensor const&) in main.cpp.o
  "at::native::rand(c10::ArrayRef<long long>, c10::TensorOptions const&)", referenced from:
      at::rand(c10::ArrayRef<long long>, c10::TensorOptions const&) in main.cpp.o
  "c10::impl::device_guard_impl_registry", referenced from:
      c10::impl::getDeviceGuardImpl(c10::DeviceType) in main.cpp.o
  "c10::Error::Error(c10::SourceLocation, std:: __1::basic_string<char, std::__ 1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
      torch::autograd::make_variable(at::Tensor, bool) in main.cpp.o
      torch::jit::Block::appendNode(torch::jit::Node*) in main.cpp.o
      torch::jit::Node::inBlockList() const in main.cpp.o
      c10::impl::getDeviceGuardImpl(c10::DeviceType) in main.cpp.o
      c10::intrusive_ptr<at::TensorImpl, at::UndefinedTensorImpl>::retain_() in main.cpp.o
  "c10::Device::validate()", referenced from:
      c10::Device::Device(c10::DeviceType, short) in main.cpp.o
  "c10::Symbol::fromQualString(std:: __1::basic_string<char, std::__ 1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
      torch::rand(c10::ArrayRef<long long>, c10::TensorOptions const&) in main.cpp.o
  "c10::operator<<(std:: __1::basic_ostream<char, std::__ 1::char_traits<char> >&, c10::DeviceType)", referenced from:
      std:: __1::basic_ostream<char, std::__ 1::char_traits<char> >& c10::detail::_str<c10::DeviceType>(std:: __1::basic_ostream<char, std::__ 1::char_traits<char> >&, c10::DeviceType const&) in main.cpp.o
  "torch::jit::Node::insertBefore(torch::jit::Node*)", referenced from:
      torch::jit::Block::appendNode(torch::jit::Node*) in main.cpp.o
  "torch::jit::Graph::create(c10::Symbol, unsigned long)", referenced from:
      torch::rand(c10::ArrayRef<long long>, c10::TensorOptions const&) in main.cpp.o
  "torch::jit::tracer::getTracingState()", referenced from:
      torch::rand(c10::ArrayRef<long long>, c10::TensorOptions const&) in main.cpp.o
      torch::jit::tracer::isTracing() in main.cpp.o
  "torch::jit::tracer::setTracingState(std::__1::shared_ptr<torch::jit::tracer::TracingState>)", referenced from:
      torch::rand(c10::ArrayRef<long long>, c10::TensorOptions const&) in main.cpp.o
  "torch::jit::tracer::recordSourceLocation(torch::jit::Node*)", referenced from:
      torch::rand(c10::ArrayRef<long long>, c10::TensorOptions const&) in main.cpp.o
  "torch::jit::tracer::addInputs(torch::jit::Node*, char const*, c10::ArrayRef<long long>)", referenced from:
      torch::rand(c10::ArrayRef<long long>, c10::TensorOptions const&) in main.cpp.o
  "torch::jit::tracer::addInputs(torch::jit::Node*, char const*, c10::TensorOptions const&)", referenced from:
      torch::rand(c10::ArrayRef<long long>, c10::TensorOptions const&) in main.cpp.o
  "torch::jit::tracer::addOutput(torch::jit::Node*, at::Tensor const&)", referenced from:
      torch::rand(c10::ArrayRef<long long>, c10::TensorOptions const&) in main.cpp.o
  "torch::autograd::Variable::Impl::Impl(at::Tensor, bool, torch::autograd::Edge)", referenced from:
      c10::intrusive_ptr<torch::autograd::Variable::Impl, c10::detail::intrusive_target_default_null_type<torch::autograd::Variable::Impl> > c10::intrusive_ptr<torch::autograd::Variable::Impl, c10::detail::intrusive_target_default_null_type<torch::autograd::Variable::Impl> >::make<at::Tensor&, bool&>(at::Tensor&&&, bool&&&) in main.cpp.o
  "caffe2::detail::_typeMetaDataInstance_preallocated_6", referenced from:
      caffe2::detail::TypeMetaData const* caffe2::TypeMeta::_typeMetaDataInstance<float>() in main.cpp.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [example-app] Error 1
make[1]: *** [CMakeFiles/example-app.dir/all] Error 2
make: *** [all] Error 2

```

---

<div class="post-metadata">

**Author:** ![Raul-Cardona](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/raul-cardona/32/61804_2.png) [@Raul-Cardona](https://discuss.pytorch.org/u/Raul-Cardona)\
**Post date:** [July 1, 2023, 11:01pm UTC](https://discuss.pytorch.org/t/getting-libtorch-to-work/31538/2 "2023-07-01T23:01:11Z")

</div>

Did you ever find a solution? Getting the exact same thing when running make command

---

<div class="post-metadata">

**Author:** ![Raul-Cardona](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/raul-cardona/32/61804_2.png) [@Raul-Cardona](https://discuss.pytorch.org/u/Raul-Cardona)\
**Post date:** [July 1, 2023, 11:01pm UTC](https://discuss.pytorch.org/t/getting-libtorch-to-work/31538/3 "2023-07-01T23:01:46Z")

</div>

I know it’s been a while since you posted this lol
