#Android Compilation Issues

68 messages · Page 1 of 1 (latest)

last linden
#

I've tried compiling just an empty Tauri project from scratch on two different workstations (Fedora 38 and Gentoo), and both have produced the exact same results.

When I run pnpm tauri android dev I get:

note: ld: error: --fix-cortex-a53-843419 is only supported on AArch64 targets
clang-14: error: linker command failed with exit code 1 (use -v to see invocation)

I get this even while setting builds strictly for aarch64, and also compiling for other targets.

A list of things I've tried:

  • different Java versions
  • using Android studio and setting up manually
  • manually tried removing all targets (except Arm64) from tauri-mobile's Targets::all()/everywhere else they were defined
  • targeting both higher/lower Android SDK versions
  • manually passing --mno-fix-cortex-a53-843419
  • compiling everything from git (next branches)/with git patches, to ensure I had the latest commits applied (this also involved cloning & instructing tauri-cli to use the local, latest version of the tauri-mobile repo)
  • different NDK versions

Here's a list of all NDK versions I've tried:

25.2.9519653
25.0.8775105
23.2.8568313
22.1.7171670 (failed due to missing libunwind)

The output of pnpm tauri info (API is 2.0.0-alpha.0, had to remove it otherwise pnpm tauri info panics):

Environment
  › OS: Fedora 38.0.0 X64
  › Node.js: 19.7.0
  › npm: 9.5.0
  › pnpm: 7.29.1
  › yarn: Not installed!
  › rustup: 1.25.2
  › rustc: 1.68.0
  › cargo: 1.68.0
  › Rust toolchain: stable-x86_64-unknown-linux-gnu 

Packages
  › @tauri-apps/cli [NPM]: 2.0.0-alpha.2
  › @tauri-apps/api [NPM]: Not installed!
  › tauri [RUST]: 2.0.0-alpha.3,
  › tauri-build [RUST]: 2.0.0-alpha.1,
  › tao [RUST]: 0.17.0,
  › wry [RUST]: 0.26.0,

App
  › build-type: bundle
  › CSP: unset
  › distDir: ../dist
  › devPath: http://localhost:1420/
  › framework: React
  › bundler: Vite

App directory structure
  ├─ src-tauri
  ├─ .vscode
  ├─ src
  ├─ public
  ├─ node_modules
  └─ dist
#

Is it worth adding this to Github issues? I have tried every possible avenue to find something similar, and the closest I've gotten was someone mentioning that it happens with Android NDKs > 23. (https://github.com/termux/termux-packages/pull/6174 and a few others)

I originally assumed it was something to do with my development environment but now I'm almost certain it's not.

Sources/docs I followed:

next rampart
#

Start by just using Android Studio and create a Hello World app (not Tauri, just basic Android app). Once you verify that runs it makes it much easier to debug Tauri specific issues

#

If you cant get a Hello World Android app to run it means you need to fix your Android SDK and environment variables, and that's easier to find help for elsewhere

last linden
#

thank you! i'm currently using the manual, more minimal install but i'll move over to AS because the easier emulation would be nice too. will report back once i know what's up :)

last linden
#

^a basic android app runs fine in the emulator via android studio

#

which only adds to the mystery

last linden
#

it also appears to install on my physical device, when using wireless debugging via android studio and pnpm tauri android dev (after manually telling it where to run)

#

still, pnpm tauri android build fails with note: ld: error: --fix-cortex-a53-843419 is only supported on AArch64 targets

#

seems to be with NDK versions > 23, i was reading through the termux PR above and it's unclear how they resolved it sadly

last linden
#

nevermind, it seemed to only work once for armv7 and then fails to build completely now. very odd

bright hare
#

I've been having trouble with Android builds as well. I don't think the same issue but sounds similar

#

Following the thread

last linden
#

getting rustc -Cllvm-args="..." with: Did you mean '--mv67t=cortex-a72'? a lot too when attempting to deploy to a device via android studio. a lot of oddities for sure

#

may be ndk-version related as i've been trying many out

last linden
#

okay, the app worked via android studio beforehand because i'd built it solely using android studio, without tauri-cli running also it (there was no content, it was just a blank APK)

