2
votes

I am attempting to try out Rocket web framework with a very small example. However, Rocket (0.4.2) wont compile with the nightly rustc. (Using Ubuntu linux.)

I am building using nightly rustc (2019-09-05). Just did a rustup to try the latest rustc. I am using these versions:

  • nightly-x86_64-unknown-linux-gnu (directory override for '/work/cd/rusty/cdbackend')
  • rustc 1.39.0-nightly (618768492 2019-09-05)
  • Rocket 0.4.2

I get the following error:

error: /work/cd/rusty/cdbackend/target/debug/deps/librocket_codegen-33108ba93258cfa7.so: undefined symbol: __rustc_plugin_registrar_a555dc3e7aee69391ac43d72ccd8fe72__
 --> src/main.rs:2:11
  |
2 | #![plugin(rocket_codegen)]
  |           ^^^^^^^^^^^^^^

error: aborting due to previous error

Any ideas on what version will compile?

2

2 Answers

3
votes

First thanks to @Gardener for the response above. It prompted me to look at the latest examples from Rocket.

Its not a problem with the versions, but the macros have changed. I record it here to help others.

Old code (which yields error reported):

#![plugin(rocket_codegen)]

extern crate rocket;

Is replaced by new macros:

#[macro_use] extern crate rocket;
0
votes

It would help if you would provide a little more information. Rocket compiles fine with nightly-2019-09-05 -- just confirmed.

git clone https://github.com/SergioBenitez/Rocket
cd Rocket
git checkout v0.4.2
cd examples/hello_world
cargo run

This works with the latest rocket 0.4.2 and the latest nightly.

You seem to be attempting to use rocket_codegen. Confirm that the above works before adding in rocket_codegen.

Once the above works, you may want to try the following:

echo 'rocket_codegen = "0.4.2"' >> Cargo.toml
cargo build