LVGLBackend broken with Swift 5.9?
gregcotten opened this issue · 7 comments
Just discovered this lovely repo and tried poking around - I wanted to try out the LVGLBackend in the CounterExample but seem to be getting a strange compilation issue (Swift 5.9):
error: emit-module command failed with exit code 1 (use -v to see invocation)
{redacted}/swift-cross-ui/.build/arm64-apple-macosx/debug/LVGLBackend.build/module.modulemap:2:12: error: header '{redacted}/swift-cross-ui/.build/arm64-apple-macosx/debug/LVGLBackend.build/LVGLBackend-Swift.h' not found
header "{redacted}/swift-cross-ui/.build/arm64-apple-macosx/debug/LVGLBackend.build/LVGLBackend-Swift.h"
^
{redacted}/swift-cross-ui/Examples/Counter/CounterApp.swift:1:8: error: could not build Objective-C module 'LVGLBackend'
import LVGLBackend
^
{redacted}/swift-cross-ui/.build/arm64-apple-macosx/debug/LVGLBackend.build/module.modulemap:2:12: error: header '{redacted}/swift-cross-ui/.build/arm64-apple-macosx/debug/LVGLBackend.build/LVGLBackend-Swift.h' not found
header "{redacted}/swift-cross-ui/.build/arm64-apple-macosx/debug/LVGLBackend.build/LVGLBackend-Swift.h"
^
{redacted}/swift-cross-ui/Examples/Counter/CounterApp.swift:1:8: error: could not build Objective-C module 'LVGLBackend'
import LVGLBackend
^
error: fatalError
I can compile and run the LVGLSwift examples, so I think the problem somehow lies with LVGLBackend, but I have no idea why it thinks it's an Objc module, though. Maybe related? swiftlang/swift-package-manager#5925
Thanks for checking out the project! That is strange, my main idea is that maybe you haven’t imported LVGLBackend
?
Forgot to post my modification to the source code!
import LVGLBackend
import SwiftCrossUI
class CounterState: Observable {
@Observed
var count = 0
}
@main
struct CounterApp: App {
typealias Backend = LVGLBackend
let identifier = "dev.stackotter.CounterApp"
let state = CounterState()
let windowProperties = WindowProperties(title: "CounterApp", resizable: true)
var body: some ViewContent {
HStack(spacing: 20) {
Button("-") { state.count -= 1 }
Text("Count: \(state.count)", wrap: false)
Button("+") { state.count += 1 }
}
.padding(10)
}
}
I’ll try take a look!
Ah I think you have to add LVGLBackend to the exampleDependencies variable in the package.swift
Ah I think you have to add LVGLBackend to the exampleDependencies variable in the package.swift
That was the problem! Oops, SPM didn't give a very helpful error message :(
That error message has got to be up there with the ones that have caused me the most grief 😅 I’ve gotten it for so many different reasons, and some took hours to figure out lol. Glad the fix worked!
The LVGL backend is pretty bare bones, but if it interests you for your life project I’d be more than happy to put a bit of work into getting it closer to being a fully fledged backend.
nah just poking around!