Open wmstack opened 2 years ago
the nm
command sets the CWD to the parent of the executable/binary for the current crate, so try instead cargo nm -- deps/app-*.o
Still says the same error message
cargo nm -- deps/app-*.o
Finished dev [unoptimized + debuginfo] target(s) in 0.00s
/home/waleed/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/llvm-nm: error: deps/app-*.o: No such file or directory
The error message is not helpful at all. It should at least put the full path it expects for the directory.
Edit: figured it out
cargo nm -- ./deps/app-2fb83299481625ce.o
Finished dev [unoptimized + debuginfo] target(s) in 0.00s
rt:
00000004 R RESET_VECTOR
00000008 T Reset
../../thumbv7m-none-eabi/debug/deps/app-2fb83299481625ce.o:
00000000 T rust_begin_unwind
It doesn't understand the wildcard. Probably because bash doesn't see the dependency, which is in a separate directory.
It also prints information that it wasn't supposed to print. It prints the information for the crate binary. Well I guess the more the better. As it currently stands, having useful information only printed with verbose is unacceptable Especially when the relatively recent book doesn't work as intended.
interesting, a glob works for me on windows. it's run as "C:\\path\\to\\target\\debug" "rust-nm" "test_cargobinutils.exe" "deps/libcfg_if-*.rlib"
(using #121 to see cwd), the glob is kept and works in rust-nm
I wonder what has changed in rust-nm
that makes this not work anymore. ping @rust-embedded/resources maybe the book needs to be updated to account for this?
I think the issue is twofold: First, @Emilgardis is right and target/thumbv7m-none-eabi/debug/
needs to be removed from the path as cargo nm
enters that directory before calling llvm-nm
.
But on the other hand, on unix, the glob is not resolved by the called command, but by the calling shell. And the shell doesn't know about that directory prefix, looks for deps/app-*.o
from the current directory, and fails to resolve the glob.
Something like this could work (on unix) but is ugly:
cargo nm -- $(cd target/thumbv7m-none-eabi/debug/ && echo deps/app-*.o)
As per the https://docs.rust-embedded.org/embedonomicon/smallest-no-std.html, I execute the following.
The binary is in fact there, but
llvm-nm
doesn't notice.I installed
llvm
and withit works, but the
cargo nm
command doesn't work.