maplibre / maplibre-rs

Experimental Maps for Web, Mobile and Desktop
Apache License 2.0
1.34k stars 77 forks source link

Compile error running maplibre-demo #242

Closed dr-kristau closed 2 months ago

dr-kristau commented 1 year ago

Running cargo run -p maplibre-demo on my Fedora system throws a compile error

šŸ¤” Expected Behavior

I expect to be able to compile the maplibre-demo running cargo run -p maplibre-demo

šŸ˜Æ Current Behavior

I obtain the following when running cargo run -p maplibre-demo

[xxxx@xxxx maplibre-rs]$ cargo run -p maplibre-demo
   Compiling value-bag v1.0.0-alpha.9
   Compiling thiserror v1.0.38
   Compiling serde v1.0.152
   Compiling futures-util v0.3.25
   Compiling tracing v0.1.37
   Compiling wayland-sys v0.29.5
   Compiling flate2 v1.0.25
   Compiling mime_guess v2.0.4
error: failed to run custom build command for `wayland-sys v0.29.5`

Caused by:
  process didn't exit successfully: `/home/xxxx/maplibre-rs/target/debug/build/wayland-sys-5ca4e819db47c1d1/build-script-build` (exit status: 101)
  --- stdout
  cargo:rerun-if-env-changed=WAYLAND_CLIENT_NO_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG
  cargo:rerun-if-env-changed=WAYLAND_CLIENT_STATIC
  cargo:rerun-if-env-changed=WAYLAND_CLIENT_DYNAMIC
  cargo:rerun-if-env-changed=PKG_CONFIG_ALL_STATIC
  cargo:rerun-if-env-changed=PKG_CONFIG_ALL_DYNAMIC
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR

  --- stderr
  thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: `"pkg-config" "--libs" "--cflags" "wayland-client"` did not exit successfully: exit status: 1
  error: could not find system library 'wayland-client' required by the 'wayland-sys' crate

  --- stderr
  Package wayland-client was not found in the pkg-config search path.
  Perhaps you should add the directory containing `wayland-client.pc'
  to the PKG_CONFIG_PATH environment variable
  Package 'wayland-client', required by 'virtual:world', not found
  ', /home/xxxx/.cargo/registry/src/github.com-1ecc6299db9ec823/wayland-sys-0.29.5/build.rs:10:47
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...

šŸŒ Your Environment

maxammann commented 1 year ago

On ubuntu you will need to install libwayland-dev and libxkbcommon-dev.

There is no documentation about it yet I think.

dr-kristau commented 1 year ago

thanks @maxammann

On Fedora I had to install wayland-devel and protobuf-compiler to get the demo to build. Unfortunately, when I ran $ maplibre-demo headed it threw an error:

[2023-01-19T15:19:15Z INFO  wgpu_hal::gles::egl] Enabling EGL debug output
libEGL warning: egl: failed to create dri2 screen
[2023-01-19T15:19:15Z ERROR wgpu_hal::gles::egl] EGL 'eglInitialize' code 0x3001: DRI2: failed to create screen

This error is quite usual on my machine due to its age, and probably has nothing to do with maplibre.

nyurik commented 1 year ago

yes, i just ran into the same issue, and had to check the CI script. We need to document native deps early on, maybe in a table for different distros.

nyurik commented 1 year ago

P.S. i wonder if we can get rid of protobuf compiler - there is a rust-only implementation afaik

maxammann commented 1 year ago

The actual code generation code is already rust. There is still the dependency to the protoc dependency which we will not get rid of.

maxammann commented 1 year ago

We maybe should setup a nix-shell environment.

That way all dependencies are declared and all use the same version that could work well for Rust on Linux and macOS.

maxammann commented 2 months ago

Closing as this should work by now with the provided nix shell. Nix is a soft-dependency though. Everything should work without it.