Closed CRKatri closed 3 years ago
I've never tried this on Arch Linux, but this seems to be an issue with your Swift compiler (or the Swift Package Manager): it should never crash (segfault), even if it can't find the right pkg-config (pc) files. Which version of Arch are you using? Did you build the compiler yourself or did you download it as a binary?
I get the same error. Manjaro Linux 20.0.3 (kernel 5.6.19-2-MANJARO).
Downloaded with the AUR package swift-bin
(= CentOS build with an elf patch to change names of libraries)
Downgrading to 5.1.5 makes swift working (no segfault) but it still does not compile. 5.3 crashes too.
Swift 5.3 beta versions don't work at the moment (this requires putting in a type system into gir2swift). Can you post your output when trying to compile it with 5.1.5, please?
Updating https://github.com/rhx/SwiftAtk.git
Updating https://github.com/rhx/SwiftGLib.git
Updating https://github.com/rhx/SwiftGModule.git
Updating https://github.com/rhx/SwiftGdkPixbuf.git
Updating https://github.com/rhx/SwiftGIO.git
Updating https://github.com/rhx/SwiftGObject.git
Updating https://github.com/rhx/SwiftPangoCairo.git
Updating https://github.com/rhx/SwiftCairo.git
Updating https://github.com/rhx/SwiftGtk.git
Updating https://github.com/rhx/SwiftGdk.git
Updating https://github.com/rhx/SwiftPango.git
Completed resolution in 9.99s
Cloning https://github.com/rhx/SwiftGLib.git
Resolving https://github.com/rhx/SwiftGLib.git at master
Cloning https://github.com/rhx/SwiftGObject.git
Resolving https://github.com/rhx/SwiftGObject.git at master
Cloning https://github.com/rhx/SwiftGModule.git
Resolving https://github.com/rhx/SwiftGModule.git at master
Cloning https://github.com/rhx/SwiftPangoCairo.git
Resolving https://github.com/rhx/SwiftPangoCairo.git at master
Cloning https://github.com/rhx/SwiftPango.git
Resolving https://github.com/rhx/SwiftPango.git at master
Cloning https://github.com/rhx/SwiftAtk.git
Resolving https://github.com/rhx/SwiftAtk.git at master
Cloning https://github.com/rhx/SwiftGdkPixbuf.git
Resolving https://github.com/rhx/SwiftGdkPixbuf.git at master
Cloning https://github.com/rhx/SwiftCairo.git
Resolving https://github.com/rhx/SwiftCairo.git at master
Cloning https://github.com/rhx/SwiftGdk.git
Resolving https://github.com/rhx/SwiftGdk.git at master
Cloning https://github.com/rhx/SwiftGIO.git
Resolving https://github.com/rhx/SwiftGIO.git at master
Cloning https://github.com/rhx/SwiftGtk.git
Resolving https://github.com/rhx/SwiftGtk.git at master
'CCairo' cairo glib-2.0 gio-unix-2.0.pc: warning: couldn't find pc file
'CGLib' glib-2.0 gio-unix-2.0.pc: warning: couldn't find pc file
'CGdkPixbuf' cairo glib-2.0 gio-unix-2.0.pc: warning: couldn't find pc file
'CGdk' gdk-3.0 pangocairo pangoft2 pango gio-unix-2.0 glib-2..pc: warning: couldn't find pc file
'CAtk' atk glib-2.0 gio-unix-2.0.pc: warning: couldn't find pc file
'CGtk' gtk-3.0 gdk-3.0 pangocairo pangoft2 pango gio-unix-2.0 glib-2.0.pc: warning: couldn't find pc file
: unknown attribute 'swift_infer_import_as_member' [-Wignored-attributes]
^
: unknown attribute 'swift_infer_import_as_member' [-Wignored-attributes]
module CGLib [system] [swift_infer_import_as_member] {
^
warning: incompatible integer to pointer conversion returning 'GType' (aka 'unsigned long') from a function with result type 'GTypeClass *' (aka 'struct _GTypeClass *') [-Wint-conversion]
return G_TYPE_FROM_INSTANCE(gobject);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
note: expanded from macro 'G_TYPE_FROM_INSTANCE'
#define G_TYPE_FROM_INSTANCE(instance) (G_TYPE_FROM_CLASS (((GTypeInstance*) (instance))->g_class))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 warnings generated.
2 warnings generated.
/home/dadoum/Téléchargements/SwiftHelloGtk/.build/checkouts/SwiftGLib/Sources/GLib/GLib.swift:13:18: error: use of undeclared type 'LogLevelFlags'
public extension LogLevelFlags {
^~~~~~~~~~~~~
/home/dadoum/Téléchargements/SwiftHelloGtk/.build/checkouts/SwiftGLib/Sources/GLib/GLib.swift:15:24: error: use of unresolved identifier 'LogLevelFlags'
static let debug = LogLevelFlags.levelDebug
^~~~~~~~~~~~~
/home/dadoum/Téléchargements/SwiftHelloGtk/.build/checkouts/SwiftGLib/Sources/GLib/GLib.swift:17:23: error: use of unresolved identifier 'LogLevelFlags'
static let info = LogLevelFlags.levelInfo
^~~~~~~~~~~~~
/home/dadoum/Téléchargements/SwiftHelloGtk/.build/checkouts/SwiftGLib/Sources/GLib/GLib.swift:19:26: error: use of unresolved identifier 'LogLevelFlags'
static let message = LogLevelFlags.levelMessage
^~~~~~~~~~~~~
/home/dadoum/Téléchargements/SwiftHelloGtk/.build/checkouts/SwiftGLib/Sources/GLib/GLib.swift:21:26: error: use of unresolved identifier 'LogLevelFlags'
static let warning = LogLevelFlags.levelWarning
^~~~~~~~~~~~~
/home/dadoum/Téléchargements/SwiftHelloGtk/.build/checkouts/SwiftGLib/Sources/GLib/GLib.swift:26:27: error: use of unresolved identifier 'LogLevelFlags'
static let critical = LogLevelFlags.levelCritical
^~~~~~~~~~~~~
/home/dadoum/Téléchargements/SwiftHelloGtk/.build/checkouts/SwiftGLib/Sources/GLib/GLib.swift:29:24: error: use of unresolved identifier 'LogLevelFlags'
static let error = LogLevelFlags.levelError
^~~~~~~~~~~~~
/home/dadoum/Téléchargements/SwiftHelloGtk/.build/checkouts/SwiftGLib/Sources/GLib/GLib.swift:78:51: error: use of undeclared type 'LogLevelFlags'
public func g_log(_ message: String, level flags: LogLevelFlags = .debug) {
^~~~~~~~~~~~~
/home/dadoum/Téléchargements/SwiftHelloGtk/.build/checkouts/SwiftGLib/Sources/GLib/GLib.swift:94:61: error: use of undeclared type 'LogLevelFlags'
public func g_log(messagePtr: UnsafePointer<CChar>?, level: LogLevelFlags = .debug) {
^~~~~~~~~~~~~
/home/dadoum/Téléchargements/SwiftHelloGtk/.build/checkouts/SwiftGLib/Sources/GLib/GLib.swift:105:61: error: use of undeclared type 'LogLevelFlags'
public func g_log(domain: String, _ message: String, level: LogLevelFlags = .debug) {
^~~~~~~~~~~~~
/home/dadoum/Téléchargements/SwiftHelloGtk/.build/checkouts/SwiftGLib/Sources/GLib/GLib.swift:96:77: error: use of unresolved identifier 'cast'
g_logv(nil, level.value, msg, CVaListPointer(_fromUnsafeMutablePointer: cast(msg)))
^~~~
/home/dadoum/Téléchargements/SwiftHelloGtk/.build/checkouts/SwiftGLib/Sources/GLib/GLib.swift:125:43: error: reference to member 'warning' cannot be resolved without a contextual type
g_log(domain: d, message, level: .warning)
~^~~~~~~
/home/dadoum/Téléchargements/SwiftHelloGtk/.build/checkouts/SwiftGLib/Sources/GLib/GLib.swift:127:32: error: reference to member 'warning' cannot be resolved without a contextual type
g_log(message, level: .warning)
~^~~~~~~
/home/dadoum/Téléchargements/SwiftHelloGtk/.build/checkouts/SwiftGLib/Sources/GLib/Time.swift:23:47: error: use of unresolved identifier 'SourceFunc'
let callback = unsafeBitCast(handler, to: SourceFunc.self)
^~~~~~~~~~
/home/dadoum/Téléchargements/SwiftHelloGtk/.build/checkouts/SwiftGLib/Sources/GLib/Time.swift:24:14: error: use of unresolved identifier 'timeoutAddFull'
let rv = timeoutAddFull(priority: p, interval: interval, function: callback, data: opaqueHolder) {
^~~~~~~~~~~~~~
/home/dadoum/Téléchargements/SwiftHelloGtk/.build/checkouts/SwiftGLib/Sources/GLib/Mutex.swift:11:18: error: use of undeclared type 'Mutex'
public extension Mutex {
^~~~~
/home/dadoum/Téléchargements/SwiftHelloGtk/.build/checkouts/SwiftGLib/Sources/GLib/Mutex.swift:16:9: error: use of unresolved identifier 'init_'
init_()
^~~~~
/home/dadoum/Téléchargements/SwiftHelloGtk/.build/checkouts/SwiftGLib/Sources/GLib/MainLoop.swift:11:18: error: use of undeclared type 'MainContextRef'
public extension MainContextRef {
^~~~~~~~~~~~~~
/home/dadoum/Téléchargements/SwiftHelloGtk/.build/checkouts/SwiftGLib/Sources/GLib/MainLoop.swift:18:37: error: use of undeclared type 'MainContextRef'
static func defaultContext() -> MainContextRef {
^~~~~~~~~~~~~~
/home/dadoum/Téléchargements/SwiftHelloGtk/.build/checkouts/SwiftGLib/Sources/GLib/MainLoop.swift:25:18: error: use of undeclared type 'MainContext'
public extension MainContext {
^~~~~~~~~~~
/home/dadoum/Téléchargements/SwiftHelloGtk/.build/checkouts/SwiftGLib/Sources/GLib/MainLoop.swift:32:37: error: use of undeclared type 'MainContext'
static func defaultContext() -> MainContext {
^~~~~~~~~~~
/home/dadoum/Téléchargements/SwiftHelloGtk/.build/checkouts/SwiftGLib/Sources/GLib/MainLoop.swift:40:18: error: use of undeclared type 'MainLoopRef'
public extension MainLoopRef {
^~~~~~~~~~~
/home/dadoum/Téléchargements/SwiftHelloGtk/.build/checkouts/SwiftGLib/Sources/GLib/MainLoop.swift:50:18: error: use of undeclared type 'MainLoop'
public extension MainLoop {
^~~~~~~~
/home/dadoum/Téléchargements/SwiftHelloGtk/.build/checkouts/SwiftGLib/Sources/GLib/MainLoop.swift:33:23: error: use of unresolved identifier 'MainContext'
let context = MainContext(g_main_context_ref(g_main_context_default())!)
^~~~~~~~~~~
/home/dadoum/Téléchargements/SwiftHelloGtk/.build/checkouts/SwiftGLib/Sources/GLib/MainLoop.swift:44:9: error: use of unresolved identifier 'ptr'
ptr = UnsafeMutableRawPointer(g_main_loop_new(g_main_context_default()!, 0)!)
^~~
/home/dadoum/Téléchargements/SwiftHelloGtk/.build/checkouts/SwiftGLib/Sources/GLib/String.swift:18:18: error: use of undeclared type 'StringRef'
public extension StringRef {
^~~~~~~~~
/home/dadoum/Téléchargements/SwiftHelloGtk/.build/checkouts/SwiftGLib/Sources/GLib/String.swift:28:21: error: initializer does not override a designated initializer from its superclass
override public init(_ op: UnsafeMutablePointer<GString>) {
~~~~~~~~ ^
/home/dadoum/Téléchargements/SwiftHelloGtk/.build/checkouts/SwiftGLib/Sources/GLib/String.swift:26:27: error: use of undeclared type 'StringType'
public class StringClass: StringType {
^~~~~~~~~~
/home/dadoum/Téléchargements/SwiftHelloGtk/.build/checkouts/SwiftGLib/Sources/GLib/String.swift:47:23: error: use of undeclared type 'StringRef'
var g_string_ref: StringRef { return StringRef(self) }
^~~~~~~~~
/home/dadoum/Téléchargements/SwiftHelloGtk/.build/checkouts/SwiftGLib/Sources/GLib/String.swift:21:25: error: use of unresolved identifier 'ptr'
init(_ s: String) { ptr = UnsafeMutableRawPointer(s.gstring_ptr) }
^~~
/home/dadoum/Téléchargements/SwiftHelloGtk/.build/checkouts/SwiftGLib/Sources/GLib/String.swift:29:9: error: 'super' members cannot be referenced in a root class
super.init(UnsafeMutablePointer(g_string_new(op.pointee.str)))
^
/home/dadoum/Téléchargements/SwiftHelloGtk/.build/checkouts/SwiftGLib/Sources/GLib/String.swift:34:9: error: 'super' members cannot be referenced in a root class
super.init(s.gstring_ptr)
^
/home/dadoum/Téléchargements/SwiftHelloGtk/.build/checkouts/SwiftGLib/Sources/GLib/String.swift:39:23: error: use of unresolved identifier 'gstring_ptr'
g_string_free(gstring_ptr, 1)
^~~~~~~~~~~
/home/dadoum/Téléchargements/SwiftHelloGtk/.build/checkouts/SwiftGLib/Sources/GLib/Error.swift:17:11: error: use of undeclared type 'ErrorTypeProtocol'
extension ErrorTypeProtocol {
^~~~~~~~~~~~~~~~~
/home/dadoum/Téléchargements/SwiftHelloGtk/.build/checkouts/SwiftGLib/Sources/GLib/Error.swift:29:18: error: use of undeclared type 'ErrorType'
public extension ErrorType {
^~~~~~~~~
/home/dadoum/Téléchargements/SwiftHelloGtk/.build/checkouts/SwiftGLib/Sources/GLib/Error.swift:45:11: error: use of undeclared type 'ErrorType'
extension ErrorType: CustomStringConvertible {}
^~~~~~~~~
/home/dadoum/Téléchargements/SwiftHelloGtk/.build/checkouts/SwiftGLib/Sources/GLib/Error.swift:46:11: error: use of undeclared type 'ErrorType'
extension ErrorType: CustomDebugStringConvertible {}
^~~~~~~~~
/home/dadoum/Téléchargements/SwiftHelloGtk/.build/checkouts/SwiftGLib/Sources/GLib/Error.swift:47:11: error: use of undeclared type 'ErrorRef'
extension ErrorRef: CustomStringConvertible {}
^~~~~~~~
/home/dadoum/Téléchargements/SwiftHelloGtk/.build/checkouts/SwiftGLib/Sources/GLib/Error.swift:48:11: error: use of undeclared type 'ErrorRef'
extension ErrorRef: CustomDebugStringConvertible {}
^~~~~~~~
/home/dadoum/Téléchargements/SwiftHelloGtk/.build/checkouts/SwiftGLib/Sources/GLib/Error.swift:20:32: error: use of unresolved identifier 'error_ptr'
return String(cString: error_ptr.pointee.message)
^~~~~~~~~
/home/dadoum/Téléchargements/SwiftHelloGtk/.build/checkouts/SwiftGLib/Sources/GLib/Error.swift:25:26: error: use of unresolved identifier 'quarkToString'
return String("\(quarkToString(quark: error_ptr.pointee.domain) ?? "-") error \(error_ptr.pointee.code): \(String(cString: error_ptr.pointee.message) )")
^~~~~~~~~~~~~
/home/dadoum/Téléchargements/SwiftHelloGtk/.build/checkouts/SwiftGLib/Sources/GLib/Error.swift:25:47: error: use of unresolved identifier 'error_ptr'
return String("\(quarkToString(quark: error_ptr.pointee.domain) ?? "-") error \(error_ptr.pointee.code): \(String(cString: error_ptr.pointee.message) )")
^~~~~~~~~
/home/dadoum/Téléchargements/SwiftHelloGtk/.build/checkouts/SwiftGLib/Sources/GLib/Error.swift:25:89: error: use of unresolved identifier 'error_ptr'
return String("\(quarkToString(quark: error_ptr.pointee.domain) ?? "-") error \(error_ptr.pointee.code): \(String(cString: error_ptr.pointee.message) )")
^~~~~~~~~
/home/dadoum/Téléchargements/SwiftHelloGtk/.build/checkouts/SwiftGLib/Sources/GLib/Error.swift:25:132: error: use of unresolved identifier 'error_ptr'
return String("\(quarkToString(quark: error_ptr.pointee.domain) ?? "-") error \(error_ptr.pointee.code): \(String(cString: error_ptr.pointee.message) )")
^~~~~~~~~
/home/dadoum/Téléchargements/SwiftHelloGtk/.build/checkouts/SwiftGLib/Sources/GLib/Error.swift:40:15: error: use of unresolved identifier 'cast'
get { cast(error_ptr.pointee.code) }
^~~~
/home/dadoum/Téléchargements/SwiftHelloGtk/.build/checkouts/SwiftGLib/Sources/GLib/Error.swift:40:20: error: use of unresolved identifier 'error_ptr'
get { cast(error_ptr.pointee.code) }
^~~~~~~~~
/home/dadoum/Téléchargements/SwiftHelloGtk/.build/checkouts/SwiftGLib/Sources/GLib/Error.swift:41:15: error: use of unresolved identifier 'error_ptr'
set { error_ptr.pointee.code = cast(newValue) }
^~~~~~~~~
/home/dadoum/Téléchargements/SwiftHelloGtk/.build/checkouts/SwiftGLib/Sources/GLib/Error.swift:41:40: error: use of unresolved identifier 'cast'
set { error_ptr.pointee.code = cast(newValue) }
^~~~
The current version is working fine with Swift 5.2.5 on Ubuntu. Can you try
./distclean.sh
./build.sh
and let me know if this works? (Should also work with Swift 5.3 now.)
Got it working with on my fork of swift-package-manager ! I will publish it soon (it was caused by an undefined behaviour in SPM, pkgConfig: with pkg-config files in package is not defined, and is recognized as a single file on arch linux, and when swift tries to get its path, it fails since there is no file with that name)
Update: the bug is fixed on upstream !
Thanks!
When I try to run the Hello World app, it crashes with:
This is on Arch with Swift 5.2.4 (swift-5.2.4-RELEASE)