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

Can't build gtk project #350

Open
Luxuride opened this issue Mar 12, 2024 · 2 comments
Open

Can't build gtk project #350

Luxuride opened this issue Mar 12, 2024 · 2 comments

Comments

@Luxuride
Copy link

Hello, I was trying to create simple project with gtk-rs.
My project consists of hello world application with

[dependencies]
gtk = "0.18.1"

in cargo.toml

I was using nix develop github:cargo2nix/cargo2nix#bootstrap,

$ cargo2nix --version
cargo2nix 0.11.0

I copied the flake from examples and changed the project name and cargo2nix address to make it work. That made it work normally on fresh hello world project.

With the gtk dependency I get this when I try nix develop

$ nix develop
error: builder for '/nix/store/n85pvca4ddp2w5w9b8kxmxy9hxdh3bq6-crate-glib-sys-0.18.1.drv' failed with exit code 101;
       last 10 log lines:
       >   or `pkg install pkg-config`, or `apk add pkgconfig` depending on your distribution.
       >
       >   If you've already installed it, ensure the pkg-config command is one of the
       >   directories in the PATH environment variable.
       >
       >   If you did not expect this build to link to a pre-installed system library,
       >   then check documentation of the glib-sys crate for an option to
       >   build the library from source, or disable features or dependencies
       >   that require pkg-config.
       > /nix/store/wr08yanv2bjrphhi5aai12hf2qz5kvic-stdenv-linux/setup: line 131: pop_var_context: head of shell_variables not a function context
       For full logs, run 'nix log /nix/store/n85pvca4ddp2w5w9b8kxmxy9hxdh3bq6-crate-glib-sys-0.18.1.drv'.
error: 1 dependencies of derivation '/nix/store/l2fv6hi4dr2q198mbyk1a2fb4qfydk1b-crate-atk-sys-0.18.0.drv' failed to build
error: 1 dependencies of derivation '/nix/store/sscvf13175dx4y8zyk5lvsa0yzd0msxy-crate-cairo-sys-rs-0.18.2.drv' failed to build
error: 1 dependencies of derivation '/nix/store/hby9mswa421h2x2gbdr5ssjip94mwffl-crate-gdk-pixbuf-sys-0.18.0.drv' failed to build
error: 1 dependencies of derivation '/nix/store/7ng58flaxq2afz49zc5b8f855j07gvz0-crate-gdk-sys-0.18.0.drv' failed to build
error: 1 dependencies of derivation '/nix/store/079nql3h7dsy6aa8zbxpl9ji8b8kbajh-crate-gio-sys-0.18.1.drv' failed to build
error: 1 dependencies of derivation '/nix/store/g3n8z750hfv1nyr2qznwmzv9i5rlqzmx-crate-glib-0.18.5.drv' failed to build
error: 1 dependencies of derivation '/nix/store/wqzp2shgkjn55hpqrnksrjh485zzwsba-crate-pango-sys-0.18.0.drv' failed to build
error: 1 dependencies of derivation '/nix/store/wj83567fv88nhaq60jlqrmp9s7m957zj-crate-gtk-0.18.1.drv' failed to build
error: 1 dependencies of derivation '/nix/store/yc74df61a5qqvzyic8839097cwcpk899-crate-rust-test-0.1.0-env.drv' failed to build

I don't know if it is problem from my side and I need to import the dependencies manually, somehow or if this is really a bug for the project.
I'm new to nix and I'm to setup rust development workflow.

@proski
Copy link
Collaborator

proski commented Apr 1, 2024

There is explicit support for pkg-config in cargo2nix that should just work. I tried adding the gtk dependency to the example provided with cargo2nix. With the v0.11.0 tag, compilation succeeds (as long as the necessary development libraries are installed). With the current release-0.11.0 branch, compilation fails with a similar message. I guess that issue can be bisected.

@proski
Copy link
Collaborator

proski commented Apr 2, 2024

I was wrong about the v0.11.0 release, it fails to compile gtk as well, but with a different error. In v0.11.0, pkg-config fails to find glib-2.0. In release-0.11.0, the pkg-config itself cannot be found. That error is introduced in 2ae2f57.

I would suggest that you try some other solution in the meantime (crane or crate2nix perhaps). This project needs a serious cleanup, and even then, I expect it to be in maintenance mode, i.e. primarily fixing regressions for the existing users.

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

No branches or pull requests

2 participants