pop-os / cosmic-epoch

Next generation Cosmic desktop environment
1.71k stars 54 forks source link

could not compile `libspa` #280

Closed freeze-dolphin closed 1 month ago

freeze-dolphin commented 2 months ago

I'm on the master branch to compile cosmic on my Linuxmint 21.3 (Cinnamon) laptop.

cosmic-epoch on  master [?]
❯ git rev-parse HEAD
2eadc4eca2bc2f8ecf6ecbe0ebe61de08544686c

What's going wrong:

There are many errors about libspa while compiling xdg-desktop-portal-cosmic

a part of the log ``` error[E0560]: struct `spa_video_info_raw` has no field named `flags` --> /home/freeze-dolphin/.cargo/git/checkouts/pipewire-rs-e803a8db90410a99/449bf53/libspa/src/param/video/raw.rs:231:13 | 231 | flags: 0, | ^^^^^ `spa_video_info_raw` does not have this field | = note: all struct fields are already assigned error[E0609]: no field `flags` on type `spa_video_info_raw` --> /home/freeze-dolphin/.cargo/git/checkouts/pipewire-rs-e803a8db90410a99/449bf53/libspa/src/param/video/raw.rs:261:16 | 261 | self.0.flags = flags.bits(); | ^^^^^ unknown field | = note: available fields are: `format`, `modifier`, `size`, `framerate`, `max_framerate` ... and 10 others error[E0609]: no field `flags` on type `spa_video_info_raw` --> /home/freeze-dolphin/.cargo/git/checkouts/pipewire-rs-e803a8db90410a99/449bf53/libspa/src/param/video/raw.rs:265:45 | 265 | VideoFlags::from_bits_retain(self.0.flags) | ^^^^^ unknown field | = note: available fields are: `format`, `modifier`, `size`, `framerate`, `max_framerate` ... and 10 others error[E0308]: mismatched types --> /home/freeze-dolphin/.cargo/git/checkouts/pipewire-rs-e803a8db90410a99/449bf53/libspa/src/param/video/raw.rs:269:27 | 269 | self.0.modifier = modifier; | --------------- ^^^^^^^^ expected `i64`, found `u64` | | | expected due to the type of this binding error[E0308]: mismatched types --> /home/freeze-dolphin/.cargo/git/checkouts/pipewire-rs-e803a8db90410a99/449bf53/libspa/src/param/video/raw.rs:273:9 | 272 | pub fn modifier(self) -> u64 { | --- expected `u64` because of return type 273 | self.0.modifier | ^^^^^^^^^^^^^^^ expected `u64`, found `i64` | help: you can convert an `i64` to a `u64` and panic if the converted value doesn't fit | 273 | self.0.modifier.try_into().unwrap() | ++++++++++++++++++++ Some errors have detailed explanations: E0308, E0560, E0609. For more information about an error, try `rustc --explain E0308`. error: could not compile `libspa` (lib) due to 5 previous errors warning: build failed, waiting for other jobs to finish... make: *** [Makefile:34: xdg-desktop-portal-cosmic] Error 101 make: Leaving directory '/home/freeze-dolphin/Documents/workspace/compile/cosmic-epoch/xdg-desktop-portal-cosmic' error: Recipe `build` failed on line 26 with exit code 2 ```

Details

Here is the full log, and the error starts at Line 379

robobenklein commented 1 month ago

This might not be a cosmic issue? I encountered the same build/lib error in an unrelated project at https://github.com/robobenklein/pwacc/actions/runs/9163680605/job/25193331087

Running `/home/runner/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/rustc --crate-name libspa --edition=2021 /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libspa-0.8.0/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 -C metadata=f424bd8ede5e2762 -C extra-filename=-f424bd8ede5e2762 --out-dir /home/runner/work/pwacc/pwacc/target/debug/deps -L dependency=/home/runner/work/pwacc/pwacc/target/debug/deps --extern bitflags=/home/runner/work/pwacc/pwacc/target/debug/deps/libbitflags-db11f0c311d2bf8f.rmeta --extern convert_case=/home/runner/work/pwacc/pwacc/target/debug/deps/libconvert_case-71724b54f98e4060.rmeta --extern cookie_factory=/home/runner/work/pwacc/pwacc/target/debug/deps/libcookie_factory-1e583476e85b6fa4.rmeta --extern libc=/home/runner/work/pwacc/pwacc/target/debug/deps/liblibc-8764d7b59b955394.rmeta --extern spa_sys=/home/runner/work/pw
error[E0560]: struct `spa_video_info_raw` has no field named `flags`
   --> /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libspa-0.8.0/src/param/video/raw.rs:231:13
    |
231 |             flags: 0,
    |             ^^^^^ `spa_video_info_raw` does not have this field
    |
    = note: all struct fields are already assigned
error[E0609]: no field `flags` on type `spa_video_info_raw`
   --> /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libspa-0.8.0/src/param/video/raw.rs:261:16
    |
261 |         self.0.flags = flags.bits();
    |                ^^^^^ unknown field
    |
    = note: available fields are: `format`, `modifier`, `size`, `framerate`, `max_framerate` ... and 10 others
error[E0609]: no field `flags` on type `spa_video_info_raw`
   --> /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libspa-0.8.0/src/param/video/raw.rs:265:45
    |
265 |         VideoFlags::from_bits_retain(self.0.flags)
    |                                             ^^^^^ unknown field
    |
    = note: available fields are: `format`, `modifier`, `size`, `framerate`, `max_framerate` ... and 10 others
error[E0308]: mismatched types
   --> /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libspa-0.8.0/src/param/video/raw.rs:269:27
    |
269 |         self.0.modifier = modifier;
    |         ---------------   ^^^^^^^^ expected `i64`, found `u64`
    |         |
    |         expected due to the type of this binding
error[E0308]: mismatched types
   --> /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libspa-0.8.0/src/param/video/raw.rs:273:9
    |
272 |     pub fn modifier(self) -> u64 {
    |                              --- expected `u64` because of return type
273 |         self.0.modifier
    |         ^^^^^^^^^^^^^^^ expected `u64`, found `i64`
    |
help: you can convert an `i64` to a `u64` and panic if the converted value doesn't fit
    |
273 |         self.0.modifier.try_into().unwrap()
    |                        ++++++++++++++++++++
Some errors have detailed explanations: E0308, E0560, E0609.
For more information about an error, try `rustc --explain E0308`.
error: could not compile `libspa` (lib) due to 5 previous errors
Caused by:

Yet it builds successfully on Pop!_OS 22.04, so perhaps we have a library mismatch on our systems compared to what the crate is expecting.

First guess is an old or mismatched version of libspa, because:

Ubuntu 22.04: libspa-0.2-dev Version: 0.3.48-1ubuntu3 Pop!_OS 22.04: libspa-0.2-dev Version: 1.0.2~1707732619~22.04~b8b871b

So I tried my own project on ubuntu 24.04 which has libspa-0.2-dev Version: 1.0.5-1 and it built successfully.

Perhaps you have an option to grab a newer libspa on your system?

mmstick commented 1 month ago

You should have the stable release of pipewire (1.0.0) on the system. 0.3.48 was essentially a beta release. There are other dependencies that Ubuntu 22.04 is lacking to build with, so you need to be using Ubuntu 24.04 at minimum.