fossable / goldboot

Immutable infrastructure for the desktop!
GNU Affero General Public License v3.0
579 stars 5 forks source link

Unable to compile on macOS #113

Closed vdmkenny closed 9 months ago

vdmkenny commented 1 year ago

Hi, apologies if the cause is user error, but I wanted to try out this project but was unable to compile it on latest macOS.|

I made sure to install gtk4 via brew.

➜  goldboot git:(master) rustc --version
rustc 1.73.0 (cc66ad468 2023-10-03)
➜  goldboot git:(master) cargo build
warning: some crates are on edition 2021 which defaults to `resolver = "2"`, but virtual workspaces default to `resolver = "1"`
note: to keep the current resolver, specify `workspace.resolver = "1"` in the workspace root's manifest
note: to use the edition 2021 resolver, specify `workspace.resolver = "2"` in the workspace root's manifest
   Compiling gdk-pixbuf-sys v0.18.0
   Compiling cairo-sys-rs v0.18.2
   Compiling pango-sys v0.18.0
   Compiling gobject-sys v0.18.0
   Compiling graphene-sys v0.18.1
   Compiling gdk4-sys v0.7.2
   Compiling libssh2-sys v0.3.0
   Compiling openssl-sys v0.9.95
   Compiling gsk4-sys v0.7.3
   Compiling gtk4-sys v0.7.3
   Compiling rustls-webpki v0.101.7
   Compiling sct v0.7.1
   Compiling gio-sys v0.18.1
   Compiling rustls v0.21.8
   Compiling glib v0.18.3
   Compiling ssh2 v0.9.4
   Compiling goldboot v0.0.1 (/Users/vdmkenny/goldboot/goldboot)
error[E0432]: unresolved import `crate::cache::MediaFormat`
 --> goldboot/src/templates/linux/arch.rs:3:25
  |
3 |     cache::{MediaCache, MediaFormat},
  |                         ^^^^^^^^^^^ no `MediaFormat` in `cache`

error[E0432]: unresolved import `crate::cache::MediaFormat`
 --> goldboot/src/templates/linux/ubuntu.rs:3:25
  |
3 |     cache::{MediaCache, MediaFormat},
  |                         ^^^^^^^^^^^ no `MediaFormat` in `cache`

error[E0432]: unresolved import `crate::templates::TemplateId`
 --> goldboot/src/cmd/init.rs:4:27
  |
4 |     templates::{Template, TemplateId},
  |                           ^^^^^^^^^^
  |                           |
  |                           no `TemplateId` in `templates`
  |                           help: a similar name exists in the module: `Template`

error[E0433]: failed to resolve: could not find `debian` in `linux`
   --> goldboot/src/templates/mod.rs:202:49
    |
202 |             Template::Debian => Box::new(linux::debian::DebianTemplate::default()),
    |                                                 ^^^^^^ could not find `debian` in `linux`

error[E0433]: failed to resolve: could not find `goldboot` in `linux`
   --> goldboot/src/templates/mod.rs:207:51
    |
207 |             Template::Goldboot => Box::new(linux::goldboot::GoldbootTemplate::default()),
    |                                                   ^^^^^^^^ could not find `goldboot` in `linux`

error[E0433]: failed to resolve: use of undeclared crate or module `macos`
   --> goldboot/src/templates/mod.rs:211:41
    |
211 |             Template::MacOs => Box::new(macos::mac_os::MacOsTemplate::default()),
    |                                         ^^^^^ use of undeclared crate or module `macos`

error[E0433]: failed to resolve: could not find `pop_os` in `linux`
   --> goldboot/src/templates/mod.rs:219:48
    |
219 |             Template::PopOs => Box::new(linux::pop_os::PopOsTemplate::default()),
    |                                                ^^^^^^ could not find `pop_os` in `linux`

error[E0433]: failed to resolve: could not find `steam_deck` in `linux`
   --> goldboot/src/templates/mod.rs:224:52
    |
224 |             Template::SteamDeck => Box::new(linux::steam_deck::SteamDeckTemplate::default()),
    |                                                    ^^^^^^^^^^ could not find `steam_deck` in `linux`

error[E0433]: failed to resolve: could not find `steam_os` in `linux`
   --> goldboot/src/templates/mod.rs:225:50
    |
