linebender / piet

An abstraction for 2D graphics.
Apache License 2.0
1.26k stars 94 forks source link

Unresolved import `direct2d::math` #33

Open canadaduane opened 5 years ago

canadaduane commented 5 years ago

I am (probably naively) trying to run "cargo build" on a fresh pull of piet and I'm seeing several errors in the build, e.g.:

error[E0432]: unresolved import `direct2d::math`
 --> piet-direct2d/src/conv.rs:3:15
  |
3 | use direct2d::math::{Matrix3x2F, Point2F, RectF};
  |               ^^^^ could not find `math` in `direct2d`

error[E0433]: failed to resolve: could not find `shared` in `winapi`
  --> piet-direct2d/src/lib.rs:11:13
   |
11 | use winapi::shared::basetsd::UINT32;
   |             ^^^^^^ could not find `shared` in `winapi`

error[E0433]: failed to resolve: could not find `um` in `winapi`
  --> piet-direct2d/src/lib.rs:12:13
   |
12 | use winapi::um::dcommon::D2D_SIZE_U;
   |             ^^ could not find `um` in `winapi`

I assume that as a new user of rust I just don't know what I'm doing :)

raphlinus commented 5 years ago

This looks like trying to build windows-specific code on a non-windows platform. That shouldn't be happening. What platform are you on? Are you setting any features explicitly?

canadaduane commented 5 years ago

I'm on Mac OS. I just checked the repo out and did "cargo build" in the root, so I'm not aware of setting any features.

On Fri, Jan 25, 2019 at 8:38 PM Raph Levien notifications@github.com wrote:

This looks like trying to build windows-specific code on a non-windows platform. That shouldn't be happening. What platform are you on? Are you setting any features explicitly?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/linebender/piet/issues/33#issuecomment-457798042, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAAgY7DBmAvOp4W-8u_seXq5ndZkCj4ks5vG83FgaJpZM4aT9tI .

raphlinus commented 5 years ago

Ah, got it. Building the workspace tries to build all the subcrates, including direct2d, which isn't going to work. What should work is cargo run --example basic-cairo, assuming the Cairo prerequisites have been installed. We should probably update the README to reflect this.

We could also update the piet-direct2d crate so that nothing gets built on non-windows platforms.

canadaduane commented 5 years ago

Thanks, that's exactly what I was looking for.

On Fri, Jan 25, 2019 at 8:47 PM Raph Levien notifications@github.com wrote:

Ah, got it. Building the workspace tries to build all the subcrates, including direct2d, which isn't going to work. What should work is cargo run --example basic-cairo, assuming the Cairo prerequisites have been installed. We should probably update the README to reflect this.

We could also update the piet-direct2d crate so that nothing gets built on non-windows platforms.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/linebender/piet/issues/33#issuecomment-457798591, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAAgQgzAnpF-cZN2o-zAIkpDHbOWLDyks5vG8_igaJpZM4aT9tI .

SimonSapin commented 5 years ago

Specifying default-members in the workspace’s manifest could help: https://doc.rust-lang.org/cargo/reference/manifest.html#package-selection