SPM carthage dependency produces undefined symbols for architecture

Hi, I'm trying to use an executable library defined by a target like so:

[...]
.target(
        name: "Tunisia",
        dependencies: [
            "CarthageKit",
            "carthage", // this is of type .executable in his Package.swift
            "Commandant",
            "Curry",
            "PrettyColors"
        ]
    )

And I am able to successfully import the module (which is backed-up by an executable, but it is a target itself:

    import carthage

    public struct CacheCommand: CommandProtocol {
    
        public struct CacheOptions: OptionsProtocol {
            public let force: Bool
            public let verbose: Bool
            public let buildOptions: BuildOptions
            public let dependenciesToBuild: [String]?
        
            public static func evaluate(_ m: CommandMode) -> Result<CacheOptions, CommandantError<CarthageError>> {
                 return curry(CacheOptions.init)
                     <*> m <| Option(key: "force", defaultValue: false, usage: "To force the cache creation, invalidating potential previous values")
                     <*> m <| Option(key: "verbose", defaultValue: false, usage: "Verbose output")
                     <*> BuildOptions.evaluate(m) // This is the complaint symbol not being found, but it is correctly autocompleted
                     <*> (m <| Argument(defaultValue: [], usage: "the dependency names to build", usageParameter: "dependency names")).map { $0.isEmpty ? nil : $0 }
                
        }
        
    }
    
    public let verb = "cache"
    public let function = "Build the project's dependencies and caches them"
    
    public func run(_ options: CacheOptions) -> Result<(), CarthageError> {
        .success(())
    }
}

Xcode does not complain about autocompletion, the import nor the code, until I build my executable (which depends on the target that defines the other external executable):

Undefined symbols for architecture x86_64:
  "static (extension in carthage):CarthageKit.BuildOptions.evaluate(Commandant.CommandMode) -> Result.Result<CarthageKit.BuildOptions, Commandant.CommandantError<CarthageKit.CarthageError>>", referenced from:
      static tunisia.CacheCommand.CacheOptions.evaluate(Commandant.CommandMode) -> Result.Result<tunisia.CacheCommand.CacheOptions, Commandant.CommandantError<CarthageKit.CarthageError>> in Cache.o
ld: symbol(s) not found for architecture x86_64

Any clue why is this happening? It is not supported to include a target that is an executable per sé even if it defines a target in its original Package.swift?

Terms of Service

Privacy Policy

Cookie Policy