with tauri-cli invoking android studio, and running in the background while attempting to deploy to my device, the console spits out Error WS transport error: i/o error: Transport endpoint is not connected (os error 107); terminate connection: 0, but i assume that's because the build failed (--fix-cortex-a53-843419 is only supported on AArch64 targets strikes again)

#

given this is reproducible across multiple linux distros, multiple NDK versions/configurations/etc, multiple apps, multiple clang versions, etc - i think it's something to do with either llvm or the way the project is being set up. i'm not experienced enough with android building/cross compilation to say for sure though

next rampart
#

Here's a list of everything I have installed on my computer (Windows 11) via the sdkmanager (sdkmanager --list_installed). Might provide you with some hints as to what versions of e.g. the SDK and NDK should work for you

You are developing on 2 systems that are (afaik) not that common among the working group, so it's quite possible you're experiencing issues we have yet to encounter, not sure

It is also possible that your Rust / system dependencies are messed up a bit. Did you install Rust using Rustup? On Mac I know we've had sooo many issues fixed by just telling people to stop using Brew

last linden
# next rampart Here's a list of everything I have installed on my computer (Windows 11) via the...

thank you! i'll install these one-by-one and hopefully we can isolate which solves the issue (if any). i'm missing quite a few in comparison i believe

my gentoo environment was configured via the package manager's rust, but i also used rustup (linked to the system dir) in order to install ARM android targets and such. the path is configured correctly and i think it's entirely using rustup-provided binaries tbh

my fedora install was configured entirely with rustup, although i'm using fnm for node management as tauri-cli doesn't seem to like fedora 38's new node naming scheme (the binary is node-18, but the pattern matching expects node or node18 iirc)

i'll keep this thread updated and hopefully we can get to the bottom of it, there's not too much relevant info online but if other's run into it then hopefully something here can help

next rampart
#

If you want the exact things I have installed you can try running sdkmanager build-tools;30.0.3 build-tools;34.0.0-rc1 cmake;3.10.2.4988404 cmake;3.22.1 cmake;3.6.4111459 cmdline-tools;latest emulator extras;intel;Hardware_Accelerated_Execution_Manager ndk-bundle ndk;25.2.9519653 patcher;v4 platform-tools platforms;android-28 platforms;android-30 platforms;android-31 platforms;android-33 sources;android-31 system-images;android-30;google_apis_playstore;x86 system-images;android-30;google_apis_playstore;x86_64 system-images;android-31;google_apis_playstore;x86_64, I think it should get all of them directly

#

Node.js shouldn't be a factor in this in the slightest, neither the Android SDK nor Tauri cares about Node.js

last linden
#

and thank you! ill give it a shot in a few and see what happens 🙏

next rampart
last linden
#

ahh that makes sense, i realised it was happening only in the JS CLI as i was typing my comment out 😭

#

moved to fnm for convenience anyway, works pretty well

next rampart
#

fnm should be fine, at the very least it's definitely not the cause for all the issues you're having 🙂

last linden
#

hopefully not LMAOO

#

could it be my java version?

#

i've tried both the package manager's and android studio's bundled one so i'm not sure, but gentoo is running openjdk17.0.6 and fedora is using 17.0.6 also

next rampart
#

I'm not gonna say that it CAN'T be, but based on the linker errors you're getting it suggests it's something else. If you want to be certain that's not the issue, use the Android Studio bundled version

last linden
#

^that's what it's currently configured to use, so i guess we can rule that out 🙏

next rampart
#

I'll try to set up a .devcontainer for Tauri Android development, partially because it's easy to make mistakes setting up the environment and partially because with a devcontainer there won't be any issues regarding developing on different systems

When/if I get done with it, would that be a solution for you?

last linden
next rampart
#

Great! I can't promise I get done with it tonight (since it's 2:37 here and I should be asleep rn) but hopefully I should be done within the next couple of days

last linden
#

oh no worries at all! no rush either, i don't assume it's the easiest thing ever 😭

#

just out of curiosity, is your env configured to use the NDK25 version or the ndk-bundled one?

#

