Summary
LocalLLMClientLlama fails to build because its C wrapper target
(LocalLLMClientLlamaC) doesn't have C++ stdlib available — #include <memory> fails with "file not found". The wrapper is a C/Objective-C target
that includes C++ headers from llama.cpp (utils.h, chat.h) but isn't
configured to compile with the C++ stdlib.
Repro
Consume LocalLLMClient main + LocalLLMClientLlama from a Swift 6 package:
.package(url: "https://github.com/tattn/LocalLLMClient.git", revision: "<main HEAD>"),
.target(
name: "MyTarget",
dependencies: [
.product(name: "LocalLLMClient", package: "LocalLLMClient"),
.product(name: "LocalLLMClientLlama", package: "LocalLLMClient"),
],
swiftSettings: [
.interoperabilityMode(.Cxx), // tried — doesn't help, since the
// failure is in upstream's C target
]
),
swift build →
.build/checkouts/LocalLLMClient/Sources/LocalLLMClientLlamaC/include/utils.h:1:10:
error: 'memory' file not found
1 | #include <memory>
| `- error: 'memory' file not found
2 | #include "../common/chat.h"
<unknown>:0: error: could not build Objective-C module 'LocalLLMClientLlamaC'
The chain: LocalLLMClientLlamaC.h → mtmd.h → utils.h → <memory> →
not found because the target is built as Objective-C / C, not C++.
Likely fix
The LocalLLMClientLlamaC target in Package.swift needs cxxSettings (or
needs to be declared as a .target with publicHeadersPath configured for
C++ + a .headerSearchPath that picks up llama.cpp's common/ directory).
Something like:
.target(
name: "LocalLLMClientLlamaC",
dependencies: [/* llama-binary, etc. */],
publicHeadersPath: "include",
cSettings: [
.headerSearchPath("../common"),
],
cxxSettings: [
.headerSearchPath("../common"),
.define("..."),
],
linkerSettings: [/* ... */]
)
Plus making the target file-extensions C++ if any of its own .m / .c files
are actually C++ in disguise.
The clean separation would be: a pure-C LocalLLMClientLlamaC target that
forwards to a separate C++ LocalLLMClientLlamaCxx target. But a cxxSettings
on the existing target is the minimum-disruption fix.
Context
Filed while wiring LocalLLMClient into OCCTSwiftPartsAgent. Pairs with
the MLX-backend Tokenizers issue (filed separately) — together they leave
LocalLLMClient unable to deliver any local-inference backend on current main.
For OCCTSwiftPartsAgent we've deferred the LocalLLMClient integration
pending a fix on either backend; the project meanwhile drives local
inference through OpenAI-compat (LM Studio) for Mac dev. The local
in-process path is needed for the iPad target, which can't run LM Studio.
Summary
LocalLLMClientLlamafails to build because its C wrapper target(
LocalLLMClientLlamaC) doesn't have C++ stdlib available —#include <memory>fails with "file not found". The wrapper is a C/Objective-C targetthat includes C++ headers from llama.cpp (
utils.h,chat.h) but isn'tconfigured to compile with the C++ stdlib.
Repro
Consume LocalLLMClient main + LocalLLMClientLlama from a Swift 6 package:
swift build→The chain:
LocalLLMClientLlamaC.h→mtmd.h→utils.h→<memory>→not found because the target is built as Objective-C / C, not C++.
Likely fix
The
LocalLLMClientLlamaCtarget inPackage.swiftneedscxxSettings(orneeds to be declared as a
.targetwithpublicHeadersPathconfigured forC++ + a
.headerSearchPaththat picks up llama.cpp'scommon/directory).Something like:
Plus making the target file-extensions C++ if any of its own .m / .c files
are actually C++ in disguise.
The clean separation would be: a pure-C
LocalLLMClientLlamaCtarget thatforwards to a separate C++
LocalLLMClientLlamaCxxtarget. But acxxSettingson the existing target is the minimum-disruption fix.
Context
Filed while wiring LocalLLMClient into OCCTSwiftPartsAgent. Pairs with
the MLX-backend
Tokenizersissue (filed separately) — together they leaveLocalLLMClient unable to deliver any local-inference backend on current main.
For OCCTSwiftPartsAgent we've deferred the LocalLLMClient integration
pending a fix on either backend; the project meanwhile drives local
inference through OpenAI-compat (LM Studio) for Mac dev. The local
in-process path is needed for the iPad target, which can't run LM Studio.