Skip to content

Cannot build on Docker (Debian) #3

Description

@dvkch

Hi there!

First of all, thanks a lot for this amazing lib, I've been using it for a macOS CLI tool and it's worked wonders.

I've been trying to use that CLI tool on linux and I haven't been able to build properly. It seems even the Examples target in this project doesn't build either.

The default Swift linux docker image already includes ncurses, confirmed by running apt list --installed | grep ncurses :

libncurses-dev/noble,now 6.4+20240113-1ubuntu2 arm64 [installed]
libncurses6/noble,now 6.4+20240113-1ubuntu2 arm64 [installed,automatic]
libncursesw6/noble,now 6.4+20240113-1ubuntu2 arm64 [installed]
ncurses-base/noble,now 6.4+20240113-1ubuntu2 all [installed]
ncurses-bin/noble,now 6.4+20240113-1ubuntu2 arm64 [installed]

Here is my test on macOS (ARM64) :

docker run -it --platform linux/arm64/v8 swift:latest /bin/bash
git clone https://github.com/Jomy10/SwiftCurses.git
cd SwiftCurses
swift run Examples
And the build output :
root@17b970fdb815:/yo/SwiftCurses# swift run Examples
Building for debugging...
/yo/SwiftCurses/Sources/SwiftCurses/LinuxCompatibility.swift:4:55: error: cannot find type 'WINDOW' in scope
 2 | 
 3 | #if canImport(FoundationNetworking)
 4 | public typealias WindowPointer = UnsafeMutablePointer<WINDOW>
   |                                                       `- error: cannot find type 'WINDOW' in scope
 5 | #else
 6 | public typealias WindowPointer = OpaquePointer
/yo/SwiftCurses/Sources/SwiftCurses/LinuxCompatibility.swift:4:55: error: cannot find type 'WINDOW' in scope
 2 | 
 3 | #if canImport(FoundationNetworking)
 4 | public typealias WindowPointer = UnsafeMutablePointer<WINDOW>
   |                                                       `- error: cannot find type 'WINDOW' in scope
 5 | #else
 6 | public typealias WindowPointer = OpaquePointer
/yo/SwiftCurses/Sources/SwiftCurses/LinuxCompatibility.swift:4:55: error: cannot find type 'WINDOW' in scope
 2 | 
 3 | #if canImport(FoundationNetworking)
 4 | public typealias WindowPointer = UnsafeMutablePointer<WINDOW>
   |                                                       `- error: cannot find type 'WINDOW' in scope
 5 | #else
 6 | public typealias WindowPointer = OpaquePointer

/yo/SwiftCurses/Sources/SwiftCurses/Window.swift:36:18: error: incorrect argument labels in call (have '_:rows:cols:', expected 'rows:cols:begin:settings:')
 34 |     public convenience init(rows: Int32, cols: Int32, begin: (Int32, Int32), settings: [WindowSetting] = WindowSetting.defaultSettings) throws {
 35 |         let winPtr: WindowPointer = try newWindow(rows: rows, cols: cols, begin: begin, settings: settings)
 36 |         self.init(winPtr, rows: rows, cols: cols)
    |                  `- error: incorrect argument labels in call (have '_:rows:cols:', expected 'rows:cols:begin:settings:')
 37 |     }
 38 | 
/yo/SwiftCurses/Sources/SwiftCurses/LinuxCompatibility.swift:4:55: error: cannot find type 'WINDOW' in scope
 2 | 
 3 | #if canImport(FoundationNetworking)
 4 | public typealias WindowPointer = UnsafeMutablePointer<WINDOW>
   |                                                       `- error: cannot find type 'WINDOW' in scope
 5 | #else
 6 | public typealias WindowPointer = OpaquePointer
/yo/SwiftCurses/Sources/SwiftCurses/LinuxCompatibility.swift:4:55: error: cannot find type 'WINDOW' in scope
 2 | 
 3 | #if canImport(FoundationNetworking)
 4 | public typealias WindowPointer = UnsafeMutablePointer<WINDOW>
   |                                                       `- error: cannot find type 'WINDOW' in scope
 5 | #else
 6 | public typealias WindowPointer = OpaquePointer
