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

[DISCUSSION] compiling on linux #106

Open
ulph0 opened this issue Dec 31, 2024 · 13 comments
Open

[DISCUSSION] compiling on linux #106

ulph0 opened this issue Dec 31, 2024 · 13 comments

Comments

@ulph0
Copy link

ulph0 commented Dec 31, 2024

hi! at first, many thanks for this great project! i am just trying to compile arni (the xmas release) on linux (ubuntu with gnome). thats hard work, so it would be very nice if you could compile a linux binary into your assets.

i have no clue about the rust build process. i tried to run/build and solve every error. here is what i did:

  • installing rust from as described on its web page. the apt version from ubuntu is to old.
  • installing sources of a bunch of libraries:
    sudo apt install libwayland-dev gir1.2-glib-2.0-dev libcairo-dev libpango1.0-dev libatk1.0-dev gir1.2-gdk-3.0-dev libjavascriptcoregtk-4.1-dev libwebkit2gtk-4.1-dev (please write a comment if i forgot one)
  • in Cargo.toml i had to change the line
    rfd = "0.15.0"
    to
    rfd = { version = "0.15.1", default-features = false, features = ["gtk3"] }

that worked. maybe you also could add a linux-binary to your assets? i just created my first world. i wasn't able to select an existing world, which is kind of sad, because of course i would like to fight against some neighbour monsters and also i am at the moment not able to find my home because orientation in the big world i created is complicated, but i will continue to try ...

@benjamin051000
Copy link
Contributor

They've already got build CI and release builds set as GH workflows, so it shouldn't be that difficult to simply add one for Linux. I'd do it myself if I knew how... since Linux requires extra steps (apt install and a sed -i '...' Cargo.toml) I'm not sure how to incorporate it into the existing yaml file.

@benjamin051000
Copy link
Contributor

benjamin051000 commented Jan 1, 2025

I made this edit:

diff --git a/Cargo.toml b/Cargo.toml
index eaca0ef..e12ea9d 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -30,7 +30,7 @@ nalgebra = "0.33.0"
 once_cell = "1.19.0"
 rand = "0.8.5"
 reqwest = { version = "0.12.7", features = ["blocking", "json"] }
-rfd = "0.15.0"
+rfd = { version = "0.15.1", default-features = false, features = ["tokio"] }
 semver = "1.0.23"
 serde = { version = "1.0", features = ["derive"] }
 serde_json = "1.0"

That seems to compile as well. Is this a better choice than gtk3 as a feature? I'm unsure. Here's the relevant doc: https://docs.rs/rfd/latest/rfd/#linux--bsd-backends

I looks like you can choose either gtk3 or xdg-desktop-portal, which I think is more universal for Linux. I am new to rust, rfd, and this project, but this may be worth checking if a Linux build is in the works.

However, this doesn't actually open the file picker for me :( (Ubuntu 24.10) it just hangs.

Also, how does this affect the windows build? Does this need to be gated for Linux builds only?

@notnotnescap
Copy link

notnotnescap commented Jan 1, 2025

I'm on Wayland and it also seems to fail displaying the UI

Launching UI...
Gdk-Message: 14:12:02.850: Error 71 (Protocol error) dispatching to Wayland display.

Edit: I also can't manage to get it working on Xorg lol

Launching UI...
Failed to create GBM buffer of size 1000x650: Invalid argument

@Qosmos11
Copy link

Qosmos11 commented Jan 1, 2025

I have same problem

@louis-e
Copy link
Owner

louis-e commented Jan 1, 2025

Hi there!
Sorry for the late response, this project exploded in popularity right before I planned my vacation. :D

Thank you for the report! I had some problems with the Linux compilation step in the Github Actions CI which were related to Tauri, so I think this is most likely the main problem here. Since I'm coding & testing on Windows, this wasn't one of my top fixing priorities yet - but I guess now it's time to take care of that!
I think having a compiled Linux build included directly in the Github Release would be the the best (https://github.com/louis-e/arnis/tree/main/.github/workflows). I will look into this as soon as possible, maybe someone finds a good fix and can provide it in a PR in the meantime.

Have an amazing start into the new year!

@langhorst
Copy link

First of all, this looks like an awesome project // thank you! I briefly tried to compile within an Ubuntu VM running on a newer MacBook Pro (M1 Pro) without immediate luck and didn't have time to debug it. I'm hoping you or someone else gets around to it before I do. But if it happens to me, I'll submit a PR.

@benjamin051000
Copy link
Contributor

benjamin051000 commented Jan 3, 2025

@louis-e my diff supplied above gets it compiling and running on Ubuntu 24.04 LTS. I don't know how to include that into a GH workflow... If I'm bored tomorrow I'll look into it and see if it's relatively easy to set up.

The tough part is that the dependencies may change depending on the platform you're building for... I don't know if the diff supplied above will build on Windows. So we may need to figure out how to make cargo choose dependencies based on arch. I'm sure it's possible, but I'm a rust noob so I don't know how at this point. :D Glad to see you want this done though! I look forward to using this tool, it looks awesome

@benjamin051000
Copy link
Contributor

benjamin051000 commented Jan 3, 2025

Okay, looks like I also have most or all of those packages installed that @ulph0 mentioned. It may be wise to build a static exe so the deps get included, otherwise I assume linux users will need to install those.

Flatpak is another option but I know nothing about how that works, lol

@will-code-for-pizza
Copy link

Probably this helps:

#160 (comment)

@benjamin051000
Copy link
Contributor

RFD patch merged in #127, this issue should be resolved. Unless anyone else is having issues compiling/running. The file picker isn't working for me right now but I'm having a look at it...

@Isaac-Duarte
Copy link

I was able to compile no issues/modifications!!

@owenwastaken
Copy link

If you are failing to compile on Ubuntu, make sure libei-dev is installed. pkg-kit was unable to find gtk-3.0 until libei was installed.

@fish4terrisa-MSDSM
Copy link

Confirmed working on Arch Linux, with latest nightly rust. The tauri gui failed to load existed world(it just freezed the whole app), but the cli part worked just fine.
Btw, I'm using mate-desktop.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants