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

Compile error on Raspberry Pi Pico (target = thumbv6m-none-eabi) #2909

Open
ValouBambou opened this issue Mar 11, 2024 · 0 comments
Open

Compile error on Raspberry Pi Pico (target = thumbv6m-none-eabi) #2909

ValouBambou opened this issue Mar 11, 2024 · 0 comments

Comments

@ValouBambou
Copy link

ValouBambou commented Mar 11, 2024

Bug Report

When compiling the library in a no_std environment for a rp2040 I got the following errors:

error[E0599]: no method named `swap` found for struct `AtomicUsize` in the current scope
   --> /home/val/Coding/tracing/tracing-core/src/metadata.rs:747:19
    |
747 |         MAX_LEVEL.swap(val, Ordering::AcqRel);
    |                   ^^^^ method not found in `AtomicUsize`

error[E0599]: no method named `compare_exchange` found for struct `AtomicUsize` in the current scope
  --> /home/val/Coding/tracing/tracing-core/src/spin/once.rs:77:39
   |
77 |             status = match self.state.compare_exchange(
   |                            -----------^^^^^^^^^^^^^^^^ method not found in `AtomicUsize`

error[E0599]: no method named `compare_exchange` found for struct `AtomicPtr` in the current scope
   --> /home/val/Coding/tracing/tracing-core/src/callsite.rs:446:29
    |
446 |             match self.head.compare_exchange(
    |                   ----------^^^^^^^^^^^^^^^^ method not found in `AtomicPtr<Registration>`

error[E0599]: no method named `compare_exchange` found for struct `AtomicUsize` in the current scope
   --> /home/val/Coding/tracing/tracing-core/src/dispatch.rs:335:10
    |
334 |       if GLOBAL_INIT
    |  ________-
335 | |         .compare_exchange(
    | |         -^^^^^^^^^^^^^^^^ method not found in `AtomicUsize`
    | |_________|
    |

Version

cargo tree output with my local clone of the master branch:

tracing v0.2.0 (/home/val/Coding/tracing/tracing)
    ├── pin-project-lite v0.2.13
    ├── tracing-attributes v0.2.0 (proc-macro) (/home/val/Coding/tracing/tracing-attributes)
    │   ├── proc-macro2 v1.0.78 (*)
    │   ├── quote v1.0.35 (*)
    │   └── syn v2.0.52 (*)
    └── tracing-core v0.2.0 (/home/val/Coding/tracing/tracing-core)

Platform

The target is a microcontroller: the Raspberry Pi Pico (target = thumbv6m-none-eabi).

Description

The issue is that the core crate doesn't define swap and compare_exchange for this target. This happens because of the conditional compilation flag #[cfg(target_has_atomic = "8")] in core which failed cause the rp2040 doesn't support such atomic operations.

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

No branches or pull requests

1 participant