Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot build on Docker (Debian) #3

Open
dvkch opened this issue Nov 10, 2024 · 18 comments
Open

Cannot build on Docker (Debian) #3

dvkch opened this issue Nov 10, 2024 · 18 comments
Assignees
Labels
bug Something isn't working

Comments

@dvkch
Copy link

dvkch commented Nov 10, 2024

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 ?

@Jomy10
Copy link
Owner

Jomy10 commented Nov 20, 2024

Hey, thanks for bringing this up! I’ll look into it as soon as possible.

@Jomy10
Copy link
Owner

Jomy10 commented Nov 20, 2024

Can you post the output of swift --version and the version of the SwiftCurses library you are usig here as well?

@Jomy10
Copy link
Owner

Jomy10 commented Nov 20, 2024

I managaed to recreate the error when using Docker. Running it on a fresh Debian instance worked though

@Jomy10
Copy link
Owner

Jomy10 commented Nov 20, 2024

It looks like on Docker, WINDOW cannot be imported to Swift. I don't know exactly why this is, so I will leave this issue open for now.

In the meantime, if you pull the latest branch, you should be able to run the examples like so:

swift run -Xswiftc -DSWIFTCURSES_OPAQUE Examples helloWorld

To see all the possible example, see the switch at:

switch program {

@Jomy10
Copy link
Owner

Jomy10 commented Nov 20, 2024

Possible explanation is that NCURSES_OPAQUE is defined by default on the Swift docker image. I should test this.

@Jomy10 Jomy10 self-assigned this Nov 20, 2024
@Jomy10 Jomy10 added the bug Something isn't working label Nov 20, 2024
@Jomy10 Jomy10 changed the title Cannot build on Debian Cannot build on Docker (Debian) Nov 20, 2024
@dvkch
Copy link
Author

dvkch commented Nov 26, 2024

Thank you so much for investigating this.

While building the examples was the easy reproduction of this issue, my actual problem is that I can't build a Linux version of an app that depends on SwiftCurses using Docker.

To try it out you can create a simple package that depends on SwiftCurses then run

BUILD_CMD="swift build -c release -Xswiftc -O -Xswiftc -DSWIFTCURSES_OPAQUE"
docker run -it -v $(pwd):/sources swift:latest /bin/bash -c "cd sources && $BUILD_CMD"

Unfortunately the addition of SWIFTCURSES_OPAQUE doesn't help, I would imagine because it is used for my main target and not the dependencies ?

@Jomy10
Copy link
Owner

Jomy10 commented Nov 27, 2024

Haven't been able to reproduce this on a linux machine with Docker. Will try this evening on macOS.
Which OS version are you using on the host machine?

@dvkch
Copy link
Author

dvkch commented Nov 27, 2024

Running on macOS 15.1.1, latest version of OrbStack for Docker though i don't think it matters for that part

@Jomy10
Copy link
Owner

Jomy10 commented Nov 28, 2024

The latest commit should fix this. It works for me at least (I'm still on macOS 13.4 though, I'm due for a hardware upgrade 😅)

Let me know if it works for you.

@dvkch
Copy link
Author

dvkch commented Nov 28, 2024

No dice just yet, unfortunately. For the package config, i have made my package public https://github.com/dvkch/Polycam/blob/main/Package.swift

If you have the energy you can try adding back SwiftCurses to the dependencies for good, or just commenting the conditionals, and running the ./release.sh script. possibly commenting lines before "Building for Linux $ARCH".

If you'd prefer I can investigate a bit more on my side as well or make an easier repro repository :)

/sources/.build/checkouts/SwiftCurses/Sources/SwiftCurses/LinuxCompatibility.swift:7:55: error: cannot find type 'WINDOW' in scope
 5 | public typealias WindowPointer = OpaquePointer
 6 | #else
 7 | public typealias WindowPointer = UnsafeMutablePointer<WINDOW>
   |                                                       `- error: cannot find type 'WINDOW' in scope
 8 | #endif
 9 | 

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

/sources/.build/checkouts/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)

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

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

/sources/.build/checkouts/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)

/sources/.build/checkouts/SwiftCurses/Sources/SwiftCurses/Window+dump.swift:16:26: error: cannot convert value of type 'OpaquePointer?' to expected argument type 'Int32'
14 | 			throw CursesError(.couldNotOpenFile)
15 | 		}
16 | 		return WinType(ncurses.getwin(filePtr))
   |                          `- error: cannot convert value of type 'OpaquePointer?' to expected argument type 'Int32'
17 | 	}
18 | 

