Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when compiling 'hello-world': 'error[E0412]: cannot find type Option in this scope' #2

Open
CanadaHonk opened this issue Dec 29, 2019 · 1 comment

Comments

@CanadaHonk
Copy link

CanadaHonk commented Dec 29, 2019

After following the steps in the setup guide, I get this error when I try and compile 'libc', specifically '/home/duck/.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.46/src/unix/newlib/mod.rs'.

Full output:

warning: Patch `rustc-std-workspace-core v1.0.0 (/home/duck/.rustup/toolchains/nightly-2019-01-19-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/tools/rustc-std-workspace-core)` was not used in the crate graph.
Check that the patched package version and available features are compatible
with the dependency requirements. If the patch has a different version from
what is locked in the Cargo.lock file, run `cargo update` to use the new
version. This may also occur with an optional dependency that is not enabled.
   Compiling core v0.0.0 (/home/duck/.rustup/toolchains/nightly-2019-01-19-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libcore)
    Finished release [optimized] target(s) in 1m 12s
   Compiling cc v1.0.28
   Compiling core v0.0.0 (/home/duck/.rustup/toolchains/nightly-2019-01-19-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libcore)
   Compiling compiler_builtins v0.1.4
   Compiling rustc-std-workspace-core v1.0.0 (/home/duck/.rustup/toolchains/nightly-2019-01-19-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/tools/rustc-std-workspace-core)
   Compiling alloc v0.0.0 (/home/duck/.rustup/toolchains/nightly-2019-01-19-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/liballoc)
    Finished release [optimized] target(s) in 1m 41s
warning: dependency (libc) specified without providing a local path, Git repository, or version to use. This will be considered an error in future versions
   Compiling core v0.0.0 (/home/duck/.rustup/toolchains/nightly-2019-01-19-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libcore)
   Compiling libc v0.2.46
   Compiling rustc-std-workspace-core v1.0.0 (/home/duck/.rustup/toolchains/nightly-2019-01-19-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/tools/rustc-std-workspace-core)
error[E0412]: cannot find type `Option` in this scope
   --> /home/duck/.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.46/src/unix/newlib/mod.rs:723:36
    |
723 |     pub fn pthread_atfork(prepare: Option<unsafe extern fn()>,
    |                                    ^^^^^^ not found in this scope
help: possible candidates are found in other modules, you can import them into scope
    |
1   | use core::option::Option;
    |
1   | use core::prelude::v1::Option;
    |

error[E0412]: cannot find type `Option` in this scope
   --> /home/duck/.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.46/src/unix/newlib/mod.rs:724:35
    |
724 |                           parent: Option<unsafe extern fn()>,
    |                                   ^^^^^^ not found in this scope
help: possible candidates are found in other modules, you can import them into scope
    |
1   | use core::option::Option;
    |
1   | use core::prelude::v1::Option;
    |

error[E0412]: cannot find type `Option` in this scope
   --> /home/duck/.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.46/src/unix/newlib/mod.rs:725:34
    |
725 |                           child: Option<unsafe extern fn()>) -> ::c_int;
    |                                  ^^^^^^ not found in this scope
help: possible candidates are found in other modules, you can import them into scope
    |
1   | use core::option::Option;
    |
1   | use core::prelude::v1::Option;
    |

error: aborting due to 3 previous errors

For more information about this error, try `rustc --explain E0412`.
error: Could not compile `libc`.

To learn more, run the command again with --verbose.
error: `"cargo" "build" "--release" "--manifest-path" "/tmp/xargo.WlPnFEDyBx1v/Cargo.toml" "--target" "aarch64-horizon-elf" "-p" "libc"` failed with exit code: Some(101)
stack backtrace:
   0: error_chain::make_backtrace::h66e7507f95410765 (0x56342cde2c38)
   1: <error_chain::State as core::default::Default>::default::he5b2882a1d6eb6a1 (0x56342cde2cc6)
   2: <std::process::Command as xargo::extensions::CommandExt>::run::hf608742b45089f1f (0x56342cd9bb30)
   3: xargo::sysroot::build::hd22f93d87cfe7aa2 (0x56342cda3181)
   4: xargo::sysroot::update::h9f4ac14dbf2de905 (0x56342cda5143)
   5: xargo::main::hd59bd6c28f208877 (0x56342cdb65e7)
   6: std::rt::lang_start::{{closure}}::h1dce5d596d152c49 (0x56342cd93143)
   7: std::rt::lang_start_internal::{{closure}}::hc1efa189bf5f6d84 (0x56342ce04433)
             at src/libstd/rt.rs:49
      std::panicking::try::do_call::hc5f4d1e558ca9232
             at src/libstd/panicking.rs:297
   8: __rust_maybe_catch_panic (0x56342ce0ce0a)
             at src/libpanic_unwind/lib.rs:92
   9: std::panicking::try::h0b576e013ac13f04 (0x56342ce04f86)
             at src/libstd/panicking.rs:276
      std::panic::catch_unwind::h3b1d5a0242e6b692
             at src/libstd/panic.rs:388
      std::rt::lang_start_internal::he7135653eea56fd5
             at src/libstd/rt.rs:48
  10: main (0x56342cdb7092)
  11: __libc_start_main (0x7fe0a61f0153)
  12: _start (0x56342cd881ce)
  13: <unknown> (0x0)
Failed to open output file!
Failed to open input!
Generated NRO: /home/duck/rust-examples/hello-world/*.nro```

Rust(up) info:
```rustup show
Default host: x86_64-unknown-linux-gnu
rustup home:  /home/duck/.rustup

installed toolchains
--------------------

nightly-2019-01-19-x86_64-unknown-linux-gnu (default)
nightly-x86_64-unknown-linux-gnu

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

nightly-2019-01-19-x86_64-unknown-linux-gnu (default)
rustc 1.33.0-nightly (c76f3c374 2019-01-18)```

Additional Info:
- The first time it (the actual code) compiled, but I didn't have devkitpro installed so making the NRO / post processing failed
- I tried reinstalling Rust and the tools but it still continues to fail
- I've ran the cleaning script (`clean.sh`) after each time but it doesn't help
@leo60228
Copy link
Member

That guide is outdated. Try the docker image at rustyhorizon/docker.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants