mattkae / miracle-wm

Miracle is a Wayland tiling window manager built on Mir
https://mattkae.github.io/miracle-wm-wiki/latest/
GNU General Public License v3.0
293 stars 9 forks source link

**Missing** /usr/lib/x86_64-linux-gnu/mir/server-platform #72

Open spongythecake opened 3 months ago

spongythecake commented 3 months ago

Steps

  1. Build from source
  2. Run /usr/local/bin/miracle-wm
  3. Stderror encountered

The error message provided indicates that a file or directory named /usr/lib/x86_64-linux-gnu/mir/server-platform does not exist on your system.

I can confirm a ls yields a non-existent directory. However, I am unsure what dependencies these relate to.

Full error log

Here is the output log full error:

[2024-03-27 01:01:12.903020] <information> mircommon: Loading modules from: /usr/lib/x86_64-linux-gnu/mir/server-platform
[2024-03-27 01:01:12.903047] < - ERROR - > mircommon: Failed to load libraries from path: /usr/lib/x86_64-linux-gnu/mir/server-platform (error was:/usr/lib/x86_64-linux-gnu/mir/server-platform: No such file or directory)
ERROR: ./src/server/graphics/default_configuration.cpp(253): Throw in function virtual const std::vector<std::shared_ptr<mir::graphics::DisplayPlatform> >& mir::DefaultServerConfiguration::the_display_platforms()
Dynamic exception type: boost::wrapexcept<std::runtime_error>
std::exception::what: Exception while creating graphics platform
ERROR: Dynamic exception type: std::system_error
std::exception::what: /usr/lib/x86_64-linux-gnu/mir/server-platform: No such file or directory

Specs

=== System Specs

spongythecake commented 3 months ago

It fixed itself with this cmd:

sudo apt install mir-graphics-drivers-desktop
mattkae commented 3 months ago

Sorry for the late response. Nice catch though :smile: I will add this as a dependency to the project

spongythecake commented 3 months ago

I'm happy its a straightforward bug.

Since this issue was labelled "good first issue", I would like to kindly nominate myself to patch this. It would be my first patch here! Any thoughts?

In fixing, my approach is to use dpkg provided by cmake's tooling to detect if package is available. If missing, cmake will raise a typical error, then developer with missing dependencies can take heed.

I think this, in a nutshell, is the way to move forward.

mattkae commented 3 months ago

I'm happy its a straightforward bug.

Since this issue was labelled "good first issue", I would like to kindly nominate myself to patch this. It would be my first patch here! Any thoughts?

In fixing, my approach is to use dpkg provided by cmake's tooling to detect if package is available. If missing, cmake will raise a typical error, then developer with missing dependencies can take heed.

I think this, in a nutshell, is the way to move forward.

Yeah that would very be much appreciated :smile: You should be able to follow what we do in https://github.com/mattkae/miracle-wm/blob/master/CMakeLists.txt with the help of pkg_check_modules. Let me know if you run into any trouble there though.

spongythecake commented 3 months ago

The package mir-graphics-drivers-desktop is a metapackage, as per source.

The status of pkgconf is unaffected by the mentioned package being installed or removed. So, in this case I have determined the library presence by searching these specified paths. For example:

find_library(MIR_SERVER_GRAPHICS_PLATFORM
    NAMES graphics-gbm-kms renderer-egl-generic server-virtual server-x11
    REQUIRED
)

message(STATUS "Found graphics library: ${MIR_SERVER_GRAPHICS_PLATFORM}")

Therefore, I am posting here because I think this is the correct solution but require assistance.

On a side-note, there are also some platform checks in the mir library, it might be okay to reuse them, however this is beyond my level of expertise with regards to Mir.

Actually the above config complains when you omit the version number e.g. graphics-gbm-kms.so.21. Considering version numbers will change, it isn't a flexible solution.

In other words, pkg_check_modules didn't work for me and I resorted to using find_library, despite it feeling like a rigid approach.

mattkae commented 2 months ago

The package mir-graphics-drivers-desktop is a metapackage, as per source.

The status of pkgconf is unaffected by the mentioned package being installed or removed. So, in this case I have determined the library presence by searching these specified paths. For example:

find_library(MIR_SERVER_GRAPHICS_PLATFORM
    NAMES graphics-gbm-kms renderer-egl-generic server-virtual server-x11
    REQUIRED
)

message(STATUS "Found graphics library: ${MIR_SERVER_GRAPHICS_PLATFORM}")

Therefore, I am posting here because I think this is the correct solution but require assistance.

On a side-note, there are also some platform checks in the mir library, it might be okay to reuse them, however this is beyond my level of expertise with regards to Mir.

Actually the above config complains when you omit the version number e.g. graphics-gbm-kms.so.21. Considering version numbers will change, it isn't a flexible solution.

In other words, pkg_check_modules didn't work for me and I resorted to using find_library, despite it feeling like a rigid approach.

I also think this is the correct solution. I believe that we define no *.pc file in this scenario, so it makes sense why pkg_check_modules isn't picking that up. I probably failed to realize this since I usually have those libraries installed.

mattkae commented 2 months ago

Also, sorry for getting back to this so late :smile: Would you like to open a PR for this? I believe the find_library solution is the best in this case

spongythecake commented 2 months ago

So regarding the wildcard in find_library. It is not supported. See screengrab.

From my POV, albeit very rigid, a "best known list" is a reasonable solution.

Screenshot from 2024-04-20 07-49-43

Curious to explore more options if you've got any suggestions.

AlanGriffiths commented 2 months ago

I don't think there's a simple fix in miracle-wm, or in Mir.

  1. The error message isn't very helpful - that could be fixed fairly easily by providing more information.
  2. The correct action to resolve the problem isn't clear.

The error message should include something like: "Failed to load Mir any "graphics platform" libraries, please install the appropriate platforms for your system: For example, mir-graphics-drivers-desktop or mir-graphics-drivers-desktop."

Detecting the right platform packages automatically isn't easy. On Ubuntu and Debian Mir provides:

and these meta packages, for desktop-like systems, that group the above:

But, from the Mir perspective, there are also "third-party" platforms that support other graphics stacks which is why none are installed by default. (Probably not a problem for miracle-wm, which could arguably make "all of the above" a default.)

Also note, that the installation location varies between systems and installation method (e.g. make install installs under /usr/loca/lib) and that the .so names can vary between Mir versions.

Conan-Kudo commented 2 months ago

I kind of decided in Fedora to sidestep this whole mess and ship the server platform libraries in the mir-server-libs package... 😅

But if Mir were to be packaged in openSUSE or Mageia, for example, then it would get some very odd names for the packages based on their sonames.