/sources/.build/checkouts/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 | 
[28/35] Compiling SwiftCurses LinuxCompatibility.swift

@dvkch
Copy link
Author

dvkch commented Nov 28, 2024

As for repro, i tried again the lines from my first posted issue, and those still don't compile on the latest commit. Edited the message to fix a mistake in the docker run command

@dvkch
Copy link
Author

dvkch commented Nov 28, 2024

I checked my swift version on linux, it is 6.0.2 on swift:latest, then tried building the examples again on the swift:5.10 docker image.

First of all, it required installing ncurses, which I did apt update && apt install libncurses5-dev

Then it did build properly and ran helloWorld ! I'll switch my build process to Swift 5.10 for now, good enough for my project, but if i can be of any help testing potential fixes, please send them my way

EDIT (and sorry for the multiple notifications) : I actually can't use it on my project since I used typed throws. After searching a bit more, the swift:6.0-jammy image works, swift:6.0-focal worked as well (bit longer to build the LinuxCompatibility.swift file, but worked) but the swift:6.0-noble (currently aliased for latest) didn't work.

@Jomy10
Copy link
Owner

Jomy10 commented Nov 28, 2024

Thanks for the info, I’ll look into it and see if I can figure it out.

I’m guessing you’ve got arm-based hardware. It might be difference in architecture since I’m currently still on Intel hardware.

@dvkch
Copy link
Author

dvkch commented Nov 28, 2024

I am indeed on an M1 Pro chip, but I think I had the same issue on both (my release.sh script builds both variants), unsure if I checked intel build since arm was the first one to build and fail everytime

@Jomy10
Copy link
Owner

Jomy10 commented Dec 16, 2024

what happens if you change this line:
https://github.com/dvkch/Polycam/blob/b19f3dc0a41ee55f70d3e7ce6912753a4a7df0ed/Package.swift#L15C1-L15C86

to

.package(url: "https://github.com/Jomy10/SwiftCurses.git", from: "1.3.0"),

@dvkch
Copy link
Author

dvkch commented Jan 6, 2025

Sorry for the late reply, I finally got to try it today, but there is no tag or branch 1.3.0 for SwiftCurses so the build couldn't download the dependency. Is this a typo on your side ?

@Jomy10
Copy link
Owner

Jomy10 commented Jan 7, 2025

I believe I did make a typo. It should be 1.0.3. I have released 1.1.0 in the meantime as well, which should also work.

@dvkch
Copy link
Author

dvkch commented Jan 7, 2025

Using version 1.1.0 :

Computing version for https://github.com/Jomy10/SwiftCurses.git
error: Dependencies could not be resolved because root depends on 'swiftcurses' 1.1.0..<2.0.0.
'swiftcurses' >= 1.1.0 cannot be used because package 'swiftcurses' is required using a stable-version but 'swiftcurses' depends on an unstable-version package 'signalhandler' and no versions of 'swiftcurses' match the requirement 1.1.1..<2.0.0.

Using version 1.0.3 :

Building for production...
/sources/.build/checkouts/SwiftCurses/Sources/SwiftCurses/LinuxCompatibility.swift:7:55: error: cannot find type 'WINDOW' in scope
 5 | public typealias WindowPointer = OpaquePointer
 6 | #else
 7 | public typealias WindowPointer = UnsafeMutablePointer<WINDOW>
   |                                                       `- error: cannot find type 'WINDOW' in scope
 8 | #endif
 9 | 

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

/sources/.build/checkouts/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)

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

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

/sources/.build/checkouts/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)

/sources/.build/checkouts/SwiftCurses/Sources/SwiftCurses/Window+dump.swift:16:26: error: cannot convert value of type 'OpaquePointer?' to expected argument type 'Int32'
14 | 			throw CursesError(.couldNotOpenFile)
15 | 		}
16 | 		return WinType(ncurses.getwin(filePtr))
   |                          `- error: cannot convert value of type 'OpaquePointer?' to expected argument type 'Int32'
17 | 	}
18 | 

/sources/.build/checkouts/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 | 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants