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

Dual versions of defmt causes links error when it should not #625

Closed
korken89 opened this issue Nov 10, 2021 · 5 comments
Closed

Dual versions of defmt causes links error when it should not #625

korken89 opened this issue Nov 10, 2021 · 5 comments

Comments

@korken89
Copy link

Hi all,

I'm looking to add to all the crates I maintain so it support defmt 0.2 and 0.3, but I get a links error even though the dependencies are optional.
If you do the same for cortex-m which also uses the links argument it does however work!

Something is being done in defmt which breaks optional dependencies - not sure what.
This does however block us from supporting both 0.2 and 0.3, which would allow us to do a non-breaking release of crates with 0.3 support.

Not working Cargo.toml (run in empty project):

[package]
name = "dual-defmt"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]

[dependencies.defmt02]
package = "defmt"
version = "0.2"
optional = true

[dependencies.defmt03]
package = "defmt"
version = "0.3"
optional = true

Working Cargo.toml (run in empty project):

[package]
name = "dual-defmt"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]

[dependencies.defmt02]
package = "cortex-m"
version = "0.6"
optional = true

[dependencies.defmt03]
package = "cortex-m"
version = "0.7"
optional = true
@jonas-schievink
Copy link
Contributor

Duplicate of #426, I believe

@korken89
Copy link
Author

Seems like it, that's unfortunate.
I don't want to release new major versions just due to this, but maybe there's no way around it.

@korken89
Copy link
Author

Here is the root cargo issue as well: rust-lang/cargo#5969

@korken89
Copy link
Author

Are there any issues with specifying a range of versions for defmt for libraries?
E.g.:

[dependencies.defmt]
version = ">=0.2,<0.4"
optional = true

This seems to work in my experiments in heapless, but I'm not sure if this has unintended consequences.

@Urhengulas
Copy link
Member

Hi @korken89, let's move the discussion to #426, in order to scatter it not too much.

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

3 participants