wizardsardine / liana

The missing safety net for your coins
https://wizardsardine.com/liana
BSD 3-Clause "New" or "Revised" License
295 stars 49 forks source link

Try to link against an older glibc for releases #414

Open darosior opened 1 year ago

darosior commented 1 year ago

The release build for Linux is a reproducible and bootstrappable one using Guix (see https://github.com/wizardsardine/liana/pull/140 and the documentation at contrib/reproducible/).

The glibc this build links against is Guix's gcc-toolchain which ships Glibc 2.33. Unfortunately, it's quite recent (February 2021) and some operating systems still only provide older glibc. See https://sourceware.org/glibc/wiki/Release for a table of glibc version per distribution version. I'd like to at least get Ubuntu Focal (Glibc 2.31) and Debian 10 (Glibc 2.28).

Unfortunately building against an older Glibc within the Guix container is non-trivial (to me). Another approach could be to link against musl (see https://github.com/wizardsardine/liana/issues/255).

The quickest solution for anyone running into an issue of the type:

./liana-gui: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found (required by ./liana-gui)

Is to compile the project from source. There are instruction at doc/BUILD.md on how to do this reasonably. But you can also just use the simple (not really decent) way of installing the Rust toolchain from their website and build Liana like so (example for v1):

git clone https://github.com/wizardsardine/liana
cd liana/
git checkout v1.0
cd gui/
cargo run
darosior commented 1 year ago

Removing from the 1.0 project. I've had another look at it and it is really non-trivial (to me) to build against an older glibc within the Guix container.

DesobedienteTecnologico commented 1 year ago

As commented in this Merged PR https://github.com/wizardsardine/liana/pull/140#issuecomment-1537335542 , I will try to get hands on it by next week. It doesn't see that trivial to fix. I you fix it I will try to keep track on this PR.

Thanks!

darosior commented 1 year ago

I've added details about this issue to the OP. Since it's been hit (as expected..) by a couple users already i've added troubleshooting instructions (basically you have to build from source).

I will try to get hands on it by next week

Good to hear. A PR for this would be very welcome. But note i do not want to compromise on reproducible and bootstrappable builds, so it has to happen within the Guix toolchain.

Sosthene00 commented 1 year ago

Hi, actually building from source doesn't always work either, I have Ubuntu 20.04 with glib 2.31 and I can build from source, but somehow the gui crash at startup with the following error:

$cargo run --release
/.../
     Running `target/release/liana-gui`
  2023-06-08T14:46:38.541243Z  INFO winit::platform_impl::platform::x11::window:147: Guessed window scale factor: 1.75

2023-06-08T14:46:38.541277Z  INFO winit::platform_impl::platform::x11::window: Guessed window scale factor: 1.75    
[xcb] Unknown sequence number while processing queue
[xcb] Most likely this is a multi-threaded client and XInitThreads has not been called
[xcb] Aborting, sorry about that.
liana-gui: ../../src/xcb_io.c:260: poll_for_event: Assertion `!xcb_xlib_threads_sequence_lost' failed.
Aborted (core dumped)

I could reproduce the issue on another machine that runs the same system.

It seems that the problem appears when I first build lianad and liana-cli, then build the gui. If I already built the daemon I need to cargo clean it first before building the gui.

Best I could track so far is that it was an issue with winit that was supposedly fixed by https://github.com/rust-windowing/winit/pull/554, but was reported again later by other projects. Not sure what to do about it. [[EDIT1]] minor edits for clarity

DesobedienteTecnologico commented 1 year ago

Hi @darosior,

I have tried to for a while to change the GCC version. I success to install the correct version but it still install the new one and I think is because of Rust packages dependences. I will explain:

As you probably know, the different GCC versions uses different glibc versions too. For example:

  1. TestVM image

  2. My PC image

In this line it tries to get the version 10.3.0 and as we can see here we have many other possibilities to get different versions.

image

To reach your goal we need at least the version 9.5.0. So I added gcc-toolchain@9.5.0 to the line commented before... At compilation time, I can see that it downloads the right version, and even shows the correct glibc version needed, BUT at some point after getting working with Rust it download the new version. For that reason makes me think that some Rust dependence needs new version of glibc. (I need to check if there is a way to explicitly add glibc version to use in Rust)

Here I saw that you tried to get directly the Glibc version directly and I'm not sure it worked. Same with rust glib: image

At the time writing this I noticed that there are another versions... image

Searcher: https://packages.guix.gnu.org/search/

I'm trying this time to time. Hope all I have written here, helps to push this a bit forward.

Regards :)

pythcoiner commented 9 months ago

Hi, actually building from source doesn't always work either, I have Ubuntu 20.04 with glib 2.31 and I can build from source, but somehow the gui crash at startup with the following error:

$cargo run --release
/.../
     Running `target/release/liana-gui`
  2023-06-08T14:46:38.541243Z  INFO winit::platform_impl::platform::x11::window:147: Guessed window scale factor: 1.75

2023-06-08T14:46:38.541277Z  INFO winit::platform_impl::platform::x11::window: Guessed window scale factor: 1.75    
[xcb] Unknown sequence number while processing queue
[xcb] Most likely this is a multi-threaded client and XInitThreads has not been called
[xcb] Aborting, sorry about that.
liana-gui: ../../src/xcb_io.c:260: poll_for_event: Assertion `!xcb_xlib_threads_sequence_lost' failed.
Aborted (core dumped)

I could reproduce the issue on another machine that runs the same system.

It seems that the problem appears when I first build lianad and liana-cli, then build the gui. If I already built the daemon I need to cargo clean it first before building the gui.

Best I could track so far is that it was an issue with winit that was supposedly fixed by rust-windowing/winit#554, but was reported again later by other projects. Not sure what to do about it. [[EDIT1]] minor edits for clarity

look like #523

darosior commented 9 months ago

Discussed this with someone much more knowledgeable about Guix and it is indeed non-trivial, for what it's worth.

pythcoiner commented 8 months ago

any way to link against a static glibc?

DesobedienteTecnologico commented 8 months ago

When I helped Rana to have binaries I tried also on that time to build Liana. CLI worked fine, but not GUI. For some reason it needed libc for a rust package as far I remember... I had on mind, that I wrote this before when I tried it and seems I completely forgot.

Please, take a look what I did just in case you want to try (Is not using Guix as needed here) but is an approach to create the binaries. https://github.com/grunch/rana/pull/44#issuecomment-1659670984 https://github.com/grunch/rana/pull/44#issuecomment-1662681163

Hope this help some how to push this a bit forward. Regards