Giter VIP home page Giter VIP logo

Comments (13)

ivmarkov avatar ivmarkov commented on June 20, 2024 1

(ping @ivmarkov, would you be able to reopen this one please? 🙏)

I'm not reopening until it is confirmed that the issue is in esp-idf-sys. Your steps to reproduce are imprecise, in that:

  • you don't mention what versions of async-io and async-executor you are trying to use.
  • i'm unsure of your ESP IDF version
  • Unclear what MCU/chip

Rather than doing back-and-forth here, please publish a mini project that reproduces the error somewhere.

from esp-idf-hal.

ivmarkov avatar ivmarkov commented on June 20, 2024 1

No, that's good enough. I'll try to build tmr.

from esp-idf-hal.

ivmarkov avatar ivmarkov commented on June 20, 2024 1

Remove "-C", "default-linker-libraries" from here.

It used to be necessary in the past (helped the linker find some intrinsics), with earlier ESP IDF SDKs, but with newer ESP IDF toolchains seems to be creating problems rather than solving ones.

Not really sure why that happens, but my guess would be that the newer cross toolchains of newer ESP IDFs contain a fake/alternative implementation of libpthread (perhaps coming from newlib itself?) which should not be there, and which collides with ESP-IDF's custom libpthread impl when the linker is told to link against the default libraries of the cross toolchain sysroot.

from esp-idf-hal.

ivmarkov avatar ivmarkov commented on June 20, 2024 1

@LinusU I've opened (and pinned) an issue here.

from esp-idf-hal.

stevefan1999-personal avatar stevefan1999-personal commented on June 20, 2024

Hmm. I changed esp-idf-hal to the latest, set ESP_IDF_VERSION to master and it worked. Closing this as a false positive, but still a weird issue nonetheless.

from esp-idf-hal.

LinusU avatar LinusU commented on June 20, 2024

I'm running into the same issue as well, but I'm trying to use smol (or specifically, async-io & async-executor) and not Tokio.

Steps to reproduce:

  1. Generate a new project cargo generate esp-rs/esp-idf-template cargo
  2. Add async-io cargo add async-executor async-io
  3. Modify main.rs to add simple usage of async
    use std::time::Duration;
    
    use async_io::Timer;
    use async_executor::LocalExecutor;
    
    fn main() {
        // It is necessary to call this function once. Otherwise some patches to the runtime
        // implemented by esp-idf-sys might not link properly. See https://github.com/esp-rs/esp-idf-template/issues/71
        esp_idf_svc::sys::link_patches();
    
        // Bind the log crate to the ESP Logging facilities
        esp_idf_svc::log::EspLogger::initialize_default();
    
        log::info!("Hello, World!");
    
        let executor = LocalExecutor::new();
    
        async_io::block_on(executor.run(async {
            loop {
                Timer::after(Duration::from_secs(5)).await;
                log::info!("Hello, loop!");
            }
        }))
    }
  4. Try to build cargo build --release
  5. Observer "multiple definition of" pthread stuff
(using `master` gives different error)

Changing to ESP_IDF_VERSION to master instead gives the following error:

error[E0425]: cannot find value `g_wifi_feature_caps` in this scope
   --> /Users/linus/.cargo/registry/src/index.crates.io-6f17d22bba15001f/esp-idf-svc-0.47.3/src/wifi.rs:498:36
    |
498 |             feature_caps: unsafe { g_wifi_feature_caps },
    |                                    ^^^^^^^^^^^^^^^^^^^ not found in this scope

For more information about this error, try `rustc --explain E0425`.
error: could not compile `esp-idf-svc` (lib) due to previous error

from esp-idf-hal.

Vollbrecht avatar Vollbrecht commented on June 20, 2024

please don't use esp-idf master branch as it is absolutely only for active development, its api is unstable and we don't make any efforts here in esp-idf-sys to have it reliable build against it.

from esp-idf-hal.

LinusU avatar LinusU commented on June 20, 2024

(ping @ivmarkov, would you be able to reopen this one please? 🙏)

from esp-idf-hal.

LinusU avatar LinusU commented on June 20, 2024

@Vollbrecht to clarify, the error and steps to reproduce happens on 5.1.1, I only included the part about master because it was suggested as a workaround

edit: I've updated my comment to hide the master stuff

from esp-idf-hal.

Vollbrecht avatar Vollbrecht commented on June 20, 2024

the latest current stable release is v5.1.2 can you test against it?

from esp-idf-hal.

ivmarkov avatar ivmarkov commented on June 20, 2024

BTW the CI of this does pass (MCU=esp32c3), and it does use what you are trying to use. ESP IDF 4.4 5.1.1

from esp-idf-hal.

LinusU avatar LinusU commented on June 20, 2024

Good points, I've uploaded a repo now: https://github.com/LinusU/esp32-pthread-issue

  • you don't mention what versions of async-io and async-executor you are trying to use.

cargo add adds the latest version, which currently is async-executor = "1.8.0" and async-io = "2.2.2"

  • i'm unsure of your ESP IDF version

I used the one from the esp-rs/esp-idf-template template, which is currently ESP_IDF_VERSION = "v5.1.1".

  • Unclear what MCU/chip

I'm building for the esp32c3.


I'm also building on macOS 14.2.1, using rustc 1.76.0-nightly (90e321d82 2023-12-02). Is there any more information/investigation I could provide?


edit: getting the same issue with ESP_IDF_VERSION = "v5.1.2"

from esp-idf-hal.

LinusU avatar LinusU commented on June 20, 2024

Thank you 🙏 🙏 removing -C default-linker-libraries worked around the issue!

from esp-idf-hal.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.