Issue with `undefined reference to .L`
lexxvir opened this issue · 5 comments
Hi @MabezDev,
Thank you for your effort to bring xtensa arch to Rust!
I am in process to port our bare-metal SW written in Rust+C mix from Cortex-M device to ESP32.
Currently I able to blink by LED on the board :)
Now I trying to output some text (&str
) into UART. I encountered to following error on linking:
target/xtensa-none-elf/release/deps/esp32_hello-53491af6071c1b49.esp32_hello.wtaa4xj7-cgu.0.rcgu.o:(.literal._ZN11esp32_hello10rust_blink17he8ce6b3bf0257d54E+0x8): undefined reference to `.L'
collect2: error: ld returned 1 exit status
But, I fixed it (occasionally) by adding "-C", "save-temps"
to rustflags
table in .cargo/config
.
So, I think it will be useful, if you add comment about such trick somewhere in Readme file.
Thanks! I haven't personally run into this issue but I'll add it to the FAQ asap.
Currently I able to blink by LED on the board :)
Do you mean you have an ESP32 blinking with Rust?
I use bindings to ESP-IDF that do all work. I've upload my project to github: https://github.com/lexxvir/esp32-hello
That's awesome thanks for sharing! I haven't had the time to test whether my custom rustc actually built proper xtensa binaries, glad to see it's working for you! If you don't mind, I'd like to link your project in the readme too?
Also if you are interested, in the next few weeks when my workload dies down a bit I will be starting work on proper runtime crates https://github.com/esp-rs . I had the same idea of using the IDF intially for the runtime and building the rust application on top. It would be cool if we could work together on this :).
Yes, link please my repo. I think ESP required significant efforts to be usable in Rust (as Cortex-M is). So if people see that there is quickstart (template) project, it can help to attract attention to development.
My plan is to write shims/wrappers around ESP-IDF, because I need to port existed SW from Cortex-M device ASAP. I think writing runtime/foundation crates in pure Rust from scratch is too complicated task for me.
So we can join efforts to write wrappers around ESP-IDF.
I've investigated it slightly further, it seems enough --emit llvm-bc,link
to workaround this issue. -C save-temps
annoyed with "warning: -C save-temps
might not produce all requested temporary products when incremental compilation is enabled.". Also see https://github.com/espressif/llvm-xtensa/issues/4.