-
-
Notifications
You must be signed in to change notification settings - Fork 75
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
defmt crate doesn't compile on macOS #336
Comments
@BriocheBerlin could you test this on macOS? I'd like to figure out if $ cargo new --bin hello
$ cd hello
$ # or manually add 'defmt = "0.1.3"' to Cargo.toml
$ cargo add defmt
$ # does this succeed?
$ cargo run |
|
@BriocheBerlin could you run |
So it seems that in the working version on the |
hmm, maybe the macOS issue was introduced recently so it's in the git version but not on crates.io? $ cargo new --bin hello
$ cd hello
$ # or add 'defmt = { git = "https://github.com/knurling-rs/defmt" }' to Cargo.toml dependencies
$ cargo add defmt --git https://github.com/knurling-rs/defmt
$ # does this succeed?
$ cargo run $ git clone https://github.com/knurling-rs/defmt
$ cd defmt
$ git checkout defmt-v0.1.3
$ # do these produce the llvm error?
$ cargo build
$ cargo test |
But of course there is no master anymore. |
oh, yes. my bad it should be defmt = { git = "https://github.com/knurling-rs/defmt", branch = "main" } in the Cargo.toml |
Ah, doesn't work. So (besides different src/lib.rs files) the resulting commands are slightly different.
With |
Then this more serious: as things are I'll put this on the list of blockers for 0.2.0. cc @jonas-schievink |
The invalid section names were already used in defmt 0.1 though? Or is there another error? |
I think this may have been caused by PR #291 . After the changes in the macros we emit |
That would explain why in the working |
The last commit where |
we looked into this. the llvm error can be fixed by changing the linker section names we use. |
for starters this proc-macro needs to be changed (but probably others also need to be changed to work on macOS): Line 987 in eb8c3b1
|
we should also build and run the following std program on linux, macos and windows to shake out any other linker section name related bugs: // Cargo.toml uses defmt via a path dependency
fn main() {
defmt::info!("hello");
}
#[defmt::global_logger]
struct Logger;
unsafe impl defmt::Logger for Logger {
fn acquire() -> Option<core::ptr::NonNull<dyn defmt::Write>> {
None
}
unsafe fn release(writer: core::ptr::NonNull<dyn defmt::Write>) {}
}
defmt::timestamp!("{=u32}", 0); |
363: add a test for #336 r=jonas-schievink a=spookyvision make sure basic usage builds & links, as suggested [here](#336 (comment)) Co-authored-by: Anatol Ulrich <anatol.ulrich@ferrous-systems.com>
This issue seems resolved, right? |
Yup! |
Updated description:
defmt 0.1.3 compiles on macOS but the git version (0.2.0) doesn't
repro:
When trying to get started to write compile fail tests , running
$ cargo test --test ui
didn't work for me using a mac. I'd always get this unhelpful error:
Passing more flags like this did help:
$ cargo test -p defmt --all-features --test ui
This makes sense when looking at ci.yml
The text was updated successfully, but these errors were encountered: