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

build/setup error #6

Closed
nh2 opened this issue Jul 27, 2018 · 4 comments
Closed

build/setup error #6

nh2 opened this issue Jul 27, 2018 · 4 comments

Comments

@nh2
Copy link

@nh2 nh2 commented Jul 27, 2018

% rustup run avr-toolchain xargo build --target avr-atmega328p --release
    Updating git repository `https://github.com/avr-rust/libcore`
   Compiling core v0.1.0 (https://github.com/avr-rust/libcore?branch=rust-26015da0#ede6063b)
    Finished release [optimized] target(s) in 21.92s
error: intermittent IO error while iterating directory `/home/niklas/src/avr-rust/build/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/bin`
caused by: IO error for operation on /home/niklas/src/avr-rust/build/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/bin: No such file or directory (os error 2)
caused by: No such file or directory (os error 2)

Not sure what's going on, but there's clearly no bin directory in there:

niklas@llw ~/src/avr-rust/blink (git)-[master] % find /home/niklas/src/avr-rust/build/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/
/home/niklas/src/avr-rust/build/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/
/home/niklas/src/avr-rust/build/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib
/home/niklas/src/avr-rust/build/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_privacy-332844a755d8f78a.so
/home/niklas/src/avr-rust/build/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgraphviz-fa458b100835357c.so
...
% echo $XARGO_RUST_SRC
../rust

% echo $RUST_TARGET_PATH
/home/niklas/src/avr-rust/blink

% git rev-parse HEAD
e2053a60069536eb09f0a98e0d347b6a8ae9643a

What can I do about this?

@nh2
Copy link
Author

@nh2 nh2 commented Jul 27, 2018

And I'm on https://github.com/avr-rust/rust commit 9f8c381a275b9.

@nh2
Copy link
Author

@nh2 nh2 commented Jul 27, 2018

Got it to work:

First I switched the toolchain to the --prefix I had given (I think this doesn't really matter, just giving it to not confuse people who read this why the paths involved changed):

% rustup toolchain link avr-toolchain $HOME/opt/avr-rust                

So we see the same error:

% rustup run avr-toolchain xargo build --target avr-atmega328p --release
error: intermittent IO error while iterating directory `/home/niklas/opt/avr-rust/lib/rustlib/x86_64-unknown-linux-gnu/bin`
caused by: IO error for operation on /home/niklas/opt/avr-rust/lib/rustlib/x86_64-unknown-linux-gnu/bin: No such file or directory (os error 2)
caused by: No such file or directory (os error 2)

Just create the empty dir it wants:

% mkdir /home/niklas/opt/avr-rust/lib/rustlib/x86_64-unknown-linux-gnu/bin

New error:

% rustup run avr-toolchain xargo build --target avr-atmega328p --release
 Downloading arduino v0.1.0
   Compiling arduino v0.1.0                                                     
   Compiling blink v0.1.0 (file:///home/niklas/src/avr-rust/blink)
error: could not exec the linker `avr-gcc`: No such file or directory (os error 2)
  |
  = note: "avr-gcc" "-Os" "-mmcu=atmega328p" "-L" "/home/niklas/.xargo/lib/rustlib/avr-atmega328p/lib" "/home/niklas/src/avr-rust/blink/target/avr-atmega328p/release/deps/blink-facf8a50db6ed10f.0.o" "-o" "/home/niklas/src/avr-rust/blink/target/avr-atmega328p/release/deps/blink-facf8a50db6ed10f.elf" "-Wl,--gc-sections" "-L" "/home/niklas/src/avr-rust/blink/target/avr-atmega328p/release/deps" "-L" "/home/niklas/src/avr-rust/blink/target/release/deps" "-L" "/home/niklas/.xargo/lib/rustlib/avr-atmega328p/lib" "-Wl,-Bstatic" "/home/niklas/src/avr-rust/blink/target/avr-atmega328p/release/deps/libarduino-067d1a06a38a989a.rlib" "/home/niklas/.xargo/lib/rustlib/avr-atmega328p/lib/libcore-bb715acab4a13477.rlib" "-Wl,-Bdynamic" "-Wl,--gc-sections"

error: aborting due to previous error

error: Could not compile `blink`.

To learn more, run the command again with --verbose.

OK, looks like there's an undocumented dependency on gcc-avr:

% sudo apt install gcc-avr

Now we get:

 % rustup run avr-toolchain xargo build --target avr-atmega328p --release  
   Compiling blink v0.1.0 (file:///home/niklas/src/avr-rust/blink)
error: linking with `avr-gcc` failed: exit code: 1
  |
  = note: "avr-gcc" "-Os" "-mmcu=atmega328p" "-L" "/home/niklas/.xargo/lib/rustlib/avr-atmega328p/lib" "/home/niklas/src/avr-rust/blink/target/avr-atmega328p/release/deps/blink-facf8a50db6ed10f.0.o" "-o" "/home/niklas/src/avr-rust/blink/target/avr-atmega328p/release/deps/blink-facf8a50db6ed10f.elf" "-Wl,--gc-sections" "-L" "/home/niklas/src/avr-rust/blink/target/avr-atmega328p/release/deps" "-L" "/home/niklas/src/avr-rust/blink/target/release/deps" "-L" "/home/niklas/.xargo/lib/rustlib/avr-atmega328p/lib" "-Wl,-Bstatic" "/home/niklas/src/avr-rust/blink/target/avr-atmega328p/release/deps/libarduino-067d1a06a38a989a.rlib" "/home/niklas/.xargo/lib/rustlib/avr-atmega328p/lib/libcore-bb715acab4a13477.rlib" "-Wl,-Bdynamic" "-Wl,--gc-sections"
  = note: /usr/lib/gcc/avr/4.9.2/../../../avr/bin/ld: cannot find crtatmega328p.o: No such file or directory
          /usr/lib/gcc/avr/4.9.2/../../../avr/bin/ld: cannot find -lm
          /usr/lib/gcc/avr/4.9.2/../../../avr/bin/ld: cannot find -lc
          /usr/lib/gcc/avr/4.9.2/../../../avr/bin/ld: cannot find -latmega328p
          collect2: error: ld returned 1 exit status
          

error: aborting due to previous error

error: Could not compile `blink`.

To learn more, run the command again with --verbose.

Undeclared dependency on avr-libc:

% sudo apt install avr-libc

Now it works:

% rustup run avr-toolchain xargo build --target avr-atmega328p --release
   Compiling blink v0.1.0 (file:///home/niklas/src/avr-rust/blink)

Summary

  • Just create the bin directory it wants
  • sudo apt-get install gcc-avr avr-libc

The second should be added to the docs; what's necessary to have the first be unnecessary?

@stappersg
Copy link
Member

@stappersg stappersg commented Jan 16, 2021

@nh2 consider to close this issue, it dates from before the merge into upstream Rust as of July 2020.

@Others that can close this issue: Please do.

@nh2
Copy link
Author

@nh2 nh2 commented Jan 16, 2021

OK!

@nh2 nh2 closed this Jan 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants