I’m using libtorch as a dependency for our library using Cocoapods. It compiles fine when I use I use libtorch in an app, but fails when I import libtorch headers
Specific Steps:
pod lib create <pod>
- Add the C++ library as a dependency on the podspec
s.dependency 'LibTorch', '~> 1.3.0'
- Add Objective-C files
TestClass.h
andTestClass.m
- Import the library on
TestClass.m
#import "TestClass.h"
#import <LibTorch/LibTorch.h>
@implementation TestClass
@end
pod install
- Build the project, then it fails to build.
Error when buidling: 'torch/script.h' not found
In Pods/LibTorch/Core/Libtorch.h
#ifndef LibTorch_h
#define LibTorch_h
#include <torch/script.h>
#endif
I’ve filed a similar issue in cocoapods here https://github.com/CocoaPods/CocoaPods/issues/9678 but I think this may be a libtorch issue with how its header/include paths are set.
Here is a sample project: https://github.com/mjjimenez/SamplePod
@xta0 can I ask you for some help on this?