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

could not compile irondash_engine_context_native #182

Closed
BabkenM opened this issue Aug 30, 2023 · 11 comments
Closed

could not compile irondash_engine_context_native #182

BabkenM opened this issue Aug 30, 2023 · 11 comments

Comments

@BabkenM
Copy link

BabkenM commented Aug 30, 2023

Hi!
First want to say thank you for this kind of amazing work, it's very cool package.

I'm having issues with the latest version super_context_menu: 0.6.4.

I'm getting this error when I try to run the app:

Build tool failed:
Command "rustup" "run" "stable" "cargo" "build" "--manifest-path" "C:\\Users\\~~~\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dev\\irondash_engine_context-0.3.1\\android\\rust\\Cargo.toml" "-p" "irondash_engine_context_native" "--target" "aarch64-linux-android" "--target-dir" "C:\\work\\mobile-app\\build\\irondash_engine_context/build" failed with error exit code: 101;
stderr:    Compiling irondash_engine_context_native v0.1.0 (C:\Users\~~~\AppData\Local\Pub\Cache\hosted\pub.dev\irondash_engine_context-0.3.1\android\rust)
error: linking with `\\?\C:\~app_folder~\build\irondash_engine_context\build\rust_tool\debug\build_tool.exe` failed: exit code: 1
  |
  = note: "\\\\?\\C:\\~app_folder~\\build\\irondash_engine_context\\build\\rust_tool\\debug\\build_tool.exe" "-Wl,--version-script=C:\\Users\\~~~\\AppData\\Local\\Temp\\rustcqvWfxc\\list" "-Wl,--no-undefined-version" "C:\\Users\\~~~\\AppData\\Local\\Temp\\rustcqvWfxc\\symbols.o" "C:\\~app_folder~\\build\\irondash_engine_context/build\\aarch64-linux-android\\debug\\deps\\irondash_engine_context_native.10dle1qxpuz1n3rh.rcgu.o" "C:\\~app_folder~\\build\\irondash_engine_context/build\\aarch64-linux-android\\debug\\deps\\irondash_engine_context_native.4bv5cjdu91khojgx.rcgu.o" "-Wl,--as-needed" "-L" "C:\\~app_folder~\\build\\irondash_engine_context/build\\aarch64-linux-android\\debug\\deps" "-L" "C:\\~app_folder~\\build\\irondash_engine_context/build\\debug\\deps" "-L" "C:\\~app_folder~\\build\\irondash_engine_context/build\\cargokit\\libgcc_workaround\\25" "-L" "C:\\Users\\~~~\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\aarch64-linux-android\\lib" "-Wl,-Bdynamic" "-landroid" "-Wl,-Bstatic" "C:\\Users\\~~~\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\aarch64-linux-android\\lib\\librustc_std_workspace_core-7fd3e5a1e0a1728c.rlib" "C:\\Users\\~~~\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\aarch64-linux-android\\lib\\libcore-396956692ff58b23.rlib" "C:\\Users\\~~~\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\aarch64-linux-android\\lib\\libcompiler_builtins-1b2781e14baef833.rlib" "-Wl,-Bdynamic" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "C:\\Users\\~~~\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\aarch64-linux-android\\lib" "-o" "C:\\~app_folder~\\build\\irondash_engine_context/build\\aarch64-linux-android\\debug\\deps\\libirondash_engine_context_native.so" "-Wl,--gc-sections" "-shared" "-Wl,-z,relro,-z,now" "-nodefaultlibs"
  = note: ld: error: cannot open crtbegin_so.o: No such file or directory
          ld: error: unable to find library -landroid
          ld: error: cannot open crtend_so.o: No such file or directory
          clang: error: linker command failed with exit code 1 (use -v to see invocation)


error: could not compile `irondash_engine_context_native` (lib) due to previous error

stdout: 

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------
* Where:
Script 'C:\Users\babken.muradkhanyan\AppData\Local\Pub\Cache\hosted\pub.dev\irondash_engine_context-0.3.1\cargokit\gradle\plugin.gradle' line: 57

* What went wrong:
Execution failed for task ':irondash_engine_context:cargokitCargoBuildIrondash_engine_context_nativeDebug'.
> Process 'command 'C:\Users\~~~\AppData\Local\Pub\Cache\hosted\pub.dev\irondash_engine_context-0.3.1\cargokit\gradle\..\run_rust_tool.cmd'' finished with non-zero exit value 1

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
==============================================================================

