Nested dependencies with Swift Packages and xcframeworks

I'm writing an macos app where the main xcproj depends on some swift packages. Some of these packages depend on other packages. Some of these packages provide xcframeworks for 3rd party dependencies.

I'm at a point where packages are compiling in isolation, but I get dependency related errors when integrating into the app.

I use a number of 3rd party libraries: Ceres, Eigen, gflags, glog, OpenCV. The flow of dependencies looks like this:

App -> OpenCV
App -> Eigen
App -> Ceres (which internally depends on headers from Eigen, gflags, glog)
App -> Custom Package -> Eigen, gflags, glog, OpenCV

I have Packages for each of these 3rd party libraries that provides them as an xcframework, with the exception of Eigen which is consumed as source (either by the App via build settings that point to include files within the project, or by my Custom Package via git submodule)

When I compile the App it has trouble building each dependency. I can import them fine, but at compile time I get errors from within the dependencies themselves (ie compiles errors inside Eigen, or inside OpenCV, etc)

Some questions:

  1. High level - Is my intended structure possible with swift packages? or am I attempting something that's not supported?
  2. Low level - if it is possible, can someone point me in the right direction to get my dependencies linked properly so they compile. Any build settings in XCode or flags to set in my Package.swift files?


  • macOS 12.6
  • XCode 14.2
  • App target 12.3



I have the same issue at my org and would like to know :crying_cat_face: