When trying to build my tests, I exclusively run into errors such as the following:
Undefined symbols for architecture x86_64:
"vtable for c10::AutogradMetaInterface", referenced from:
c10::AutogradMetaInterface::AutogradMetaInterface() in TorchModule.o
None of my fixes have worked so far. I have created an objective-c bridging header for my tests, and here is my Podfile:
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'FinalDancer' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
# Pods for FinalDancer
pod 'LibTorch', '~> 1.4.0'
target 'FinalDancerTests' do
inherit! :search_paths
# Pods for testing
pod 'LibTorch', '~> 1.4.0'
end
end
For some reason, my xcconfig for test didn’t have the following line: LIBRARY_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/LibTorch/install/lib"
It was also missing some OTHER_LDFLAGS like pytorch_qnnpack.
Not really sure why or how this fixed it, but I pasted those lines in. There is some code duplication that my compiler is warning me of but my tests are running.
I tried looking for examples of unit tests in the Helloworld project, but there don’t seem to be any examples I can pull from. Any help would be appreciated!
Seems like it’s duplicated with https://github.com/pytorch/pytorch/issues/32040. I can come up with a PR to disable NNPACK, but not sure if it’ll fix your issue. Anyway, I’ll give an update here once I have the PR.
Edit: Actually, how do I apply this PR to my XCode project? I am quite new to this. Or if you would like me to test on a sample project, I can do that as well.