nimiq / core-rs

Official Rust implementation of the Nimiq protocol
https://nimiq.com
Other
74 stars 10 forks source link

Cannot build project on Mac #14

Closed valentinvieriu closed 5 years ago

valentinvieriu commented 5 years ago

Bug report

Expected behavior

The project should build on Mac

Actual behavior

The project fails to build

Steps to reproduce

Clone repository. Run 'cargo build'

Crash log? Screenshots? Videos? Sample project?

error: suffixes on a tuple index are invalid
  --> primitives/block/src/target.rs:12:64
   |
12 | #[derive(Default, Clone, Copy, PartialEq, PartialOrd, Eq, Ord, Serialize, Deserialize)]
   |                                                                ^^^^^^^^^ invalid suffix `i32`

error: proc-macro derive produced unparseable tokens
  --> primitives/block/src/target.rs:12:64
   |
12 | #[derive(Default, Clone, Copy, PartialEq, PartialOrd, Eq, Ord, Serialize, Deserialize)]
   |                                                                ^^^^^^^^^

error: aborting due to 2 previous errors

error: Could not compile `nimiq-block`.
warning: build failed, waiting for other jobs to finish...
error: build failed
riptl commented 5 years ago

Can confirm,

rustc 1.35.0-nightly (e4c66afba 2019-04-13)
sisou commented 5 years ago

Are you sure it's a Mac specific problem or just a known issue of not working with latest nightly yet (https://github.com/nimiq/core-rs/pull/13#issuecomment-480515421)?

sisou commented 5 years ago

On personal testing, this is indeed a problem with rust-1.35.0-nightly. It also fails to build on Linux.

active toolchain
----------------

nightly-2019-04-14-x86_64-unknown-linux-gnu (default)
rustc 1.35.0-nightly (e4c66afba 2019-04-13)

~1.34.0-[stable/nightly] works fine.~ Correction: 1.34.0-nightly works fine.

valentinvieriu commented 5 years ago

I've switched to stable

rustup default stable
rustup update && cargo update
#stable-x86_64-apple-darwin updated - rustc 1.34.0 (91856ed52 2019-04-10)
cargo clean
cargo build

And the error changes

   Compiling gcc v0.3.55
   Compiling data-encoding v2.1.2
   Compiling core-foundation-sys v0.5.1
   Compiling bit-vec v0.5.1
   Compiling nimiq-collections v0.1.0 (/Users/valentin.vieriu/Dockers/crypto/nimiq/core-rs/collections)
   Compiling security-framework-sys v0.2.3
error[E0554]: #![feature] may not be used on the stable release channel
 --> collections/src/lib.rs:2:1
  |
2 | #![feature(box_into_raw_non_null)]
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0554]: #![feature] may not be used on the stable release channel
 --> collections/src/lib.rs:3:1
  |
3 | #![feature(specialization)]
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0554]: #![feature] may not be used on the stable release channel
 --> collections/src/lib.rs:4:1
  |
4 | #![feature(map_get_key_value)]
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

   Compiling matches v0.1.8
   Compiling build_const v0.2.1
   Compiling bitflags v1.0.4
   Compiling httparse v1.3.3
   Compiling regex v1.1.5
error: aborting due to 3 previous errors

For more information about this error, try `rustc --explain E0554`.
error: Could not compile `nimiq-collections`.
warning: build failed, waiting for other jobs to finish...
error: build failed
valentinvieriu commented 5 years ago

Confirm that also running in a Docker, has the same output: Dockerfile

FROM rust:1.34
WORKDIR /usr/src/myapp
COPY . .
RUN cargo build --all

The error:

   Compiling siphasher v0.2.3
   Compiling gcc v0.3.55
   Compiling nimiq-collections v0.1.0 (/usr/src/myapp/collections)
error[E0554]: #![feature] may not be used on the stable release channel
 --> collections/src/lib.rs:2:1
  |
2 | #![feature(box_into_raw_non_null)]
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0554]: #![feature] may not be used on the stable release channel
 --> collections/src/lib.rs:3:1
  |
3 | #![feature(specialization)]
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0554]: #![feature] may not be used on the stable release channel
 --> collections/src/lib.rs:4:1
  |
4 | #![feature(map_get_key_value)]
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to 3 previous errors

For more information about this error, try `rustc --explain E0554`.
error: Could not compile `nimiq-collections`.
warning: build failed, waiting for other jobs to finish...
error: build failed
jgraef commented 5 years ago

This is a known problem. We're working on it, but unfortunately there is a lot that needs to be updated for the latest nightly version (and syn version). I'm using nightly-2019-02-03-x86_64-unknown-linux-gnu and it builds fine.

jgraef commented 5 years ago

Fixed by Update beserial_derive to latest macro APIs