2: Task failed with an exception.
-----------
* What went wrong:
java.lang.StackOverflowError (no error message)

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
==============================================================================

* Get more help at https://help.gradle.org

BUILD FAILED in 56s
Exception: Gradle task assembleDebug failed with exit code 1

this is flutter doctor --verbose:

[√] Flutter (Channel stable, 3.13.1, on Microsoft Windows [Version 10.0.22621.2215], locale en-US)
    • Flutter version 3.13.1 on channel stable at C:\src\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision e1e47221e8 (7 days ago), 2023-08-22 21:43:18 -0700
    • Engine revision b20183e040
    • Dart version 3.1.0
    • DevTools version 2.25.0

[√] Windows Version (Installed version of Windows is version 10 or higher)

[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at C:\Users\babken.muradkhanyan\AppData\Local\Android\sdk
    • Platform android-34, build-tools 34.0.0
    • Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-b2043.56-9586694)
    • All Android licenses accepted.

    • Java version OpenJDK Runtime Environment (build 17.0.6+0-b2043.56-9586694)

[√] VS Code, 64-bit edition (version 1.55.2)
    • VS Code at C:\Program Files\Microsoft VS Code
    • Flutter extension can be installed from:
       https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[√] Connected device (4 available)
    • SM A736B (mobile) • R5CT72KVD0E • android-arm64  • Android 13 (API 33)
    • Windows (desktop) • windows     • windows-x64    • Microsoft Windows [Version 10.0.22621.2215]
    • Chrome (web)      • chrome      • web-javascript • Google Chrome 116.0.5845.111
    • Edge (web)        • edge        • web-javascript • Microsoft Edge 116.0.1938.62

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

I also tried to run the rust command in separately and got this error:

command:
rustup run stable cargo build --manifest-path C:\\Users\\~~~\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dev\\irondash_engine_context-0.3.1\\android\\rust\\Cargo.toml -p irondash_engine_context_native --target aarch64-linux-android --target-dir C:\\~app_folder~\\build\\irondash_engine_context/build

error message:

error: linker `cc` not found
  |
  = note: program not found

error: could not compile `irondash_engine_context_native` (lib) due to previous error

I think it's related to new rust version because previous package versions also giving the same error with latest rust version.

@knopp
Copy link
Collaborator

knopp commented Aug 30, 2023

Can you look inside C:\Users\babken.muradkhanyan\AppData\Local\Android\sdk\ndk and tell me which NDK version do you have installed?

@BabkenM
Copy link
Author

BabkenM commented Aug 30, 2023

Thank you for quick response.
my NDK version is 25.1.8937393

@knopp
Copy link
Collaborator

knopp commented Aug 30, 2023

Maybe also cargo --version? I'll try to reproduce this. The error is really strange - looks like a NDK linker to being able to produce static library.

@BabkenM
Copy link
Author

BabkenM commented Aug 30, 2023

sure
cargo 1.72.0 (103a7ff2e 2023-08-15)

@BabkenM
Copy link
Author

BabkenM commented Aug 30, 2023

also rustup version
rustup 1.26.0 (5af9b9484 2023-04-05)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active rustc version is rustc 1.72.0 (5680fa18f 2023-08-23)

@knopp
Copy link
Collaborator

knopp commented Aug 30, 2023

One more thing - what is your minSdkVersion? It is declared inside android/app/build.gradle.

@BabkenM
Copy link
Author

BabkenM commented Aug 30, 2023

minSdkVersion 25

@knopp
Copy link
Collaborator

knopp commented Aug 30, 2023

I think that is the problem. For some reason the libraries for minSdkVersion 25 are missing from the NDK. I have no idea why that is but you can confirm that by looking into

ndk/25.1.8937393/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/lib

There are directories for each supported SDK version but 25 is missing. Can you try 24 or 26?

@knopp
Copy link
Collaborator

knopp commented Aug 30, 2023

I think it might be that there are no changes in public API between api level 24 and 25 and thus 25 was skipped.

@BabkenM
Copy link
Author

BabkenM commented Aug 30, 2023

yes you are right
I changed minSdkVersion 25 to minSdkVersion 26 and it's worked.
Thank you very much.
So I can close the issue as resolved

@knopp
Copy link
Collaborator

knopp commented Aug 30, 2023

Closing here but noting that this should be handled better in Cargokit: irondash/cargokit#13

@knopp knopp closed this as completed Aug 30, 2023
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

2 participants