4

I built a mobile (iOS) app using LibTorch recently, with this tutorial as a guide: https://medium.com/flawless-app-stories/on-device-machine-learning-with-swiftui-and-pytorch-mobile-aa0dcec5d881. That project uses CocoaPods for the LibTorch dependency, so it was pretty straightforward, but now I'm trying to build a macOS version of the app and I honestly don't understand how to build and link to LibTorch for macOS (the pod seems to be iOS-only). I work in Swift, and have experience with Obj-C, Java, and Python, but not much with C/C++, so the whole process of building and linking C/C++ is pretty foreign to me.

I've gone through a LibTorch on macOS tutorial for C++ (here: https://medium.com/@albertsundjaja/installing-pytorch-c-api-d52c722f47ec), building a basic C++ "example-app" with a libtorch dependency. That works fine, but I'm not sure how that knowledge translates over to building a Swift app, with a LibTorch dependency, in Xcode.

I've also tried following the guide here: https://github.com/rystylee/ofxLibTorch, but have a ton of Undefined symbols for architecture x86_64: errors. I'm trying to link to the LibTorch downloaded from here: https://pytorch.org/get-started/locally/

Any help, advice, or links to other guides greatly appreciated. I'm on Xcode 11.4.1 and Catalina (which has its own set of problems, from what I've read).

UPDATE: Going a little deeper down this rabbit hole, I wind up hitting this: Catalina C++: Using <cmath> headers yield error: no member named 'signbit' in the global namespace, but none of the "solutions" seem to help (specifically, I'm seeing the cmath problems that are mentioned a bunch of times in related threads).

jbm
  • 1,248
  • 10
  • 22
  • If you're going to downvote, add a comment so I know what the problem is, otherwise it's just totally unhelpful and extremely aggravating. I've been at this for several hours and reached the point where I obviously just need help. SO is a great place for finding help.... – jbm May 17 '20 at 17:20

0 Answers0