fschutt/azul

Unable to build basic project with azul as dependency

IohannRabeson opened this issue · 10 comments

Description

I'm trying to build a default project generated by Cargo with azul as dependency and I got the following error:

error[E0433]: failed to resolve: could not find `IoReader` in `bincode`
   --> /Users/iota/.cargo/registry/src/github.com-1ecc6299db9ec823/webrender_api-0.60.0/src/display_list.rs:270:35
    |
270 |             let reader = bincode::IoReader::new(UnsafeReader::new(&mut self.data));
    |                                   ^^^^^^^^ could not find `IoReader` in `bincode`

Version / OS

  • azul version: 0.1.0 from github (azul#7ed96030)

  • Operating system: OSX high sierra 10.13.6

Steps to Reproduce

Create a project using cargo then move to the new directory:
cargo new --bin test_azul && cd test_azul
Add azul as dependency by adding this line to Cargo.toml:
azul = { git = "https://github.com/maps4print/azul" }
Build the project:
cargo build
Notice the error error[E0433] I mentioned earlier.

Use the wip branch, the master branch is outdated

I got same error as @IohannRabeson and now changed branch to "wip" like this:

azul = { git = "https://github.com/maps4print/azul", branch = "wip" }

I get new error:

$ cargo run
   Compiling azul v0.0.1 (https://github.com/maps4print/azul?branch=wip#abfcb66c)
error: couldn't read /home/akataeva/.cargo/lib/azul-dll-0.0.1/target/release/libazul.so: No such file or directory (os error 2)
    --> /home/akataeva/.cargo/git/checkouts/azul-f3b1e21a5e685cad/abfcb66/azul/src/rust/dll.rs:6744:30
     |
6744 |     const LIB_BYTES: &[u8] = include_bytes!(concat!(env!("CARGO_HOME"), "/lib/", "azul-dll-", env!("CARGO_PKG_VERSION"), "/target/release/libazul.so")); /* !!! IF THIS LINE SHOWS AN ERROR, IT MEANS YOU FORGOT TO RUN "cargo install --version 0.1.0 azul-dll" */
     |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     |
     = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error: aborting due to previous error

error: could not compile `azul`.

Then i tried to execute cargo install --version 0.1.0 azul-dll and get this:

error: could not find `azul-dll` in registry `https://github.com/rust-lang/crates.io-index` with version `=0.1.0`

What do i do wrong?

azul-dll is not yet uploaded on crates.io, so obviously cargo doesn't find the source code for the azul-dll crate. Do: cargo install --path ./azul-dll, should work. The result should be a freshly-built dynamic library in ~/.cargo/lib/azul-0.1.0/target/release/azul.dylib. Check that that path exists.

If you're on Linux / Mac, you can also look at the test.sh script, it essentially does the same as the cargo install command.

Thanks for your replies! So I switched to the wip branch then ran test.sh (only had to chmod it to make it executable) and I got more errors:

error[E0658]: use of unstable library feature 'slice_from_raw_parts': recently added
   --> azul-css/src/lib.rs:196:25
    |
196 |                 let s = std::ptr::slice_from_raw_parts_mut(self.as_mut_ptr().add(len), remaining_len);
    |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
661 | impl_vec!(u8, U8Vec);
    | --------------------- in this macro invocation
    |
    = note: for more information, see https://github.com/rust-lang/rust/issues/36925

error[E0658]: use of unstable library feature 'slice_from_raw_parts': recently added
   --> azul-css/src/lib.rs:196:25
    |
196 |                 let s = std::ptr::slice_from_raw_parts_mut(self.as_mut_ptr().add(len), remaining_len);
    |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
670 | impl_vec!(AzString, StringVec);
    | ------------------------------- in this macro invocation
    |
    = note: for more information, see https://github.com/rust-lang/rust/issues/36925

error[E0658]: use of unstable library feature 'slice_from_raw_parts': recently added
   --> azul-css/src/lib.rs:196:25
    |
196 |                 let s = std::ptr::slice_from_raw_parts_mut(self.as_mut_ptr().add(len), remaining_len);
    |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
679 | impl_vec!(GradientStopPre, GradientStopPreVec);
    | ----------------------------------------------- in this macro invocation
    |
    = note: for more information, see https://github.com/rust-lang/rust/issues/36925

error[E0658]: use of unstable library feature 'slice_from_raw_parts': recently added
   --> azul-css/src/lib.rs:196:25
    |
196 |                 let s = std::ptr::slice_from_raw_parts_mut(self.as_mut_ptr().add(len), remaining_len);
    |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    | 
   ::: azul-css/src/css.rs:17:1
    |
17  | impl_vec!(Stylesheet, StylesheetVec);
    | ------------------------------------- in this macro invocation
    |
    = note: for more information, see https://github.com/rust-lang/rust/issues/36925

error[E0658]: use of unstable library feature 'slice_from_raw_parts': recently added
   --> azul-css/src/lib.rs:196:25
    |
196 |                 let s = std::ptr::slice_from_raw_parts_mut(self.as_mut_ptr().add(len), remaining_len);
    |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    | 
   ::: azul-css/src/css.rs:43:1
    |
43  | impl_vec!(CssRuleBlock, CssRuleBlockVec);
    | ----------------------------------------- in this macro invocation
    |
    = note: for more information, see https://github.com/rust-lang/rust/issues/36925

error[E0658]: use of unstable library feature 'slice_from_raw_parts': recently added
   --> azul-css/src/lib.rs:196:25
    |
196 |                 let s = std::ptr::slice_from_raw_parts_mut(self.as_mut_ptr().add(len), remaining_len);
    |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    | 
   ::: azul-css/src/css.rs:294:1
    |
294 | impl_vec!(CssDeclaration, CssDeclarationVec);
    | --------------------------------------------- in this macro invocation
    |
    = note: for more information, see https://github.com/rust-lang/rust/issues/36925

error[E0658]: use of unstable library feature 'slice_from_raw_parts': recently added
   --> azul-css/src/lib.rs:196:25
    |
196 |                 let s = std::ptr::slice_from_raw_parts_mut(self.as_mut_ptr().add(len), remaining_len);
    |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    | 
   ::: azul-css/src/css.rs:388:1
    |
388 | impl_vec!(CssPathSelector, CssPathSelectorVec);
    | ----------------------------------------------- in this macro invocation
    |
    = note: for more information, see https://github.com/rust-lang/rust/issues/36925

   Compiling float-cmp v0.5.3
   Compiling matches v0.1.8
   Compiling azul-simplecss v0.1.1
error[E0658]: use of unstable library feature 'alloc_layout_extra'
   --> azul-css/src/lib.rs:151:30
    |
151 |             let new_layout = std::alloc::Layout::array::<$struct_type>(new_cap).map_err(|_| true)?;
    |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
661 | impl_vec!(u8, U8Vec);
    | --------------------- in this macro invocation
    |
    = note: for more information, see https://github.com/rust-lang/rust/issues/55724

error[E0658]: use of unstable library feature 'alloc_layout_extra'
   --> azul-css/src/lib.rs:151:30
    |
151 |             let new_layout = std::alloc::Layout::array::<$struct_type>(new_cap).map_err(|_| true)?;
    |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
670 | impl_vec!(AzString, StringVec);
    | ------------------------------- in this macro invocation
    |
    = note: for more information, see https://github.com/rust-lang/rust/issues/55724

error[E0658]: use of unstable library feature 'alloc_layout_extra'
   --> azul-css/src/lib.rs:151:30
    |
151 |             let new_layout = std::alloc::Layout::array::<$struct_type>(new_cap).map_err(|_| true)?;
    |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
679 | impl_vec!(GradientStopPre, GradientStopPreVec);
    | ----------------------------------------------- in this macro invocation
    |
    = note: for more information, see https://github.com/rust-lang/rust/issues/55724

error[E0658]: use of unstable library feature 'alloc_layout_extra'
   --> azul-css/src/lib.rs:151:30
    |
151 |             let new_layout = std::alloc::Layout::array::<$struct_type>(new_cap).map_err(|_| true)?;
    |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    | 
   ::: azul-css/src/css.rs:17:1
    |
17  | impl_vec!(Stylesheet, StylesheetVec);
    | ------------------------------------- in this macro invocation
    |
    = note: for more information, see https://github.com/rust-lang/rust/issues/55724

error[E0658]: use of unstable library feature 'alloc_layout_extra'
   --> azul-css/src/lib.rs:151:30
    |
151 |             let new_layout = std::alloc::Layout::array::<$struct_type>(new_cap).map_err(|_| true)?;
    |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    | 
   ::: azul-css/src/css.rs:43:1
    |
43  | impl_vec!(CssRuleBlock, CssRuleBlockVec);
    | ----------------------------------------- in this macro invocation
    |
    = note: for more information, see https://github.com/rust-lang/rust/issues/55724

error[E0658]: use of unstable library feature 'alloc_layout_extra'
   --> azul-css/src/lib.rs:151:30
    |
151 |             let new_layout = std::alloc::Layout::array::<$struct_type>(new_cap).map_err(|_| true)?;
    |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    | 
   ::: azul-css/src/css.rs:294:1
    |
294 | impl_vec!(CssDeclaration, CssDeclarationVec);
    | --------------------------------------------- in this macro invocation
    |
    = note: for more information, see https://github.com/rust-lang/rust/issues/55724

error[E0658]: use of unstable library feature 'alloc_layout_extra'
   --> azul-css/src/lib.rs:151:30
    |
151 |             let new_layout = std::alloc::Layout::array::<$struct_type>(new_cap).map_err(|_| true)?;
    |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    | 
   ::: azul-css/src/css.rs:388:1
    |
388 | impl_vec!(CssPathSelector, CssPathSelectorVec);
    | ----------------------------------------------- in this macro invocation
    |
    = note: for more information, see https://github.com/rust-lang/rust/issues/55724
0xAAE commented

I tried this approach cargo install --path ./azul-dll. It works if I enter the directory where azul (branch = wip) was checked out ~/.cargo/git/checkouts/azul-f3b1e21a5e685cad/abfcb66. Build stops closely to the finish on:

Compiling azul-desktop v0.0.5 (/Users/aae/.cargo/git/checkouts/azul-f3b1e21a5e685cad/abfcb66/azul-desktop)
error[E0463]: can't find crate for `core_foundation`
  --> azul-desktop/src/lib.rs:36:1

Ok, about the latest error I reported, it was because I was using a super late rust (1.40.0), I just updated to 1.44.0 and it's seems better but test.sh didn't end successfully though. I got the following error (same as @0xAAE ):

error[E0463]: can't find crate for `core_foundation`
  --> azul-desktop/src/lib.rs:36:1
   |
36 | extern crate core_foundation;
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate

error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.

Looks like core_foundation might be missing from Cargo.tolm for azul-desktop, but I did not had the time to check in the code yet.

Yeah, I didn't test that it works on Mac. Thanks for noticing, I just have to add core_foundation to the dependencies for Mac.

I fixed the last few errors (for azul-desktop), I will submit a PR soon.

#258
I'm not sure though, I only get a black window, I did not checked the example itself but at least that finally build.

#258 fixed the build on OSX