I’ve compiled libtorch for iOS simulator as shown here 5 and linked it to my Xcode project.
Includes work fine, but actual libtorch code cases this error when building:
Undefined symbols for architecture arm64:
“c10::UndefinedTensorImpl::_singleton”, referenced from:
c10::UndefinedTensorImpl::singleton() in test.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Code as test.cpp:
#include "test.hpp"
#include "ATen/ATen.h"
#include "caffe2/core/timer.h"
#include "caffe2/utils/string_utils.h"
#include "torch/csrc/autograd/grad_mode.h"
#include "torch/csrc/jit/serialization/import.h"
#include "torch/script.h"

at::Tensor v;

Please, tell what I am doing wrong and how to fix it.