Skip to content

error: Undefined temporary symbol .LBB11_19 when compiling rustls #253

@nbc12

Description

@nbc12

I'm trying to get an FTPS client working on an esp32. I have to use TLS/SSL for my application.
I'm compiling it for xtensa for the regular esp32-wroom-32. I'm using Ubuntu on WSL on x86-64, and I just installed the esp-rs/rust compiler yesterday.
I'm using the suppaftp crate because it supports rustls so it is a great fit for the esp32.

If you just try and build the suppaftp crate, it gives a few errors. This is because the ring crate says:
error[E0277]: the trait bound SystemRandom: ring::rand::SecureRandom is not satisfied
You can fix this with a feature flag in the ring crate: less-safe-getrandom-espidf.
I cloned the suppaftp and rustls crates locally and enabled the feature in rustls's Cargo.toml.
Note that for some reason I also had to clone ring locally, I'm not entirely sure why.
This fixes all the compile errors.

Then, running cargo build again, rustc gives an error:

   Compiling rustls v0.23.22 (/home/noah/esp-rs-repro/deps/rustls/rustls)
   Compiling esp-rs-repro v0.1.0 (/home/noah/esp-rs-repro)
   Compiling suppaftp v6.0.7 (/home/noah/esp-rs-repro/deps/suppaftp/suppaftp)
error: Undefined temporary symbol .LBB11_19

error: could not compile `rustls` (lib) due to 1 previous error

This was run with opt-level = "z".

The build supposedly suceeds on opt level 0, but every other level it errors out.
I haven't verified if the program actually works as intended on opt level 0 as I do not have access to the network with the FTP server at the moment, but it doesn't give any errors.

For opt level 2 and 3, it gives two:

error: Undefined temporary symbol .LBB6_29
error: Undefined temporary symbol .LBB6_1

This bug occurs when compiling an empty main function.

suppaftp imports rustls like this: rustls-crate = { package = "rustls", version = "^0.23", default-features = false, features = ["logging", "ring", "std", "tls12"], optional = true }
However if the bin crate imports rustls using the same line, the problem is not present, so it's something about the combination of rustls and suppaftp that causes the bug to occur.

Minimum reproduction

Admittedly I'm out of my depth here, so I don't know how to minimize this more.

Reproduction:
I have uploaded my crate to github here, though I don't know enough about git to make my changes to the dependencies persist in my commit.
https://github.com/nbc12/esp-rs-repro

Because of this, I think you're better off reproducing it by doing these steps:

  1. Create a new esp-idf template using cargo generate esp-rs/esp-idf-template cargo. (The esp-rs rust book talks about this in detail if you need.) Select the esp32 target. Do not configure advanced template options.
  2. In the root of the new bin crate:
mkdir deps
git clone https://github.com/rustls/rustls.git deps/rustls
git clone https://github.com/briansmith/ring.git deps/ring
git clone https://github.com/veeso/suppaftp.git deps/suppaftp
  1. in deps/rustls/Cargo.toml, replace ring with this line: ring = { path = "../ring", features = ["less-safe-getrandom-espidf"]}
  2. in deps/suppaftp/suppaftp/Cargo.toml, replace rustls-crate with this line: rustls-crate = { package = "rustls", path="../../rustls/rustls", default-features = false, features = ["logging", "ring", "std", "tls12"], optional = true }
  3. in ./Cargo.toml, add suppaftp = { path = "./deps/suppaftp/suppaftp", features = ["rustls"] }
  4. cargo build

Output:

...
   Compiling futures-lite v2.6.0
   Compiling aho-corasick v1.1.3
   Compiling chrono v0.4.39
warning: use of deprecated macro `prefixed_export`: `#[export_name]` creates problems and we will stop doing it.
   --> deps/ring/src/arithmetic/montgomery.rs:191:1
    |
191 | prefixed_export! {
    | ^^^^^^^^^^^^^^^
    |
    = note: `#[warn(deprecated)]` on by default

   Compiling regex-automata v0.4.9
   Compiling rustls-webpki v0.102.8
warning: `ring` (lib) generated 1 warning
   Compiling regex v1.11.1
   Compiling lazy-regex v3.4.1
   Compiling suppaftp v6.0.7 (/home/noah/asdf/deps/suppaftp/suppaftp)
error: Undefined temporary symbol .LBB11_19

error: could not compile `rustls` (lib) due to 1 previous error

esp-idf-sys takes forever to do a clean build, just wait for it.

Setting RUSTC_BACKTRACE=1 does not change the output.

Output of rustc --version --verbose:

rustc 1.84.0-nightly (b0bd11bcc 2025-01-10) (1.84.0.0)
binary: rustc
commit-hash: b0bd11bcc4e5baf48a4fa8660e360e4a8248966b
commit-date: 2025-01-10
host: x86_64-unknown-linux-gnu
release: 1.84.0-nightly
LLVM version: 18.1.2

I also tried compiling to x86-64, and it worked just fine. So it seems to be the xtensa backend.

I'd love to help fix this if I can, I just have no idea where to start.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions