Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

compiling issue: no method named to_owned found for type &'static str #4325

Closed
nuliknol opened this issue Dec 7, 2019 · 2 comments
Closed

Comments

@nuliknol
Copy link

nuliknol commented Dec 7, 2019

When running cargo build I am getting this (using today's Substrate sources from master):

 Running `rustc --edition=2018 --crate-name sp_runtime_interface primitives/runtime-interface/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -C debuginfo=2 --cfg 'feature="default"' --cfg 'feature="disable_target_static_assertions"' --cfg 'feature="environmental"' --cfg 'feature="externalities"' --cfg 'feature="std"' --cfg 'feature="wasm-interface"' -C metadata=75ccaef0411990b8 -C extra-filename=-75ccaef0411990b8 --out-dir /home/myuser/work/newsub/target/debug/deps -C incremental=/home/myuser/work/newsub/target/debug/incremental -L dependency=/home/myuser/work/newsub/target/debug/deps --extern environmental=/home/myuser/work/newsub/target/debug/deps/libenvironmental-2d231219b775a839.rmeta --extern 
codec=/home/myuser/work/newsub/target/debug/deps/libparity_scale_codec-30505dc129a71626.rmeta --extern primitive_types=/home/myuser/work/newsub/target/debug/deps/libprimitive_types-639dced981668548.rmeta --extern externalities=/home/myuser/work/newsub/target/debug/deps/libsp_externalities-8bdd4fb95bb5b7d8.rmeta --extern sp_runtime_interface_proc_macro=/home/myuser/work/newsub/target/debug/deps/libsp_runtime_interface_proc_macro-aa5d19fac181ba14.so --extern rstd=/home/myuser/work/newsub/target/debug/deps/libsp_std-9de2c6c87816d8cc.rmeta --extern wasm_interface=/home/myuser/work/newsub/target/debug/deps/libsp_wasm_interface-6fd4b6d9d9031753.rmeta --extern static_assertions=/home/myuser/work/newsub/target/debug/deps/libstatic_assertions-d55f434d659a87eb.rmeta`
error[E0599]: no method named `to_owned` found for type `&'static str` in the current scope
  --> /home/myuser/.cargo/registry/src/github.com-1ecc6299db9ec823/primitive-types-0.5.1/src/lib.rs:47:1
   |
47 | / construct_uint! {
48 | |     /// 128-bit unsigned integer.
49 | |     pub struct U128(2);
50 | | }
   | |_^ method not found in `&'static str`

Another error shows up within the same build process:

 Running `rustc --crate-name primitive_types /home/myuser/.cargo/registry/src/github.com-1ecc6299db9ec823/primitive-types-0.5.1/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -C debuginfo=2 --cfg 'feature="codec"' --cfg 'feature="impl-codec"' -C metadata=3dc9ebb12ad4e012 -C extra-filename=-3dc9ebb12ad4e012 --out-dir /home/myuser/work/newsub/target/debug/deps -L dependency=/home/myuser/work/newsub/target/debug/deps --extern fixed_hash=/home/myuser/work/newsub/target/debug/deps/libfixed_hash-b55cfd68ad8d0fde.rmeta --extern impl_codec=/home/myuser/work/newsub/target/debug/deps/libimpl_codec-bd18ab9d76b41114.rmeta --extern uint=/home/myuser/work/newsub/target/debug/deps/libuint-91a500505529ed06.rmeta --cap-lints allow`
error[E0412]: cannot find type `Vec` in this scope
  --> /home/myuser/.cargo/registry/src/github.com-1ecc6299db9ec823/primitive-types-0.5.1/src/lib.rs:47:1
   |
47 | / construct_uint! {
48 | |     /// 128-bit unsigned integer.
49 | |     pub struct U128(2);
50 | | }
   | |_^ not found in this scope
   |
   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)

user@host:~ $ cargo -V; rustc -V
cargo 1.41.0-nightly (626f0f40e 2019-12-03)
rustc 1.41.0-nightly (ae1b871cc 2019-12-06)
user@host:~ $

I did built WASM module before running cargo build
Looks like there are some problems with 'std' library being picked during the built process, but not sure what exactly the problem is.

@niklasad1
Copy link
Member

Hey,

  1. Seems like you are running a different version of primitive-types than master. It is 0.6.x where you are running 0.5.x
  2. Also, this could related to bug in primitive_types when it is used with default-features. See [fixed-hash]: fix build with default-features parity-common#268 for futher information. We should publish a new version of fixed_hash and primitive_types but meanwhile if you don't need the default features you could use it with default-features=false and it should work

@nuliknol
Copy link
Author

nuliknol commented Dec 8, 2019

Hey,

  1. Seems like you are running a different version of primitive-types than master. It is 0.6.x where you are running 0.5.x

you are right! I moved one directory with old primitive-types into substrate tree and that's where the problem started.

@nuliknol nuliknol closed this as completed Dec 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants