google-gemini / generative-ai-swift

The official Swift library for the Google Gemini API

Home Page:https://ai.google.dev/gemini-api/docs/get-started/tutorial?lang=swift

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

error: no such module 'OSLog' when building from Dockerfile on Mac using fly.io CLI `fly deploy` command

djryanash opened this issue · comments

Description of the bug:

I build a Swift Vapor app for the backend of my iOS app, the idea being to use the Google Gemini API for some very basic services on the backend for my iOS app.

In Xcode, I added the required dependency and target to the Package.swift file:

.package(url: "https://github.com/google/generative-ai-swift.git", from: "0.4.4")

.product(name: "GoogleGenerativeAI", package: "generative-ai-swift"),

As part of the Vapor template, the project already includes a Dockerfile and using flyctl from Homebrew with a few simple comment I should be able to theoretically deploy my app to fly.io.

fly launch works fine but then when I use fly deploy I get an error and it is unable to build:

/build/.build/checkouts/generative-ai-swift/Sources/GoogleAI/Logging.swift:16:8: error: no such module 'OSLog'
import OSLog
       ^

Clearly the error is related to the Logging.swift file inside generative-ai-swift dependency of the project.

If I use import OSLog anywhere inside my Vapor app, I don't get any build errors because, of course it's part of the Swift Standard Library. It just seems to not work from Logging.swift

Thanks.

Actual vs expected behavior:

Expected behavior: The project should be able to compile and deploy without errors from the command line using the command fly deploy command.

Actual behavior: The project doesn't compiled exists with the error:

/build/.build/checkouts/generative-ai-swift/Sources/GoogleAI/Logging.swift:16:8: error: no such module 'OSLog'

Any other information you'd like to share?

macOS 14.0, MacBook Pro 2020 1.4GHz quad-core Intel processor.
Xcode 15.1
Fly version 0.1.135 (latest)
Vapor (latest version)
Swift 5.9.2

Hi @djryanash, unfortunately we don't support Linux or Vapor in the SDK at this time. I created a feature request for this in #90 to get a sense of the demand for the feature.