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

fyne package -os android needs NDK 16/19c #3066

Closed
bon-ami opened this issue Jun 13, 2022 · 44 comments
Closed

fyne package -os android needs NDK 16/19c #3066

bon-ami opened this issue Jun 13, 2022 · 44 comments
Assignees
Labels
blocker Items that would block a forthcoming release bug Something isn't working OS:Android Tickets affecting only Android devices

Comments

@bon-ami
Copy link

bon-ami commented Jun 13, 2022

Describe the bug:

#2922 & #2919 related but both closed. How to build android app now?
I have downloaded NDK 16, 19 & 24 in Android Studio. However armv7a-linux-androideabi16-clang still does not exist. armv7a-linux-androideabi19-clang exists.

To Reproduce:

Steps to reproduce the behaviour:

  1. fyne package -os android

Screenshots:

no compiler for arm was found in the NDK (tried D:\SDK\ndk\24.0.8215888\toolchains\llvm\prebuilt\windows-x86_64\bin\armv7a-linux-androideabi16-clang). Make sure your NDK version is >= r19c. Use sdkmanager --update to update it

Example code:

Device (please complete the following information):

  • OS: Windows
  • Version: 10
  • Go version: 1.18
  • Fyne version: 2.1.4
@bon-ami bon-ami added the unverified A bug that has been reported but not verified label Jun 13, 2022
@andydotxyz
Copy link
Member

What is the output of "fyne --version"?

@bon-ami
Copy link
Author

bon-ami commented Jun 14, 2022

@andydotxyz , I've just upgraded fyne from 2.1.4 to 2.2.1. It does not work with 24.0.8215888, complaining i686-linux-android16-clang not found. But I followed steps below and it works. Please close this. Thanks.

  1. export ANDROID_NDK_HOME=D:\SDK\ndk\19.2.5345600
  2. go mod tidy
  3. fyne package -os android

@andydotxyz
Copy link
Member

What is the output of "fyne --version"?

Can you please confirm this?

@bon-ami
Copy link
Author

bon-ami commented Jun 16, 2022

@andydotxyz , yes. Now it passes with
$ fyne --version
fyne version v2.2.1

@andydotxyz
Copy link
Member

andydotxyz commented Jun 16, 2022

