sourceview icon indicating copy to clipboard operation
sourceview copied to clipboard

Cannot compile sourceview version 0.6.0

Open brackleian opened this issue 6 years ago • 3 comments

With gtk 0.5.0 and sourceview 0.5.0, all goes fine, until I try to use gtk::ResponseType::Other(0) which is only available from gtk 0.6.0.

So I change to gtk 0.6.0, sourceview ^0, and now get error[E0433]: failed to resolve: could not find 'FileLoader' in 'sourceview' Changing to sourceview to 0.6.0 makes no difference.

The doco shows 'FileLoader' as features v3_14, so I try adding that to sourceview, which gives me error: failed to select a version for 'sourceview'. ... required by package 'foo v0.1.0 (/.../foo)' versions that meet the requirements '= 0.6.0' are: 0.6.0 the package 'foo' depends on 'sourceview', with features: 'v3_14' but 'sourceview' does not have these features. This is a known bug, which I reported recently (issue #92, now closed).

To work round the v3_14 problem, I clone sourceview branch 0.6.0, fix the 'v3_14' bug, and point cargo at my local copy. Now the error is: Updating git repository 'https://github.com/gtk-rs/pango' error: failed to select a version for 'gdk-pixbuf-sys'. ... required by package 'sourceview v0.6.0 (/.../sourceview)' ... which is depended on by 'foo' v0.1.0 (/.../foo)' versions that meet the requirements '*' are: 0.8.0 the package 'gdk-pixbuf-sys' links to the native library 'gdk_pixbuf', but it conflicts with a previous package which links to 'gdk_pixbuf' as well: package 'gdk-pixbuf-sys v0.8.0' ... which is depended on by 'gtk v0.6.0' ... which is depended on by 'foo v0.1.0 (/.../foo)' failed to select a version for 'gdk-pixbuf-sys' which could resolve this conflict

I'm stumped by that, as I am still somewhat of a noob with Cargo/git versioning, and would be grateful for some guidance on a work-round that works. :)

brackleian avatar Jun 01 '19 22:06 brackleian

From http://gtk-rs.org/docs/sourceview/struct.FileLoader.html , it says it requires the v3_14 feature to be enabled. Which you seemed to have enabled. Can you show what your Cargo.toml file looks like by any chance?

GuillaumeGomez avatar Jun 01 '19 22:06 GuillaumeGomez

Cargo.toml:

name = "foo"
version = "0.1.0"
authors = ["austin"]
edition = "2018"

[dependencies]
gtk = "0.6.0"
sourceview = { version = "0.6.0", features = ["v3_14"], path = "../sourceview" }

main.rs:

use gtk;
fn main()
{
	println!("This requires GTK 0.6.0: {:?}", gtk::ResponseType::Other(0));
	println!("This requires sourceview 0.6.0: {:?}", sourceview::FileLoader::new());
}

brackleian avatar Jun 02 '19 01:06 brackleian

I've now given up trying to get 0.6.0 to compile. The github code lacks the v3_14 feature, so you have to clone it and fix locally, but even then it will not play nicely with all the other GTK crates (at least, not in any cobination of versions that I can find) I have now switched to 0.7.0, which has a few breaking changes, but only needed minor fixes to my code, which now compiles and runs just fine.

brackleian avatar Jun 25 '19 01:06 brackleian