225 |             Template::SteamOs => Box::new(linux::steam_os::SteamOsTemplate::default()),
    |                                                  ^^^^^^^^ could not find `steam_os` in `linux`

error[E0433]: failed to resolve: use of undeclared crate or module `windows`
   --> goldboot/src/templates/mod.rs:230:45
    |
230 |             Template::Windows10 => Box::new(windows::windows_10::Windows10Template::default()),
    |                                             ^^^^^^^ use of undeclared crate or module `windows`

error[E0404]: expected trait, found enum `Template`
  --> goldboot/src/build.rs:51:55
   |
51 |     pub fn get_templates(&self) -> Result<Vec<Box<dyn Template>>, Box<dyn Error>> {
   |                                                       ^^^^^^^^ not a trait

error[E0404]: expected trait, found enum `Template`
  --> goldboot/src/build.rs:52:40
   |
52 |         let mut templates: Vec<Box<dyn Template>> = Vec::new();
   |                                        ^^^^^^^^ not a trait

error[E0412]: cannot find type `TemplateBase` in this scope
  --> goldboot/src/build.rs:56:20
   |
56 |             let t: TemplateBase = serde_json::from_value(template.to_owned())?;
   |                    ^^^^^^^^^^^^ help: an enum with a similar name exists: `Template`
   |
  ::: goldboot/src/templates/mod.rs:20:1
   |
20 | pub enum Template {
   | ----------------- similarly named enum `Template` defined here

error[E0404]: expected trait, found enum `Template`
   --> goldboot/src/build.rs:119:44
    |
119 |     fn new_worker(&self, template: Box<dyn Template>) -> Result<BuildWorker, Box<dyn Error>> {
    |                                            ^^^^^^^^ not a trait

error[E0404]: expected trait, found enum `Template`
   --> goldboot/src/build.rs:261:27
    |
261 |     pub template: Box<dyn Template>,
    |                           ^^^^^^^^ not a trait

error[E0412]: cannot find type `TemplateMetadata` in this scope
   --> goldboot/src/cmd/init.rs:110:40
    |
110 |                     let templates: Vec<TemplateMetadata> = TemplateMetadata::load()
    |                                        ^^^^^^^^^^^^^^^^ not found in this scope
    |
help: you might be missing a type parameter
    |
30  | pub fn run<TemplateMetadata>(cmd: crate::cmd::Commands) -> Result<(), Box<dyn Error>> {
    |           ++++++++++++++++++

error[E0425]: cannot find function `to_vec` in crate `toml`
   --> goldboot/src/image.rs:502:38
    |
502 |             let config_bytes = toml::to_vec(&config)?;
    |                                      ^^^^^^ not found in `toml`
    |
help: consider importing this function
    |
1   + use serde_json::to_vec;
    |
help: if you import `to_vec`, refer to it directly
    |
502 -             let config_bytes = toml::to_vec(&config)?;
502 +             let config_bytes = to_vec(&config)?;
    |

error[E0412]: cannot find type `IsoSource` in this scope
  --> goldboot/src/templates/linux/arch.rs:28:9
   |
28 |     Iso(IsoSource),
   |         ^^^^^^^^^ not found in this scope
   |
help: consider importing this struct
   |
1  + use crate::sources::IsoSource;
   |

error[E0425]: cannot find value `MIRRORLIST` in this scope
   --> goldboot/src/templates/linux/arch.rs:154:25
    |
154 |                 .items(&MIRRORLIST)
    |                         ^^^^^^^^^^ not found in this scope

error[E0425]: cannot find value `MIRRORLIST` in this scope
   --> goldboot/src/templates/linux/arch.rs:157:33
    |
157 |             self.mirrors = vec![MIRRORLIST[mirror_index].to_string()];
    |                                 ^^^^^^^^^^ not found in this scope

error[E0412]: cannot find type `IsoSource` in this scope
   --> goldboot/src/templates/linux/arch.rs:175:70
    |
175 | fn fetch_latest_iso(mirrorlist: ArchMirrorlistProvisioner) -> Result<IsoSource, Box<dyn Error>> {
    |                                                                      ^^^^^^^^^ not found in this scope
    |
help: consider importing this struct
    |
1   + use crate::sources::IsoSource;
    |

error[E0422]: cannot find struct, variant or union type `IsoSource` in this scope
   --> goldboot/src/templates/linux/arch.rs:183:35
    |
183 |                         return Ok(IsoSource {
    |                                   ^^^^^^^^^ not found in this scope
    |
help: consider importing this struct
    |
1   + use crate::sources::IsoSource;
    |

error[E0412]: cannot find type `IsoSource` in this scope
  --> goldboot/src/templates/linux/ubuntu.rs:58:9
   |
58 |     Iso(IsoSource),
   |         ^^^^^^^^^ not found in this scope
   |
help: consider importing this struct
   |
1  + use crate::sources::IsoSource;
   |

error[E0412]: cannot find type `HostnameProvisoner` in this scope
   --> goldboot/src/templates/linux/ubuntu.rs:63:14
    |
63  |     Hostname(HostnameProvisoner),
    |              ^^^^^^^^^^^^^^^^^^ help: a struct with a similar name exists: `HostnameProvisioner`
    |
   ::: goldboot/src/provisioners.rs:173:1
    |
173 | pub struct HostnameProvisioner {
    | ------------------------------ similarly named struct `HostnameProvisioner` defined here

error[E0404]: expected trait, found enum `Template`
  --> goldboot/src/templates/linux/ubuntu.rs:76:6
   |
76 | impl Template for UbuntuTemplate {
   |      ^^^^^^^^ not a trait

error[E0412]: cannot find type `GeneralContainer` in this scope
   --> goldboot/src/templates/linux/ubuntu.rs:109:26
    |
109 |     fn general(&self) -> GeneralContainer {
    |                          ^^^^^^^^^^^^^^^^ not found in this scope

error[E0532]: expected unit struct, unit variant or constant, found tuple variant `Template::Alpine`
   --> goldboot/src/templates/mod.rs:155:13
    |
21  |     Alpine(templates::linux::alpine::AlpineTemplate),
    |     ------------------------------------------------ `Template::Alpine` defined here
...
155 |             Template::Alpine => false,
    |             ^^^^^^^^^^^^^^^^ help: use the tuple variant pattern syntax instead: `Template::Alpine(_)`

error[E0532]: expected unit struct, unit variant or constant, found tuple variant `Template::Arch`
   --> goldboot/src/templates/mod.rs:156:13
    |
22  |     Arch(templates::linux::arch::ArchTemplate),
    |     ------------------------------------------ `Template::Arch` defined here
...
156 |             Template::Arch => false,
    |             ^^^^^^^^^^^^^^ help: use the tuple variant pattern syntax instead: `Template::Arch(_)`

error[E0404]: expected trait, found enum `Template`
   --> goldboot/src/templates/mod.rs:195:34
    |
195 |     pub fn new(&self) -> Box<dyn Template> {
    |                                  ^^^^^^^^ not a trait

error[E0532]: expected unit struct, unit variant or constant, found tuple variant `Template::Alpine`
   --> goldboot/src/templates/mod.rs:197:13
    |
21  |     Alpine(templates::linux::alpine::AlpineTemplate),
    |     ------------------------------------------------ `Template::Alpine` defined here
...
197 |             Template::Alpine => Box::new(linux::alpine::AlpineTemplate::default()),
    |             ^^^^^^^^^^^^^^^^ help: use the tuple variant pattern syntax instead: `Template::Alpine(_)`

error[E0532]: expected unit struct, unit variant or constant, found tuple variant `Template::Arch`
   --> goldboot/src/templates/mod.rs:198:13
    |
22  |     Arch(templates::linux::arch::ArchTemplate),
    |     ------------------------------------------ `Template::Arch` defined here
...
198 |             Template::Arch => Box::new(linux::arch::ArchTemplate::default()),
    |             ^^^^^^^^^^^^^^ help: use the tuple variant pattern syntax instead: `Template::Arch(_)`

warning: unused import: `info`
 --> goldboot/src/lib.rs:2:18
  |
2 | use log::{debug, info};
  |                  ^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

warning: unused import: `process::Command`
 --> goldboot/src/lib.rs:6:61
  |
6 | use std::{default::Default, error::Error, net::TcpListener, process::Command};
  |                                                             ^^^^^^^^^^^^^^^^

warning: unused import: `validator::Validate`
 --> goldboot/src/lib.rs:8:5
  |
8 | use validator::Validate;
  |     ^^^^^^^^^^^^^^^^^^^

warning: unused imports: `Read`, `Write`
 --> goldboot/src/cache.rs:9:10
  |
9 |     io::{Read, Write},
  |          ^^^^  ^^^^^

warning: unused import: `console::Style`
 --> goldboot/src/cmd/build.rs:5:5
  |
5 | use console::Style;
  |     ^^^^^^^^^^^^^^

warning: unused imports: `Confirm`, `Input`, `Select`, `theme::ColorfulTheme`
 --> goldboot/src/cmd/build.rs:6:17
  |
6 | use dialoguer::{theme::ColorfulTheme, Confirm, Input, Select};
  |                 ^^^^^^^^^^^^^^^^^^^^  ^^^^^^^  ^^^^^  ^^^^^^

warning: unused import: `console::Style`
 --> goldboot/src/cmd/image.rs:6:5
  |
6 | use console::Style;
  |     ^^^^^^^^^^^^^^

warning: unused imports: `Confirm`, `Input`, `Select`, `theme::ColorfulTheme`
 --> goldboot/src/cmd/image.rs:7:17
  |
7 | use dialoguer::{theme::ColorfulTheme, Confirm, Input, Select};
  |                 ^^^^^^^^^^^^^^^^^^^^  ^^^^^^^  ^^^^^  ^^^^^^

warning: unused import: `Template`
 --> goldboot/src/cmd/init.rs:4:17
  |
4 |     templates::{Template, TemplateId},
  |                 ^^^^^^^^

warning: unused imports: `Confirm`, `Select`
 --> goldboot/src/cmd/registry.rs:5:39
  |
5 | use dialoguer::{theme::ColorfulTheme, Confirm, Input, Select};
  |                                       ^^^^^^^         ^^^^^^

warning: unused imports: `Input`, `Select`
 --> goldboot/src/cmd/write.rs:3:48
  |
3 | use dialoguer::{theme::ColorfulTheme, Confirm, Input, Select};
  |                                                ^^^^^  ^^^^^^

warning: unused imports: `Deserialize`, `Serialize`
 --> goldboot/src/image.rs:7:13
  |
7 | use serde::{Deserialize, Serialize};
  |             ^^^^^^^^^^^  ^^^^^^^^^

warning: unused import: `validator::Validate`
  --> goldboot/src/image.rs:17:5
   |
17 | use validator::Validate;
   |     ^^^^^^^^^^^^^^^^^^^

warning: unused import: `debug`
 --> goldboot/src/provisioners.rs:9:11
  |
9 | use log::{debug, info};
  |           ^^^^^

warning: unused imports: `Display`, `EnumIter`
  --> goldboot/src/provisioners.rs:13:13
   |
13 | use strum::{Display, EnumIter};
   |             ^^^^^^^  ^^^^^^^^

warning: unused import: `path::Path`
 --> goldboot/src/templates/mod.rs:3:39
  |
3 | use std::{error::Error, fmt::Display, path::Path};
  |                                       ^^^^^^^^^^

warning: unused import: `cache::*`
 --> goldboot/src/templates/linux/alpine.rs:2:25
  |
2 |     build::BuildWorker, cache::*, provisioners::*, qemu::QemuArgs, sources::*, templates::*,
  |                         ^^^^^^^^

warning: use of deprecated unit variant `templates::linux::alpine::AlpineRelease::V3_14`
   --> goldboot/src/templates/linux/alpine.rs:159:5
    |
159 |     V3_14,
    |     ^^^^^
    |
    = note: `#[warn(deprecated)]` on by default

error[E0433]: failed to resolve: use of undeclared type `TemplateMetadata`
   --> goldboot/src/cmd/init.rs:110:60
    |
110 |                     let templates: Vec<TemplateMetadata> = TemplateMetadata::load()
    |                                                            ^^^^^^^^^^^^^^^^ use of undeclared type `TemplateMetadata`

Some errors have detailed explanations: E0404, E0412, E0422, E0425, E0432, E0433, E0532.
For more information about an error, try `rustc --explain E0404`.
warning: `goldboot` (lib) generated 18 warnings
error: could not compile `goldboot` (lib) due to 32 previous errors; 18 warnings emitted
warning: build failed, waiting for other jobs to finish...
cilki commented 1 year ago

Not user error; I'm in the middle of getting this crate working again. Sometimes you have to break it worse before it gets better :).

cilki commented 9 months ago

Although the tests still aren't fully working, at least the build is fixed now.