GeopJr / Collision

Check hashes for your files - A GUI tool to generate, compare and verify MD5, SHA-1, SHA-256, SHA-512, Blake3, CRC32 & Adler32 hashes.
https://collision.geopjr.dev
BSD 2-Clause "Simplified" License
143 stars 15 forks source link

`Error target gi-crystal failed to compile` #118

Closed auroraanna closed 11 months ago

auroraanna commented 1 year ago

Describe the bug gi-crystal failed to compile because of missing dependencies that I have no idea how to install:

Error target gi-crystal failed to compile:
/nix/store/frriydwnf7v3dpayy5a6ki00qsp95iiy-binutils-2.38/bin/ld: cannot find -lgirepository-1.0 (this usually means you need to install the development package for libgirepository-1.0): No such file or directory
/nix/store/frriydwnf7v3dpayy5a6ki00qsp95iiy-binutils-2.38/bin/ld: cannot find -lglib-2.0 (this usually means you need to install the development package for libglib-2.0): No such file or directory
/nix/store/frriydwnf7v3dpayy5a6ki00qsp95iiy-binutils-2.38/bin/ld: cannot find -lgobject-2.0 (this usually means you need to install the development package for libgobject-2.0): No such file or directory
clang-10: error: linker command failed with exit code 1 (use -v to see invocation)
Error: execution of command failed with code: 1: `cc "${@}" -o /home/annaaurora/projects/Collision/lib/gi-crystal/bin/gi-crystal  -rdynamic -L/nix/store/firv3vzakvzg0qf1frxyxdjxpgsxslll-boehm-gc-8.0.6/lib -L/nix/store/cf720cm79g30in8klyd19mzbfh81xvlq-libatomic_ops-7.6.12/lib -L/nix/store/mmbj9as03r27jwa7qg0qvkdvp9xabngm-pcre-8.45/lib -L/nix/store/alvnhmybxvc251sz90zaid0l1xz907fk-libevent-2.1.12/lib -L/nix/store/585y3cdw8sv9xrl1krb2i4md21bnw1fi-libyaml-0.2.5/lib -L/nix/store/nbd9kijlxi8ppm70g1m85j7z31kbpqjx-zlib-1.2.12/lib -L/nix/store/c6wcf1ikq9l776yhcmfjrrbivc8n8paa-libxml2-2.9.14/lib -L/nix/store/mmrv9z6b5mf0b93izhizc4j0wnnb17hn-openssl-1.1.1q/lib -lxml2 -lgirepository-1.0 -lglib-2.0 -lgobject-2.0 -lyaml -lpcre -lm -lgc -lpthread -levent -lrt -ldl`

To Reproduce Steps to reproduce the behavior:

  1. shards install

Expected behavior Alls shards build and install.

Environment:

Additional context I have a suspiscion that this is a NixOS problem. I wanted to shards install to get the libadwaita bindings for packaging Collision for nixpkgs.

GeopJr commented 1 year ago

Thanks for raising this issue!

I'm not familiar with nix however from the error, it seems that girepository, glib and gobject are not available. Since those depend on the environment (gi-crystal is the binding generator), I suppose this guide on packaging GNOME apps might come in handy. Also taking a look at other libadwaita nix packages might be helpful!

See: nixpkgs/pika-backup & Onto wrapGAppsHook

Oh openssl is also needed for calculating the hashes (it should be buildInputs = [ openssl ]; (?))

Some other notes on packaging:

Let me know if there's anything I can do from my side! I can also add a nix target on the Makefile if it makes maintaining it easier!

auroraanna commented 1 year ago

Oh openssl is also needed for calculating the hashes (it should be buildInputs = [ openssl ]; (?))

Yes

auroraanna commented 1 year ago

See: nixpkgs/pika-backup & Onto wrapGAppsHook

yeah I forgot wrapGAppsHook

auroraanna commented 1 year ago

I took a look at some of the .nix files for other programs with wrapGAppsHook and libadwaita but it doesn't help.

auroraanna commented 1 year ago

I still have no idea how to install lgirepository, libglib and libgobject. I can't find the three of them in any package manager.

auroraanna commented 1 year ago

I also don't know how to use the bindings for libadwaita when I have them (gi-crystal is needed for generating them?)

auroraanna commented 1 year ago

I solved shards install failing by installing gobject-introspection which provides the libraries. it was even mentioned on https://github.com/GeopJr/libadwaita.cr, sorry…

auroraanna commented 1 year ago

But there still are some error messages:

shards install
Resolving dependencies
Fetching https://github.com/geopjr/libadwaita.cr.git
Fetching https://github.com/geopjr/gettext.cr.git
Fetching https://github.com/geopjr/non-blocking-spawn.git
Fetching https://github.com/hugopl/gtk4.cr.git
Fetching https://github.com/hugopl/gi-crystal.git
Fetching https://github.com/hugopl/version_from_shard.git
Using version_from_shard (1.2.5)
Installing gi-crystal (0.14.0)
Postinstall of gi-crystal: shards build
Installing gtk4 (0.12.0)
Installing libadwaita (1.0.0 at 72f2e42)
Installing non-blocking-spawn (1.0.5)
Installing gettext (1.0.0)
Shard "gi-crystal" may be incompatible with Crystal 1.2.2
Shard "gtk4" may be incompatible with Crystal 1.2.2
Shard "non-blocking-spawn" may be incompatible with Crystal 1.2.2
Shard "gettext" may be incompatible with Crystal 1.2.2

and

./bin/gi-crystal 
info - Starting at 2022-10-10 20:57:59 +02:00, project dir: /home/annaaurora/projects/Collision
info - Generating bindings at /home/annaaurora/projects/Collision/lib/gi-crystal/src/auto
info - Using binding config at /home/annaaurora/projects/Collision/lib/gi-crystal/src/bindings/g_lib/binding.yml
info - Using binding config at /home/annaaurora/projects/Collision/lib/gi-crystal/src/bindings/g_object/binding.yml
info - Using binding config at /home/annaaurora/projects/Collision/lib/gtk4/src/bindings/gdk/binding.yml
info - Using binding config at /home/annaaurora/projects/Collision/lib/gtk4/src/bindings/gio/binding.yml
info - Using binding config at /home/annaaurora/projects/Collision/lib/gtk4/src/bindings/gsk/binding.yml
info - Using binding config at /home/annaaurora/projects/Collision/lib/gtk4/src/bindings/gtk/binding.yml
info - Using binding config at /home/annaaurora/projects/Collision/lib/gtk4/src/bindings/harfbuzz/binding.yml
info - Using binding config at /home/annaaurora/projects/Collision/lib/gtk4/src/bindings/pango/binding.yml
info - Using binding config at /home/annaaurora/projects/Collision/lib/libadwaita/src/bindings/binding.yml
fatal - Typelib file for namespace 'Gdk', version '4.0' not found
auroraanna commented 1 year ago

Shard "gi-crystal" may be incompatible with Crystal 1.2.2

maybe you need to up the crystal version?

GeopJr commented 1 year ago

All these dependencies (gobject-introspection, glib, gdk) should have been provided by wrapGAppsHook, right? It also mentions There is also [wrapGAppsHook4]{#ssec-gnome-hooks-wrapgappshook4}, which replaces GTK 3 with GTK 4.

maybe you need to up the crystal version?

Collision already "requires" (more like suggest) Crystal 1.6.0 but anything above what the shards require should work. Crystal version has to be bumped in nix (seems to be blocked https://github.com/NixOS/nixpkgs/pull/173928).

You can try with 1.2.2, it should still work as expected!

auroraanna commented 1 year ago

You can try with 1.2.2, it should still work as expected!

Also the binding generation?

GeopJr commented 1 year ago

Probably. (The above error is on the environment missing Gdk - not the binding generator).

I'm currently trying to fix the nix crystal package so 1.6.0 gets in, you can wait for that I guess. (But still 1.2.2 should still probably work)

auroraanna commented 1 year ago

It doesn't work. non-blocking-spawn requires >= 1.3.2, < 2.0.0

auroraanna commented 1 year ago

thanks for trying to update the crystal package

GeopJr commented 1 year ago

It doesn't work. non-blocking-spawn requires >= 1.3.2, < 2.0.0

Try passing --ignore-crystal-version on shards install, if that doesn't work, I can go change the shard requirements as that's mine.

auroraanna commented 1 year ago

gettext also requires 1.3.2

GeopJr commented 1 year ago

Also mine, it should work on 1.2.2.

auroraanna commented 1 year ago

Not sure if it's a good idea for you to set down the requirements. Do your programs have no issues with lower versions?

auroraanna commented 1 year ago

I think we should wait for the crystal nixpkgs update instead of trying to make this fit.

GeopJr commented 1 year ago

I agree on waiting, however they should still work. There haven't been that many breaking changes >= 1.0.0. The only reason these shards (including the ones I maintain) have that requirement is that the crystal tool that initializes a new project automatically sets it to the current one.