Problem with compiling gtk


#1

I want compile gtk was error, this depends on cairo, glib, glib-sys and sys
I give glib-sys issue and error stay on sys.
glib-2.0 was not found.
I do sudo apt-get install glib-2.0 but error still appear.


#2

Did you look at this?
http://gtk-rs.org/docs/requirements.html
Also check that you have installed the latest version of the Rust compiler, 'cause I had problems with that.


#3

You are probably encountering this issue because you didn’t install the -dev package. The normal package usually just installs the library (as a *.so or whatever), while the *-dev packages also install things you need for developing like relevant header files.


#4

I type sudo apt-get install libgtk-3-dev and is ok,
Is possible in my own module which would based in gtk, call “sudo apt-get update” and “sudo apt-get install” before build when user type “cargo build”?


#5

You could write a shell script (like build.sh) that runs that commands and then cargo build (it could also try to install rust if it is not installed yet). So the users just need to run ./build.sh


#6

I’d recommend against that. For one, it means you need to do sudo every time you compile, which requires you to have root. It’s also going to destroy your compile times because you are doing an apt-get update every time you compile. Plus it’s platform dependent, so your build.rs will blow up on Arch, Mac, Windows, Fedora, etc…

Instead it’s better to add a Requirements section to your README.md which says you need to have libgtk-3-dev installed.