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

portable-atomic dependency issue with agb 0.21.0 #777

Closed
ian612 opened this issue Oct 2, 2024 · 9 comments
Closed

portable-atomic dependency issue with agb 0.21.0 #777

ian612 opened this issue Oct 2, 2024 · 9 comments

Comments

@ian612
Copy link

ian612 commented Oct 2, 2024

When I ran cargo update after updating to agb 0.21.0, it no longet is able to run due to an issue with a dependency, portable-atomic. This happens with any version of that crate of 1.7 or higher, but does not appear when I try and use agb 0.20.5 with portable-atomic 1.6.0.
A screenshot of the error message is shown below:
image

@ian612
Copy link
Author

ian612 commented Oct 2, 2024

As a follow up, I can’t downgrade portable-atomic to 1.6 with v0.21.0 due to a requirement for the most recent once-cell crate, but when reverting that to a lower version that allows the use of portable-atomic 1.6, everything builds fine.

@gwilymk
Copy link
Contributor

gwilymk commented Oct 2, 2024

I fixed this in #774. I think we're still able to do a minor release of agb with what's currently in master so I can do one today to get this working again.

For now, you can add your own dependency on portable atomic with the fallback feature enabled and it should all be working again.

@ian612
Copy link
Author

ian612 commented Oct 2, 2024

Okay, that’ll work for me. Thanks very much for the quick response!

@gwilymk
Copy link
Contributor

gwilymk commented Oct 2, 2024

Fixed in v0.21.1 :)

@gwilymk gwilymk closed this as completed Oct 2, 2024
@phughk
Copy link

phughk commented Oct 15, 2024

Thanks for fixing this! However, I seem to still be experiencing issues ( v0.21.1, Mac Intel ). I have cloned the template directory and run cargo build, and it is failing on this dependency for a compatibility reason.

  stable-x86_64-apple-darwin unchanged - rustc 1.81.0 (eeb90cda1 2024-09-04)
   nightly-x86_64-apple-darwin updated - rustc 1.84.0-nightly (27861c429 2024-10-13) (from rustc 1.83.0-nightly (55a22d2a6 2024-10-06))

info: cleaning up downloads & tmp directories
info: self-update is disabled for this build of rustup
info: any updates to rustup will need to be fetched with your system package manager
➜  agba git:(main) ✗ cargo build
warning: profiles for the non root package will be ignored, specify profiles at the workspace root:
package:   /Users/hugh/Projects/40k-state-based/agba/Cargo.toml
workspace: /Users/hugh/Projects/40k-state-based/Cargo.toml
warning: virtual workspace defaulting to `resolver = "1"` despite one or more workspace members being on edition 2021 which implies `resolver = "2"`
note: to keep the current resolver, specify `workspace.resolver = "1"` in the workspace root's manifest
note: to use the edition 2021 resolver, specify `workspace.resolver = "2"` in the workspace root's manifest
note: for more details see https://doc.rust-lang.org/cargo/reference/resolver.html#resolver-versions
   Compiling version_check v0.9.5
   Compiling proc-macro2 v1.0.87
   Compiling unicode-ident v1.0.13
   Compiling cfg-if v1.0.0
   Compiling simd-adler32 v0.3.7
   Compiling autocfg v1.4.0
   Compiling portable-atomic v1.9.0
   Compiling adler2 v2.0.0
   Compiling miniz_oxide v0.8.0
   Compiling crc32fast v1.4.2
   Compiling ahash v0.8.11
   Compiling proc-macro-error-attr v1.0.4
   Compiling num-traits v0.2.19
   Compiling critical-section v1.1.3
   Compiling flate2 v1.0.34
   Compiling proc-macro-error v1.0.4
   Compiling quote v1.0.37
   Compiling syn v2.0.79
error: `portable_atomic_unsafe_assume_single_core` cfg (`unsafe-assume-single-core` feature) does not compatible with target that supports atomic CAS;
       see also <https://github.com/taiki-e/portable-atomic/issues/148> for troubleshooting
   --> /Users/hugh/.cargo/registry/src/index.crates.io-6f17d22bba15001f/portable-atomic-1.9.0/src/lib.rs:338:1
    |
338 | / compile_error!(
339 | |     "`portable_atomic_unsafe_assume_single_core` cfg (`unsafe-assume-single-core` feature) \
340 | |      does not compatible with target that supports atomic CAS;\n\
341 | |      see also <https://github.com/taiki-e/portable-atomic/issues/148> for troubleshooting"
342 | | );
    | |_^

   Compiling fdeflate v0.3.5
   Compiling zerocopy v0.7.35
   Compiling bitflags v1.3.2
error: could not compile `portable-atomic` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...

Any ideas how I could go about fixing this for you?

I'm guessing it's the portable-atomic dependency doing sanity checks on the unsafe feature flag and forgetting about cross-compilation.

https://docs.rs/portable-atomic/latest/portable_atomic/

@gwilymk
Copy link
Contributor

gwilymk commented Oct 15, 2024

That seems really strange... almost as if it is trying to compile agb to target your mac rather than the GBA.

Can I check that any project which includes agb also has the .cargo folder which sets the default target to be thumbv4t-none-eabi? :)

@phughk
Copy link

phughk commented Oct 15, 2024

Yes, initially I forgot to include the .cargo/config.toml file, but I have since copied it and the issue is still occuring.

I am attaching the terminal output, including files
agba-target-bug.txt

I am temporarily working around this by directly using rust-console/gba . However, this library is the absolute bomb and would love to use it :D It's very likely a system issue. I have managed to get the gba workspace working though, so this is localised to the agba workspace in my project.

@phughk
Copy link

phughk commented Oct 15, 2024

I was thinking just now it might be because I have workspaces, but the rust-console/gba based workspace does include a .cargo/config.toml with the desired target and works without declaring the target 🤔

@phughk
Copy link

phughk commented Oct 21, 2024

I'm a clown - thanks for highlighting! Turn out that since this was a workspace, then the workspace-specific .cargo/config.toml was ignored

warning: profiles for the non root package will be ignored, specify profiles at the workspace root:
package:   /Users/hugh/Projects/40k-state-based/agba/Cargo.toml
workspace: /Users/hugh/Projects/40k-state-based/Cargo.toml

The solution is to add an exclude field to the parent Cargo.toml workspace delcaration.

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