i've installed every package that you had and i'm just reconfiguring now

next rampart
#

Here's all my environment variables that are of interest (note that technically not all of them are required but from my experience with Android development you can never have too many of the legacy variables defined)

last linden
#

well it detected my android emulator automatically now, so that's a plus

next rampart
#

Yaaaay, progress!

last linden
#

sadly running pnpm tauri android build still gives the dreaded cortex-a53 fix error

my env vars:

next rampart
#

JAVA_HOME is set to jbr instead of jre, though I don't think that's the issue 🤔

last linden
#

oh that is a good point, the android studio i downloaded only contained the jbr from what i remember - seems to be a jetbrains java fork

next rampart
#

Oh, weird >.< Well as long as it's some form of Java runtime it shouldn't be the cause of the cortex-a53 error

last linden
#

yeah, gentoo's android studio install had a jre directory so i assume they're interoperable 🙏

next rampart
#

Btw another little thing (that probably doesn't matter), you set NDKROOT to the SDK instead of the NDK. Just thought I'd mention, might save you some frustration down the line in case you (like me) encounter things using legacy/incorrect variables

last linden
#

oh that's a good point, was a blind copy/paste but i'll change that - thanks!

#

i remember reading that the -fix-cortex-a53-835769 patch is applied automatically if -mcpu= or something else (maybe -march=?) isn't supplied, so i wonder if that's the case

#

NDK25 clang binaries do offer the option of supplying -mno-fix-cortex-a53-835769, but it's marked as aarch64 only too so supplying it for all build commands would possibly break the rest. i also don't even know where the flag originates from as i couldn't find it in any tauri-related source code - maybe related to the above? i have no clue

next rampart
#

All of this rings a bell somewhere in the back of my head from my time working on Ogre3D... But I have no clue as to how to fix it :\

On the bright side I just got the devcontainer to build with what SHOULD be all the requirements in it, now I just gotta figure out how to hook it up with adb access

bright hare
#

Ive never used Docker but can I use the container as well?

next rampart
#

Since you're already familiar with Linux getting used to Docker should be absolutely no issues for you

I want to ensure things actually work properly and maybe rewrite some stuff before I offer this up as any form of officially supported setup. I'm currently struggling a bit with getting it to build properly, so you'd currently just be switching out one issue for another

Once I have something that at least works on my computer I'll make a blog post about it on my website and talk to the rest of the WG about how / if we should put it up somewhere more official

If you want to be ready for when I'm ready to release it just ensure you have Docker installed, there shouldn't be any other requirements (at least if you use VSCode, I'm not sure which other IDE´s support devcontainers)

In theory this could potentially be used for pure Docker based development as well, but I'm only setting this up for devcontainers currently

bright hare
#

Tauri team putting in work! Thank you, excited to try it when it's available

next rampart
last linden
#

that is awesome! i'll give it a spin later, i don't have direct experience with dev containers (only docker) but it doesn't seem overly complex.

thank you and i'll let you know the results! (the clean dev environment is a massive plus too)

i'm gonna try building tauri-cli again with tauri-mobile, both on next. looking through the commits, there's likely a few things that'd help so there's no harm in trying

#

haven't tested the devcontainer yet but it'd still be awesome to find a solution either way 🙏

next rampart
#

I'm nearly done now with the devcontainer 😄
<#archive-mobile message>

last linden
next rampart
last linden
#

i'm tempted to make a devcontainer for work now

#

we often get people running into build/environment issues - similar issues to tauri as we use tauri 😭

next rampart
last linden
#

i'm not sure if there's the demand for it

#

it'd definitely make things easier but i don't know how many people would use it/if anyone would even benefit from it

#

would be worth finding out for sure

next rampart
#

I dont know what your specific work requirements are but you could always just include it in the source code as an alternative. I dont expect the entire community to switch to my container just because I made it, but it's a nice alternative to offer, and when people at work get any environment related issues you can use the devcontainer as a debugging step

I'd say "make it and they will come" 🙂

And if any top brass tell you not to just say it wont take long to make because you can just copy my work and ask me questions on how to modify it, they lose maybe a couple hours of your time but all their developers gain a valuable tool