servo/surfman

Issue building; Looks like my winit is the wrong version, but I don't know how to change it.

avr1 opened this issue · 11 comments

avr1 commented

I'm building from source, with no additions. But, when I run the code, I get issues with an unresolved import of 'winit'
error[E0433]: failed to resolve: use of undeclared crate or module winit
--> android-example/rust/src/../../../surfman/examples/threads.rs:20:5
|
20 | use winit::dpi::PhysicalSize;
| ^^^^^ use of undeclared crate or module winit

error[E0432]: unresolved import surfman::platform::android
--> android-example/rust/src/lib.rs:17:24
|
17 | use surfman::platform::android::tests;
| ^^^^^^^ could not find android in platform

error[E0432]: unresolved import winit
--> android-example/rust/src/../../../surfman/examples/threads.rs:22:5
|
22 | use winit::{DeviceEvent, Event, EventsLoop, KeyboardInput, VirtualKeyCode};
| ^^^^^ use of undeclared crate or module winit

error[E0432]: unresolved import winit
--> android-example/rust/src/../../../surfman/examples/threads.rs:24:5
|
24 | use winit::{WindowBuilder, WindowEvent};
| ^^^^^ use of undeclared crate or module winit

error[E0433]: failed to resolve: use of undeclared type PhysicalSize
--> android-example/rust/src/../../../surfman/examples/threads.rs:93:9
|
93 | PhysicalSize::new(window_size.width as f64, window_size.height as f64).to_logical(dpi);
| ^^^^^^^^^^^^ use of undeclared type PhysicalSize

warning: unused #[macro_use] import
--> android-example/rust/src/lib.rs:3:1
|
3 | #[macro_use]
| ^^^^^^^^^^^^
|
= note: #[warn(unused_imports)] on by default

warning: unused imports: JoinHandle, self
--> android-example/rust/src/lib.rs:16:19
|
16 | use std::thread::{self, JoinHandle};
| ^^^^ ^^^^^^^^^^

error[E0599]: no function or associated item named current found for struct surfman::NativeDevice in the current scope
--> android-example/rust/src/lib.rs:44:57
|
44 | .create_device_from_native_device(NativeDevice::current())
| ^^^^^^^ function or associated item not found in surfman::NativeDevice

The version of winit that's running on my machine appears to be 0.19.3, and I'm not sure how to move backwards. Any help would be appreciated.

avr1 commented

@jdm I've asked about a similar problem before, but I haven't found a working solution yet. Any help would be tremendously appreciated!

jdm commented

@avr1 What OS, how are you building, and what directory are you building from?

jdm commented

Also does git diff show anything?

avr1 commented

MacOS 11.1, using cargo build, and from a directory that contains other projects related to servo. 'git diff' does NOT show anything.

jdm commented

What happens if you remove the Cargo.lock in the root directory and build again?

avr1 commented

I get the same errors, and nothing exists in the git diff.

jdm commented

What if you build with --features sm-winit?

avr1 commented

Oh, I just got the following error:

warning: profiles for the non root package will be ignored, specify profiles at the workspace root:
package: /Users/arjun/Repositories/Open-Source/github.com/Rust/The-Servo-Project/surfman/android-example/rust/Cargo.toml
workspace: /Users/arjun/Repositories/Open-Source/github.com/Rust/The-Servo-Project/surfman/Cargo.toml
error: --features is not allowed in the root of a virtual workspace
note: while this was previously accepted, it didn't actually do anything
help: change the current directory to the package directory, or use the --manifest-path flag to the path of the package

avr1 commented

@jdm Do I need to specify that the build is for the root workspace, and not the android example?

jdm commented

I suggest trying to build from the surfman subdirectory instead.

avr1 commented

Worked like a charm. Thanks!