LibTorch Cocoapod can't be installed - 'Transitive dependency' error

Wondering if anyone else has run into this issue. I tried installing each of LibTorch-Lite and LibTorch into my iOS project using cocoapods. Specifically I added the dependency into my podspec, and ran pod install. I’m getting a weird error I can’t find any help for online:

Installing LibTorch-Lite (1.9.0)
Using Yams (4.0.0)
Using djinni (0.1.0)
Using libopencv-aruco (3.4.2)
[!] The 'Pods-DLToolTestApp' target has transitive dependencies that include static binaries: (/Users/beakin/src/software/host/Modules/BNI.DLTools/Example/Pods/LibTorch-Lite/install/lib/libc10.a, /Users/beakin/src/software/host/Modules/BNI.DLTools/Example/Pods/LibTorch-Lite/install/lib/libclog.a, /Users/beakin/src/software/host/Modules/BNI.DLTools/Example/Pods/LibTorch-Lite/install/lib/libcpuinfo.a, /Users/beakin/src/software/host/Modules/BNI.DLTools/Example/Pods/LibTorch-Lite/install/lib/libeigen_blas.a, /Users/beakin/src/software/host/Modules/BNI.DLTools/Example/Pods/LibTorch-Lite/install/lib/libpthreadpool.a, /Users/beakin/src/software/host/Modules/BNI.DLTools/Example/Pods/LibTorch-Lite/install/lib/libpytorch_qnnpack.a, /Users/beakin/src/software/host/Modules/BNI.DLTools/Example/Pods/LibTorch-Lite/install/lib/libtorch.a, /Users/beakin/src/software/host/Modules/BNI.DLTools/Example/Pods/LibTorch-Lite/install/lib/libtorch_cpu.a, and /Users/beakin/src/software/host/Modules/BNI.DLTools/Example/Pods/LibTorch-Lite/install/lib/libXNNPACK.a)

Has anyone else run into this? I get the same error trying to install LibTorch instead using cocoapods, so I assume it’s an issue with my configuration, but can’t figure out where I went wrong.

Fyi, for anyone getting the same message and then having trouble compiling - i was adding the dependency to a pod created for use in a few downstream apps. I found that I needed to add the following to the “Other Linker Flags” in those downstream projects for it to compile:

--force_load "<path to pod folder>/LibTorch-Lite/install/lib/libtorch.a" --force_load "<path to pod folder>/LibTorch-Lite/install/lib/libtorch_cpu.a"

Hope that helps anyone else running into the issue.

1 Like