Excellent, it sounds like you did not have the bug fix that we recently released (#2920 I think), I am glad this is resolved.

@Sanichka
Copy link

Hi @andydotxyz
For some reason I'm still expiriensing same issue as bon-ami while using fyne version v2.2.3 during packaging for android. I've tried NDK 25.0.8775105 from adnroid stuidio tools>sdk manager and also ndk r24 from this repo of unsupported downloads of ndk. Could you please advice if there anything that might lead to the same issue?
image

@andydotxyz
Copy link
Member

Not really resolved yet it seems

@andydotxyz andydotxyz reopened this Aug 24, 2022
@Sanichka
Copy link

Thank you for reply. I'm looking forward for any news and ready to test and cooperate to solve this issue!

@andydotxyz
Copy link
Member

Thanks @Sanichka, you could try out the proposed fix at #3219

@Sanichka
Copy link

Hi @andydotxyz
I've pulled fix and replaced fyne in go.mod to local folder with fix, but either I've done something wrong or it didn't help considering same error message. Is there anything wrong with my usage of fixed version or anything I've missed?
fyne1

@Bluebugs
Copy link
Contributor

You actually need to pull the binary from that PR. I am not to sure if there is a best way, but I think you have to checkout that PR, then build and install manually the fyne binary with go build/install from the cmd/fyne subdirectory.

@Sanichka
Copy link

Thank you for hint, I've managed to build and tried pasting fyne.exe in my project folder and packaging and replaced old exe in $GOPATH/bin and same error there. P.S: My module called qrscannerapp and it's seems it's missing some file during packagin process. Hope this info will help, let me know if you need anything else.
image

@Bluebugs
Copy link
Contributor

Not to sure how to debug this one. On linux you can trace what command is being executed by using strace -fF -e execve fyne package .... I do not know if there is a similar solution on Windows, if you know any that will be helpful.

Otherwise which version of the NDK is installed? And is your application otherwise pure go?

@Sanichka
Copy link

Sanichka commented Aug 25, 2022

NDK is r24 from this repo. Yes, for now main.go contains fyne example with hello world:

package main

import (
	"fyne.io/fyne/v2/app"
	"fyne.io/fyne/v2/widget"
)

func main() {
	a := app.New()
	w := a.NewWindow("Hello World")

	w.SetContent(widget.NewLabel("Hello World!"))
	w.ShowAndRun()
}

@andydotxyz
Copy link
Member

Oh my - exec: no command found is it possible there is a corner case the PR did not cover @Bluebugs ?
I wonder if it is looping through possible clangs and not finding one leaving a "" command which would result in that error?...

@andydotxyz
Copy link
Member

@Sanichka just out of interest, why are you using unsupported downloads repo?
If you install the SDK from "Android Studio" instead does it work correctly?

@Sanichka
Copy link

Sanichka commented Sep 6, 2022

I've tried NDK from Android Studio at start, but then switched to unofficial source to test it since some mobile dev related YT videos were using it with go. Should I try version from android studio for testing purposes?

@Bluebugs
Copy link
Contributor

Bluebugs commented Sep 6, 2022

Oh my - exec: no command found is it possible there is a corner case the PR did not cover @Bluebugs ? I wonder if it is looping through possible clangs and not finding one leaving a "" command which would result in that error?...

Oh, that could be an explanation. It should error, but maybe it doesn't.

@Bluebugs
Copy link
Contributor

Bluebugs commented Sep 6, 2022

I've tried NDK from Android Studio at start, but then switched to unofficial source to test it since some mobile dev related YT videos were using it with go. Should I try version from android studio for testing purposes?

Oh, what kind of NDK are you using?

@Sanichka
Copy link

Sanichka commented Sep 7, 2022

Just tried with NDK 25.0.8775105 from Android Studio. Same error. So both versions r24 from unofficial repo and android studio one leads to this.
fyne3

@andydotxyz
Copy link
Member

andydotxyz commented Sep 7, 2022

Confirmed, it silently returns "" as the command if we don't find a matching compiler... https://github.com/fyne-io/fyne/blob/develop/cmd/fyne/internal/mobile/env.go#L384 - I think we need to put in more error handling @Bluebugs.

@Sanichka can you help by looking in your ANDROID_NDK_HOME and seeing if the following file exists? If not, what is the closest match:

toolchains\llvm\prebuilt\windows-x86_64\bin\x86_64-linux-android21-clang

@Sanichka
Copy link

Sanichka commented Sep 7, 2022

Mentioned file exists + all similar cases:
fyne4

@Bluebugs
Copy link
Contributor

Bluebugs commented Sep 7, 2022

@Sanichka can you give us the full path of one of those files?

@Sanichka
Copy link

Sanichka commented Sep 7, 2022

C:\Users\Alex\AppData\Local\Android\Sdk\ndk\25.0.8775105\toolchains\llvm\prebuilt\windows-x86_64\bin\x86_64-linux-android21-clang

@moluopro
Copy link

I got the same problem:
no compiler for arm was found in the NDK (tried D:\Cache\AS\SDK\ndk\25.1.8937393\toolchains\llvm\prebuilt\windows-x86_64\bin\armv7a-linux-androideabi16-clang). Make sure your NDK version is >= r19c. Use sdkmanager --update to update it

@Bluebugs
Copy link
Contributor

@moluopro I am correct into assuming you tried it with the develop branch of fyne? If so, I wonder if the issue is not with my code and windows as I tested it on Linux. Maybe something I overlooked, I will check if I see anything.

@andydotxyz
Copy link
Member

@Sanichka @moluopro as we prepare for next release plans I want to confirm if you were able to test with the fyne command from develop branch and whether the problem persisted?

@Sanichka
Copy link

I've just tested develop branch and I've got same error:
C:\Users\Alex\AppData\Local\Temp\fyne-work-4222060171\lib\armeabi-v7a\libqrscannerapp.so: exec: no command

@Bluebugs
Copy link
Contributor

Bluebugs commented Oct 2, 2022

Would you mind trying with the latest develop branch out should include a fix for this. I haven't tried it on windows, so maybe there is still some improvement to be made there.

@Dragon-Hacking
Copy link

Dragon-Hacking commented Oct 2, 2022

They must go to the directory where the binary is missing in my case /lib/android-ndk/android-ndk-r25b/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi16-clang++

$ cd $ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/

I copied the binary "armv7a-linux-androideabi19-clang++" into a new file which is the one that does not exist "armv7a-linux-androideabi16-clang++" repeated in process with the other missing binaries

$ cp armv7a-linux-androideabi19-clang++ armv7a-linux-androideabi16-clang++
$ cp armv7a-linux-androideabi19-clang armv7a-linux-androideabi16-clang

$ cp i686-linux-android19-clang++ i686-linux-android16-clang++
$ cp i686-linux-android19-clang++ i686-linux-android16-clang++

I have solved the problem
Captura de pantalla -2022-10-01 22-04-06
a

IMG_20221001_221143

@andydotxyz
Copy link
Member

@Bluebugs does this data help?
I'm worried this may be a blocking issue, though it is still marked as unconfirmed...

@Bluebugs
Copy link
Contributor

I should try to setup a windows machine to see as the informations here are not really shining a light on the problem.

@observerss
Copy link

observerss commented Nov 14, 2022

same "exec: no command" on win10, fyne 2.4.2, ndk 25

@andydotxyz
Copy link
Member

Can you confirm why you edited this to remove "develop branch actually works" and your steps to replicate @observerss ?

@tamaraspringer
Copy link

Hello there,
I have a similar issue and I didn't quite understand if this is solved or not. I'm stuck with the AppData\Local\Temp\fyne-work-150880070\lib\armeabi-v7a\libhello.so: exec: no command.
What does this mean and how can I fix that?
Thanks in advance

@andydotxyz andydotxyz added blocker Items that would block a forthcoming release bug Something isn't working OS:Android Tickets affecting only Android devices and removed unverified A bug that has been reported but not verified labels Nov 16, 2022
@andydotxyz
Copy link
Member

@Bluebugs can we get to the bottom of this before v2.3.0? I'm not sure how well fixed this problem is...

@Bluebugs
Copy link
Contributor

Indeed, I am planning to investigate this week.

@andydotxyz
Copy link
Member

Cool thanks

@darkencrow
Copy link

darkencrow commented Nov 25, 2022

Maybe this could be solve it.

I worked on the Windows.

I got the same issue with this exec: no command error when packaging android apk .

And I found the reson is the program try to extract the params from ndk dir but failed within filename llvm-nm, os.Stat() func return error with it. So I try to append the ext .exe after the toolPath, and then rebuild the code. I replace the %GOPATH%\bin\fyne.exe with the rebuilding one , and try to repack the apk then I found that : everthing's right.

The relating code is located at %GOPATH%\src\fyne.io\fyne\v2\cmd\fyne\internal\mobile\build_androidapp.go -> goAndroidBuild() line 94 : extractPkgs(toolchain.Path(ndkRoot, "nm")...
And %GOPATH%\src\fyne.io\fyne\v2\cmd\fyne\internal\mobile\env.go -> (tc *ndkToolchain) Path() line 380

(ver 2.2.4)

Wish these can help someone to fix this prob.

@Bluebugs
Copy link
Contributor

Thanks, I will try to have a PR going today for this.

@Bluebugs Bluebugs mentioned this issue Nov 25, 2022
2 tasks
@Bluebugs
Copy link
Contributor

I did it slightly differently, just in case, to be a bit more future proof. Have a look.

@Bluebugs
Copy link
Contributor

This should be fixed in develop now. Please confirm and we can hopefully close this issue.

@darkencrow
Copy link

Got it! thank you very much!

@andydotxyz
Copy link
Member

Excellent, sounds fixed :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocker Items that would block a forthcoming release bug Something isn't working OS:Android Tickets affecting only Android devices
Projects
None yet
Development

No branches or pull requests

9 participants