Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use of embassy primitives fails with linking errors to missing embassy symbols #417

Closed
cdaringe opened this issue Apr 19, 2024 · 2 comments

Comments

@cdaringe
Copy link

Problem statement

Attempting to build with an embassy-executor & timing tasks fails with missing symbols.

Research

cargo run yields:

= note: [ldproxy] Running ldproxy
          Error: Linker /home/cdaringe/src/gimbal-motion/.embuild/espressif/tools/xtensa-esp32s3-elf/esp-12.2.0_20230208/xtensa-esp32s3-elf/bin/xtensa-esp32s3-elf-gcc failed: exit status: 1
          STDERR OUTPUT:
          /home/cdaringe/src/gimbal-motion/.embuild/espressif/tools/xtensa-esp32s3-elf/esp-12.2.0_20230208/xtensa-esp32s3-elf/bin/../lib/gcc/xtensa-esp32s3-elf/12.2.0/../../../../xtensa-esp32s3-elf/bin/ld: /home/cdaringe/src/gimbal-motion/target/xtensa-esp32s3-espidf/debug/deps/libembassy_executor-8ab9f3880deba396.rlib(embassy_executor-8ab9f3880deba396.embassy_executor.739ad4c05c33a474-cgu.0.rcgu.o):(.literal._ZN16embassy_executor3raw12SyncExecutor5spawn17h150b9fb71c094c9bE+0x0): undefined reference to `__pender'
          /home/cdaringe/src/gimbal-motion/.embuild/espressif/tools/xtensa-esp32s3-elf/esp-12.2.0_20230208/xtensa-esp32s3-elf/bin/../lib/gcc/xtensa-esp32s3-elf/12.2.0/../../../../xtensa-esp32s3-elf/bin/ld: /home/cdaringe/src/gimbal-motion/target/xtensa-esp32s3-espidf/debug/deps/libembassy_time_queue_driver-0e1460ccf284f7bb.rlib(embassy_time_queue_driver-0e1460ccf284f7bb.embassy_time_queue_driver.d97ccd9d01cbeca7-cgu.0.rcgu.o):(.literal._ZN25embassy_time_queue_driver13schedule_wake17hd48deb6fcbe97cc1E+0x0): undefined reference to `_embassy_time_schedule_wake'
          collect2: error: ld returned 1 exit status
          collect2: error: ld returned 1 exit status
          
          Stack backtrace:
             0: anyhow::error::<impl anyhow::Error>::msg
             1: ldproxy::main
             2: std::sys_common::backtrace::__rust_begin_short_backtrace
             3: std::rt::lang_start::{{closure}}
            ...snip
            16: _start
          
  = note: some `extern` functions couldn't be found; some native libraries may need to be installed or have their path specified

Key observations:

  • undefined reference to __pender`
  • undefined reference to _embassy_time_schedule_wake'`
  • cargo.toml
  • main.rs
@ivmarkov
Copy link
Collaborator

  • Enable the arch-std feature of embassy-executor
  • Enable the generic-queue feature of embassy-time

@github-project-automation github-project-automation bot moved this from Todo to Done in esp-rs Apr 19, 2024
@ivmarkov
Copy link
Collaborator

Update: generic-queue might not be necessary, as you are using embassy-executor after all, which has its own timer queue. Try first without it.

With that said, I find using embassy-executor in a STD environment a bit controversial, as the code underneath your app does have support for the alloc crate and is using heap allocs a lot anyway. Perhaps you are better off with async-executor or edge-executor. But that's just my opinion. In that case though you DO need generic-queue as embassy-executor and its embedded timer queue will not be around.

Also cannot recall right now if embassy-executor did allow the instantiation of multiple "thread-mode" executors. If it doesn't (easily) it would be a pitty to pass on the option to have multiple (thread-local) executors, each with its own priority, which is very easy with async-executor and edge-executor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

2 participants