Giter Club home page Giter Club logo

Comments (6)

raphlinus avatar raphlinus commented on July 22, 2024 2

I think --all --exclude piet-cairo might be a temporary workaround, but we probably want a more systematic solution.

from piet.

dianarg avatar dianarg commented on July 22, 2024 1

Sure, I'm happy to take a look at it this weekend. At the very least there should be a way to print a nicer error message, along the lines of "cairo library not installed, try --all --exclude cairo " when cargo build or cargo test fails. The current behavior I believe is just a normal ugly looking link error.

from piet.

cmyr avatar cmyr commented on July 22, 2024

@dianarg no pressure, but if you wanted to look into this you'd be very welcome! I see you'd already thought of this issue (https://github.com/linebender/piet/pull/97/files#r341583903).

I do think that by default, on windows, piet should just be building direct-write. I dunno. Maybe piet should always require an explicit backend? I'm not sure what the perfect structure for the piet project is, but I am confident that we haven't found it yet. 😆

from piet.

dianarg avatar dianarg commented on July 22, 2024

I started looking into this today. I am struggling to figure out if it's even possible to make Cargo do what I want (a nicer error message at the time it checks the cairo dependency, instead of the long error from link.exe). The error when you build on Windows without cairo installed looks like this:

error: linking with `link.exe` failed: exit code: 1181
[huge link.exe command with LIBPATH]
  = note: LINK : fatal error LNK1181: cannot open input file 'cairo.lib'

The output on Linux is similar but I didn't get around testing it yet.

I would have expected that adding links = "cairo" to the package settings would do something but it seems the cairo-rs crate has already specified the dependency:

> cargo build
error: failed to select a version for `cairo-sys-rs`.
    ... required by package `cairo-rs v0.7.1`
    ... which is depended on by `cairo_test v0.1.0 (C:\Users\Diana\cairo_test)`
versions that meet the requirements `= 0.9.0` are: 0.9.0

the package `cairo-sys-rs` links to the native library `cairo`, but it conflicts with a previous package which links to `cairo` as well:
package `cairo_test v0.1.0 (C:\Users\Diana\cairo_test)`

failed to select a version for `cairo-sys-rs` which could resolve this conflict

Here is a smaller reproducer for the problem:

Cargo.toml

[package]
name = "cairo_test"
version = "0.1.0"

# specify that we link to native library cairo
# this doesn't work
#links = "cairo"

[dependencies]
cairo-rs = { version = "0.7.1", default_features = false }

src/main.rs

extern crate cairo;

use cairo::{Context, Format, ImageSurface};

fn main() {
    let surface = ImageSurface::create(Format::ARgb32, 10, 10)
        .expect("Can't create surface");
    let mut cr = Context::new(&surface);
    cr.scale(3.3, 3.3);
}

from piet.

cmyr avatar cmyr commented on July 22, 2024

The hacky way to do this might be with a custom build.rs script, and that feels a bit bad. I'd personally perfer to not require cairo on windows, since I just don't expect many folks to have it? Not sure how fair this is, very much an assumption.

from piet.

dianarg avatar dianarg commented on July 22, 2024

#109 should fix that. I agree cairo should not be required on Windows, since it seems direct2d just works. That patch didn't need to be bundled with the Azure testing.

from piet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.