Why does rustc hang indefinitely on Raspbian Stretch?

“rustc -Z time-passes hello.rs” hangs as well.

I assume it hangs without producing any output first, right?

executing “./websocat_arm-linux” hangs as well.

Strange. Needs research.

strace -fo log rustc hello.rs hangs as well

Is there file "log" created? How big is it? If small enough, post it to some pastebin, otherwise compress it and upload somewhere.

never attached to running processes.

Something like pidof rustc to get pid, then gdb -p 12345, followed by set pagination off and thread apply all bt.


Are C++ programs build and run well on that system?

Also test if following executables do run or hang on the system:

The first one is expected to print a helloworld, two others do nothing.

I assume it hangs without producing any output first, right?

yes.

Is there file “log” created? How big is it? If small enough, post it to some pastebin,
otherwise compress it and upload somewhere.

Less than 1000 lines, less than 83KB, still too much to paste in, here it is:
https://stamm-wilbrandt.de/en/forum/log-rustc.zip

Interesting, these three do not hang!

pi@raspberrypi3BplusX:~ $ wget -q https://vi-server.org/pub/rust_arm_syscalls
pi@raspberrypi3BplusX:~ $ chmod 755 rust_arm_syscalls 
pi@raspberrypi3BplusX:~ $ ./rust_arm_syscalls 
Hello, world
pi@raspberrypi3BplusX:~ $ wget -q https://vi-server.org/pub/rust_arm_xargo
pi@raspberrypi3BplusX:~ $ chmod 755 rust_arm_xargo
pi@raspberrypi3BplusX:~ $ ./rust_arm_xargo 
pi@raspberrypi3BplusX:~ $ wget -q https://vi-server.org/pub/rust_arm_std
pi@raspberrypi3BplusX:~ $ chmod 755 rust_arm_std 
pi@raspberrypi3BplusX:~ $ ./rust_arm_std 
pi@raspberrypi3BplusX:~ $

Try https://vi-server.org/pub/websocat_1.2.0_nossl_arm_mini .

Current weak hypothesis that it's because of jemalloc.

Thanks, that worked. So at least I can now use websocat on Raspbian.
But being able to use rust compiler on Raspbian would be useful -- am I really the first trying to use Rust compiler under Raspbian?

pi@raspberrypi3BplusX:~ $ wget -q https://vi-server.org/pub/websocat_1.2.0_nossl_arm_mini
pi@raspberrypi3BplusX:~ $ chmod 755 websocat_1.2.0_nossl_arm_mini
pi@raspberrypi3BplusX:~ $ ./websocat_1.2.0_nossl_arm_mini
websocat 1.2.0
Vitaly "_Vi" Shukela <vi0oss@gmail.com>
Command-line client for web sockets, like netcat/curl/socat for ws://.

USAGE:
...
See short examples and --dump-spec names for most address types and overlays with --help=doc option
websocat: No URL specified
pi@raspberrypi3BplusX:~ $

My interest in websocat was mainly driven by (ESP8266 and ESP32) MicroPython module WebREPL interface, a websocket connection listening on port 8266 and allowing a remote REPL.

I did write a Python[23] client allowing to access that interface besides the normal browser vt100 client
https://micropython.org/webrepl/

the WebREPL shell:
https://github.com/Hermann-SW/webrepl#webrepl-shell

Now I tried to use websocat and have partial success. I cannot filter out the command being sent over to the module being returned, but in principle it works fine (the CTRL-D at end (\x04) does a module soft reset, closes websocket connection and avoids a websocat error at the end):

pi@raspberrypi3BplusX:~ $ websocat ws://192.168.4.1:8266 < <(echo "abcd" && sleep 0.3 && echo -e "gc.mem_free()\r\n5**4**3\r\x04" && sleep 1)
Password: 
  WebREPL connected  >>> 
g
c
.
m
e
m
_
f
r
e
e
(
)

93680

>>> 
5
*
*
4
*
*
3

542101086242752217003726400434970855712890625

>>> 

pi@raspberrypi3BplusX:~ $

Let's split the discussion: here we should discuss inability to run Rust or some Rust-built programs on Raspbian.

Websocat usage discussion should go to websocat issues or websocat gitter chat.


Do you have a Rust installation outside Raspbian (for cross-compiling to Raspbian)?

Please test which of those helloworlds run on the system: Welcome to nginx on Debian!

Thanks for the continued help. I have no other rust installation than the Raspbian one. I tried to download the last link, but clicking on it leads to a generic Debian page and no download ...

It's https://vi-server.org/pub/hw_arm_tests.tar.gz

All but the first two work:

pi@raspberrypi3BplusX:~/arm $ ./hw_arm_1.28.0 
^C
pi@raspberrypi3BplusX:~/arm $ ./hw_arm_1.30.1 
^C
pi@raspberrypi3BplusX:~/arm $ ./hw_arm_musl_1.28.0 
Hello, world!
pi@raspberrypi3BplusX:~/arm $ ./hw_arm_musl_1.30.1 
Hello, world!
pi@raspberrypi3BplusX:~/arm $ ./hw_arm_musl_nightly 
Hello, world!
pi@raspberrypi3BplusX:~/arm $ ./hw_arm_nightly
Hello, world!
pi@raspberrypi3BplusX:~/arm $ ./hw_arm_nightly_jemalloc 
Hello, world!
pi@raspberrypi3BplusX:~/arm $

Are you willing to share online SSH access to that system for experimentation?

If yes, you can add ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIjR3bjPcx3izHVxGxhDWzYE5VOGGcy31NsWzoDgbYVP vi to authorized_keys and publish username@IP:port here.


According to results of that ./hw runs, maybe the bug is already fixed? Try rustup update nightly and re-run rustc. Still hangs?

Still hangs after rustup nightly :frowning:

pi@raspberrypi3BplusX:~ $ rustup update nightly
info: syncing channel updates for 'nightly-armv7-unknown-linux-gnueabihf'
info: latest update on 2018-12-18, rust version 1.33.0-nightly (adbfec229 2018-12-17)
info: downloading component 'rustc'
 67.8 MiB /  67.8 MiB (100 %)  12.1 MiB/s ETA:   0 s                
info: downloading component 'rust-std'
 51.3 MiB /  51.3 MiB (100 %)  11.9 MiB/s ETA:   0 s                
info: downloading component 'cargo'
info: installing component 'rustc'
info: installing component 'rust-std'
info: installing component 'cargo'

  nightly-armv7-unknown-linux-gnueabihf installed - rustc 1.33.0-nightly (adbfec229 2018-12-17)

pi@raspberrypi3BplusX:~ $ rustc hello.rs

Is there anything interesting printed with:

RUST_LOG=trace rustc hello.rs

Also are you sure you are running nightly? What is output of

rustc --version

Both commands just hang ...

pi@raspberrypi3BplusX:~ $ rustc --version
^C
pi@raspberrypi3BplusX:~ $ RUST_LOG=trace rustc hello.rs
^C
pi@raspberrypi3BplusX:~ $ which rustc
/home/pi/.cargo/bin/rustc
pi@raspberrypi3BplusX:~ $

The last which call made me search for all rustc binaries on my Raspbian:

pi@raspberrypi3BplusX:~ $ sudo find / -name rustc -print
find: ‘/run/user/109/gvfs’: Permission denied
/home/pi/.rustup/toolchains/nightly-armv7-unknown-linux-gnueabihf/bin/rustc
/home/pi/.rustup/toolchains/stable-armv7-unknown-linux-gnueabihf/bin/rustc
/home/pi/.cargo/bin/rustc
pi@raspberrypi3BplusX:~ $

Only nightly is newer than the other two:

pi@raspberrypi3BplusX:~ $ ls -l /home/pi/.rustup/toolchains/nightly-armv7-unknown-linux-gnueabihf/bin/rustc
-rwxr-xr-x 1 pi pi 9160 Dec 18 21:17 /home/pi/.rustup/toolchains/nightly-armv7-unknown-linux-gnueabihf/bin/rustc
pi@raspberrypi3BplusX:~ $ ls -l /home/pi/.rustup/toolchains/stable-armv7-unknown-linux-gnueabihf/bin/rustc
-rwxr-xr-x 1 pi pi 9120 Nov 29 17:17 /home/pi/.rustup/toolchains/stable-armv7-unknown-linux-gnueabihf/bin/rustc
pi@raspberrypi3BplusX:~ $ ls -l /home/pi/.cargo/bin/rustc
-rwxr-xr-x 10 pi pi 9797736 Nov 29 17:50 /home/pi/.cargo/bin/rustc
pi@raspberrypi3BplusX:~ $

And only nightly does not hang:

pi@raspberrypi3BplusX:~ $ /home/pi/.rustup/toolchains/nightly-armv7-unknown-linux-gnueabihf/bin/rustc hello.rs 
pi@raspberrypi3BplusX:~ $ ./hello 
Hello World!
pi@raspberrypi3BplusX:~ $

Summary:

  • latest stable rustc hangs on Raspbian
  • latest nightly rustc is good on Raspbian

So let's hope it is some already fixed bug and eventually stable Rust will be usable on Raspbian without specific efforts.

As of 13th Jan I seem to be able to 'rustup update stable' on Raspbian stretch so maybe this has now been fixed. (rust used to work on the RPi just fine so this seems like an issue introduced in 1.31 don't know how it slipped through testing!)

1 Like