/yo/SwiftCurses/Sources/SwiftCurses/LinuxCompatibility.swift:4:55: error: cannot find type 'WINDOW' in scope
 2 | 
 3 | #if canImport(FoundationNetworking)
 4 | public typealias WindowPointer = UnsafeMutablePointer<WINDOW>
   |                                                       `- error: cannot find type 'WINDOW' in scope
 5 | #else
 6 | public typealias WindowPointer = OpaquePointer
/yo/SwiftCurses/Sources/SwiftCurses/LinuxCompatibility.swift:4:55: error: cannot find type 'WINDOW' in scope
 2 | 
 3 | #if canImport(FoundationNetworking)
 4 | public typealias WindowPointer = UnsafeMutablePointer<WINDOW>
   |                                                       `- error: cannot find type 'WINDOW' in scope
 5 | #else
 6 | public typealias WindowPointer = OpaquePointer
/yo/SwiftCurses/Sources/SwiftCurses/LinuxCompatibility.swift:4:55: error: cannot find type 'WINDOW' in scope
 2 | 
 3 | #if canImport(FoundationNetworking)
 4 | public typealias WindowPointer = UnsafeMutablePointer<WINDOW>
   |                                                       `- error: cannot find type 'WINDOW' in scope
 5 | #else
 6 | public typealias WindowPointer = OpaquePointer
error: emit-module command failed with exit code 1 (use -v to see invocation)
/yo/SwiftCurses/Sources/SwiftCurses/LinuxCompatibility.swift:4:55: error: cannot find type 'WINDOW' in scope
 2 | 
 3 | #if canImport(FoundationNetworking)
 4 | public typealias WindowPointer = UnsafeMutablePointer<WINDOW>
   |                                                       `- error: cannot find type 'WINDOW' in scope
 5 | #else
 6 | public typealias WindowPointer = OpaquePointer
/yo/SwiftCurses/Sources/SwiftCurses/LinuxCompatibility.swift:4:55: error: cannot find type 'WINDOW' in scope
 2 | 
 3 | #if canImport(FoundationNetworking)
 4 | public typealias WindowPointer = UnsafeMutablePointer<WINDOW>
   |                                                       `- error: cannot find type 'WINDOW' in scope
 5 | #else
 6 | public typealias WindowPointer = OpaquePointer
/yo/SwiftCurses/Sources/SwiftCurses/LinuxCompatibility.swift:4:55: error: cannot find type 'WINDOW' in scope
 2 | 
 3 | #if canImport(FoundationNetworking)
 4 | public typealias WindowPointer = UnsafeMutablePointer<WINDOW>
   |                                                       `- error: cannot find type 'WINDOW' in scope
 5 | #else
 6 | public typealias WindowPointer = OpaquePointer
/yo/SwiftCurses/Sources/SwiftCurses/LinuxCompatibility.swift:4:55: error: cannot find type 'WINDOW' in scope
 2 | 
 3 | #if canImport(FoundationNetworking)
 4 | public typealias WindowPointer = UnsafeMutablePointer<WINDOW>
   |                                                       `- error: cannot find type 'WINDOW' in scope
 5 | #else
 6 | public typealias WindowPointer = OpaquePointer

/yo/SwiftCurses/Sources/SwiftCurses/Window+dump.swift:15:10: error: constructing an object of class type 'WinType' with a metatype value must use a 'required' initializer
13 | 			throw CursesError(.couldNotOpenFile)
14 | 		}
15 | 		return WinType(ncurses.getwin(filePtr))
   |          `- error: constructing an object of class type 'WinType' with a metatype value must use a 'required' initializer
16 | 	}
17 | 

/yo/SwiftCurses/Sources/SwiftCurses/Window.swift:34:24: note: selected non-required initializer 'init(rows:cols:begin:settings:)'
 32 |     }
 33 | 
 34 |     public convenience init(rows: Int32, cols: Int32, begin: (Int32, Int32), settings: [WindowSetting] = WindowSetting.defaultSettings) throws {
    |                        `- note: selected non-required initializer 'init(rows:cols:begin:settings:)'
 35 |         let winPtr: WindowPointer = try newWindow(rows: rows, cols: cols, begin: begin, settings: settings)
 36 |         self.init(winPtr, rows: rows, cols: cols)

/yo/SwiftCurses/Sources/SwiftCurses/Window+dump.swift:15:18: error: missing argument label 'rows:' in call
13 | 			throw CursesError(.couldNotOpenFile)
14 | 		}
15 | 		return WinType(ncurses.getwin(filePtr))
   |                  `- error: missing argument label 'rows:' in call
16 | 	}
17 | 

/yo/SwiftCurses/Sources/SwiftCurses/Window+dump.swift:15:18: error: missing arguments for parameters 'cols', 'begin' in call
13 | 			throw CursesError(.couldNotOpenFile)
14 | 		}
15 | 		return WinType(ncurses.getwin(filePtr))
   |                  `- error: missing arguments for parameters 'cols', 'begin' in call
16 | 	}
17 | 

/yo/SwiftCurses/Sources/SwiftCurses/Window.swift:34:24: note: 'init(rows:cols:begin:settings:)' declared here
 32 |     }
 33 | 
 34 |     public convenience init(rows: Int32, cols: Int32, begin: (Int32, Int32), settings: [WindowSetting] = WindowSetting.defaultSettings) throws {
    |                        `- note: 'init(rows:cols:begin:settings:)' declared here
 35 |         let winPtr: WindowPointer = try newWindow(rows: rows, cols: cols, begin: begin, settings: settings)
 36 |         self.init(winPtr, rows: rows, cols: cols)

/yo/SwiftCurses/Sources/SwiftCurses/Window+dump.swift:15:26: error: cannot convert value of type 'OpaquePointer?' to expected argument type 'Int32'
13 | 			throw CursesError(.couldNotOpenFile)
14 | 		}
15 | 		return WinType(ncurses.getwin(filePtr))
   |                          `- error: cannot convert value of type 'OpaquePointer?' to expected argument type 'Int32'
16 | 	}
17 | 
/yo/SwiftCurses/Sources/SwiftCurses/LinuxCompatibility.swift:4:55: error: cannot find type 'WINDOW' in scope
 2 | 
 3 | #if canImport(FoundationNetworking)
 4 | public typealias WindowPointer = UnsafeMutablePointer<WINDOW>
   |                                                       `- error: cannot find type 'WINDOW' in scope
 5 | #else
 6 | public typealias WindowPointer = OpaquePointer

/yo/SwiftCurses/Sources/SwiftCurses/Window+dump.swift:15:10: error: constructing an object of class type 'WinType' with a metatype value must use a 'required' initializer
13 | 			throw CursesError(.couldNotOpenFile)
14 | 		}
15 | 		return WinType(ncurses.getwin(filePtr))
   |          `- error: constructing an object of class type 'WinType' with a metatype value must use a 'required' initializer
16 | 	}
17 | 

/yo/SwiftCurses/Sources/SwiftCurses/Window.swift:34:24: note: selected non-required initializer 'init(rows:cols:begin:settings:)'
 32 |     }
 33 | 
 34 |     public convenience init(rows: Int32, cols: Int32, begin: (Int32, Int32), settings: [WindowSetting] = WindowSetting.defaultSettings) throws {
    |                        `- note: selected non-required initializer 'init(rows:cols:begin:settings:)'
 35 |         let winPtr: WindowPointer = try newWindow(rows: rows, cols: cols, begin: begin, settings: settings)
 36 |         self.init(winPtr, rows: rows, cols: cols)

/yo/SwiftCurses/Sources/SwiftCurses/Window+dump.swift:15:18: error: missing argument label 'rows:' in call
13 | 			throw CursesError(.couldNotOpenFile)
14 | 		}
15 | 		return WinType(ncurses.getwin(filePtr))
   |                  `- error: missing argument label 'rows:' in call
16 | 	}
17 | 

/yo/SwiftCurses/Sources/SwiftCurses/Window+dump.swift:15:18: error: missing arguments for parameters 'cols', 'begin' in call
13 | 			throw CursesError(.couldNotOpenFile)
14 | 		}
15 | 		return WinType(ncurses.getwin(filePtr))
   |                  `- error: missing arguments for parameters 'cols', 'begin' in call
16 | 	}
17 | 

/yo/SwiftCurses/Sources/SwiftCurses/Window.swift:34:24: note: 'init(rows:cols:begin:settings:)' declared here
 32 |     }
 33 | 
 34 |     public convenience init(rows: Int32, cols: Int32, begin: (Int32, Int32), settings: [WindowSetting] = WindowSetting.defaultSettings) throws {
    |                        `- note: 'init(rows:cols:begin:settings:)' declared here
 35 |         let winPtr: WindowPointer = try newWindow(rows: rows, cols: cols, begin: begin, settings: settings)
 36 |         self.init(winPtr, rows: rows, cols: cols)

/yo/SwiftCurses/Sources/SwiftCurses/Window+dump.swift:15:26: error: cannot convert value of type 'OpaquePointer?' to expected argument type 'Int32'
13 | 			throw CursesError(.couldNotOpenFile)
14 | 		}
15 | 		return WinType(ncurses.getwin(filePtr))
   |                          `- error: cannot convert value of type 'OpaquePointer?' to expected argument type 'Int32'
16 | 	}
17 | 
/yo/SwiftCurses/Sources/SwiftCurses/LinuxCompatibility.swift:4:55: error: cannot find type 'WINDOW' in scope
 2 | 
 3 | #if canImport(FoundationNetworking)
 4 | public typealias WindowPointer = UnsafeMutablePointer<WINDOW>
   |                                                       `- error: cannot find type 'WINDOW' in scope
 5 | #else
 6 | public typealias WindowPointer = OpaquePointer

/yo/SwiftCurses/Sources/SwiftCurses/Window+dump.swift:15:10: error: constructing an object of class type 'WinType' with a metatype value must use a 'required' initializer
13 | 			throw CursesError(.couldNotOpenFile)
14 | 		}
15 | 		return WinType(ncurses.getwin(filePtr))
   |          `- error: constructing an object of class type 'WinType' with a metatype value must use a 'required' initializer
16 | 	}
17 | 

/yo/SwiftCurses/Sources/SwiftCurses/Window.swift:34:24: note: selected non-required initializer 'init(rows:cols:begin:settings:)'
 32 |     }
 33 | 
 34 |     public convenience init(rows: Int32, cols: Int32, begin: (Int32, Int32), settings: [WindowSetting] = WindowSetting.defaultSettings) throws {
    |                        `- note: selected non-required initializer 'init(rows:cols:begin:settings:)'
 35 |         let winPtr: WindowPointer = try newWindow(rows: rows, cols: cols, begin: begin, settings: settings)
 36 |         self.init(winPtr, rows: rows, cols: cols)

/yo/SwiftCurses/Sources/SwiftCurses/Window+dump.swift:15:18: error: missing argument label 'rows:' in call
13 | 			throw CursesError(.couldNotOpenFile)
14 | 		}
15 | 		return WinType(ncurses.getwin(filePtr))
   |                  `- error: missing argument label 'rows:' in call
16 | 	}
17 | 

/yo/SwiftCurses/Sources/SwiftCurses/Window+dump.swift:15:18: error: missing arguments for parameters 'cols', 'begin' in call
13 | 			throw CursesError(.couldNotOpenFile)
14 | 		}
15 | 		return WinType(ncurses.getwin(filePtr))
   |                  `- error: missing arguments for parameters 'cols', 'begin' in call
16 | 	}
17 | 

/yo/SwiftCurses/Sources/SwiftCurses/Window.swift:34:24: note: 'init(rows:cols:begin:settings:)' declared here
 32 |     }
 33 | 
 34 |     public convenience init(rows: Int32, cols: Int32, begin: (Int32, Int32), settings: [WindowSetting] = WindowSetting.defaultSettings) throws {
    |                        `- note: 'init(rows:cols:begin:settings:)' declared here
 35 |         let winPtr: WindowPointer = try newWindow(rows: rows, cols: cols, begin: begin, settings: settings)
 36 |         self.init(winPtr, rows: rows, cols: cols)

/yo/SwiftCurses/Sources/SwiftCurses/Window+dump.swift:15:26: error: cannot convert value of type 'OpaquePointer?' to expected argument type 'Int32'
13 | 			throw CursesError(.couldNotOpenFile)
14 | 		}
15 | 		return WinType(ncurses.getwin(filePtr))
   |                          `- error: cannot convert value of type 'OpaquePointer?' to expected argument type 'Int32'
16 | 	}
17 | 
[15/19] Emitting module SwiftCurses
root@17b970fdb815:/yo/SwiftCurses# 

Would you happen to have any pointers as to what I'm doing wrong ?

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions