superlistapp / super_native_extensions

Native drag & drop, clipboard access and context menu.
MIT License
439 stars 71 forks source link

Cargo.lock does not exist, unable to build with the standard library #411

Closed adil192 closed 1 month ago

adil192 commented 1 month ago

My GitHub Actions builds have all failed with my latest release with this error on Linux...

SEVERE: error: "/home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/Cargo.lock" does not exist, unable to build with the standard library, try:
Building Linux application...                                   
Build process failed

...and the same error on Windows etc...

 Building Windows application...                                 
SEVERE : error : "C:\\Users\\runneradmin\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\src\\rust\\Cargo.lock" does not exist, unable to build with the standard library, try: [D:\a\saber\saber\build\windows\x64\plugins\super_native_extensions\super_native_extensions_plugin_cargokit.vcxproj]
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(254,5): error MSB8066: Custom build for 'D:\a\saber\saber\build\windows\x64\CMakeFiles\753c5a6fc6a9aa64913409566fbbe02e\super_native_extensions.dll.rule;D:\a\saber\saber\build\windows\x64\CMakeFiles\6748cfff885984f0679d05afbe385d79\super_native_extensions_plugin_cargokit.rule' exited with code -1. [D:\a\saber\saber\build\windows\x64\plugins\super_native_extensions\super_native_extensions_plugin_cargokit.vcxproj]
Building Windows application...                                   274.1s
Build process failed.

Maybe this is just an issue with the latest rust nightly, since the build succeeds on my local machine

Update: The build fails on my local machine after running rustup update which updated rustc from 2024-02-04 to 2024-07-21 (stable) and 2024-08-07 (nightly)

  super_clipboard:
    dependency: "direct main"
    description:
      name: super_clipboard
      sha256: c72d2ae8c3a66b20a104523add86b7c2813b1d4cced893a9764b84fb97ac8e2a
      url: "https://pub.dev"
    source: hosted
    version: "0.8.18"
  super_native_extensions:
    dependency: transitive
    description:
      name: super_native_extensions
      sha256: b03f19e54744b65940a7c2cb4f93abd4819b5355aa3464d7b3c9a013b6b76db1
      url: "https://pub.dev"
    source: hosted
    version: "0.8.18"
ahann@katana:~/Documents/GitHub/saber$ flutter doctor -v
[✓] Flutter (Channel stable, 3.24.0, on Fedora Linux 40 (Workstation Edition) 6.9.12-200.fc40.x86_64, locale en_GB.UTF-8)
    • Flutter version 3.24.0 on channel stable at /home/ahann/Documents/Sources/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 80c2e84975 (8 days ago), 2024-07-30 23:06:49 +0700
    • Engine revision b8800d88be
    • Dart version 3.5.0
    • DevTools version 2.37.2

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /home/ahann/Android/Sdk
    • Platform android-34, build-tools 34.0.0
    • Java binary at: /home/ahann/.local/share/JetBrains/Toolbox/apps/android-studio/jbr/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.10+0-17.0.10b1087.21-11609105)
    • All Android licenses accepted.

[✓] Chrome - develop for the web
    • Chrome at google-chrome

[✓] Linux toolchain - develop for Linux desktop
    • clang version 18.1.6 (Fedora 18.1.6-3.fc40)
    • cmake version 3.28.2
    • ninja version 1.12.1
    • pkg-config version 2.1.1

[✓] Android Studio (version 2024.1)
    • Android Studio at /home/ahann/.local/share/JetBrains/Toolbox/apps/android-studio
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.10+0-17.0.10b1087.21-11609105)

[✓] VS Code (version 1.92.0)
    • VS Code at /usr/share/code
    • Flutter extension version 3.94.0

[✓] Connected device (2 available)
    • Linux (desktop) • linux  • linux-x64      • Fedora Linux 40 (Workstation Edition) 6.9.12-200.fc40.x86_64
    • Chrome (web)    • chrome • web-javascript • Google Chrome 127.0.6533.99

[✓] Network resources
    • All expected network resources are available.

• No issues found!
ahann@katana:~$ rustup show -v
Default host: x86_64-unknown-linux-gnu
rustup home:  /home/ahann/.rustup

installed toolchains
--------------------

stable-x86_64-unknown-linux-gnu (default)
rustc 1.80.0 (051478957 2024-07-21)

nightly-x86_64-unknown-linux-gnu
rustc 1.82.0-nightly (8b3870784 2024-08-07)

installed targets for active toolchain
--------------------------------------

aarch64-linux-android
armv7-linux-androideabi
i686-linux-android
x86_64-linux-android
x86_64-unknown-linux-gnu

active toolchain
----------------

stable-x86_64-unknown-linux-gnu (default)
rustc 1.80.0 (051478957 2024-07-21)
Adam-Langley commented 1 month ago

Yep - I've been looking into this for the last hour. @adil192 I suspect you are correct that this has been introduced by a change in a dependency, rather than this library - not to say that it doesnt need to be fixed in this library however.

I rebuilt a previously successful snapshot of my code - the previously successful one now fails. The version of super_native_extensions does not change between the two - lending weight to it being a change in a dependency.

image

And here you see the error in today's build of the previously successful code

image
adil192 commented 1 month ago

Even though my active toolchain in rustup show is stable-x86_64-unknown-linux-gnu, the error message still shows nightly-x86_64-unknown-linux-gnu. Does this mean it's building with nightly instead of stable, and if so, can I make it use stable?

Adam-Langley commented 1 month ago

@adil192 - yep - sounds like it to me.

Looks like your failing build is running under user account "runneradmin", is that the user account you used to run rustup?

(BTW I've never done anything with Rust before... so I'm just applying some common sense in the hopes it helps - all while I'm trying to blindly solve my failing build in Azure Pipelines)

knopp commented 1 month ago

Looks like the latest nightly rust-src component is broken :-/.

Adam-Langley commented 1 month ago

For anyone else coming across this thread, who is using CI such as Azure Pipelines...

The super_native_extensions package will download pre-built Rust binaries during build - hard-coded to use the nightly channel.

I've worked around this issue in Azure Pipelines by forking the tag super_native_extensions-v0.8.18 to change its dependency on the nightly channel, to the stable channel. I've confirmed all my builds on iOS/Android/Windows/MacOS now succeed.

https://github.com/Adam-Langley/super_native_extensions/tree/defect/should-depend-on-rust-stable

You can use it in your Flutter projects by overriding the dependency:

  # temporary workaround for https://github.com/superlistapp/super_native_extensions/issues/411
  super_native_extensions:
    git:
      url: https://github.com/Adam-Langley/super_native_extensions.git
      path: super_native_extensions/
      ref: defect/should-depend-on-rust-stable
knopp commented 1 month ago

Note, 0.8.19 has been published earlier today.

Adam-Langley commented 1 month ago

Thank you @knopp - great work on a fast turnaround.

Do you know whether this change in Rust is a bug, or intended breaking behavior? Concern being - if the latter, this will break again when the change is mainstreamed to stable unless there are plans for super_native_extensions to adapt before then.

Interestingly, I see in the Rust docs, they recommend any dependent CI build stable, and a future release channel (beta?) to catch breaking changes with enough time to rectify.

Thanks again

knopp commented 1 month ago

This is definitely a Rust bug. Super_native_extensions used rust nightly to produce release build since it can achieve slightly smaller binaries when rebuilding the standard library with panic=abort (that requires a nightly flag), unfortunately Rust nightly is too problematic to rely on by default.

Adam-Langley commented 1 month ago

Thanks @knopp

For anyone else who has cloned my fork - I'll leave it up for another day or so before deleting it. The latest release (0.8.19) fixes the issue.