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

use LEGACY_NDK option to build lapack/scipy with a separate NDK #2615

Merged
merged 1 commit into from
Jun 6, 2022

Conversation

mzakharo
Copy link
Contributor

@mzakharo mzakharo commented Jun 6, 2022

Google has removed gcc/gfortran support in their latest NDK (r23b), supported by p4a. Building gfortran out-of-tree is possible, but the sysroot, shipped with NDK r23b does not contain enough libraries to properly link objects, generated by gfortran compiler.

This is a workaround to use older NDK, supporting gcc/gfortran (r19c) to build lapack/scipy, while the rest of the recipes build with r23b by default.

A new environment variable is introduced, LEGACY_NDK -> to specify the location of the legacy NDK (r19c), containing gcc/gfortran compilers.

Copy link
Member

@AndreMiras AndreMiras left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thanks for the fix.
I like that you could scope the workaround to the recipes.

So after r19c or so, the NDK would no longer support gfortran at all? What a bummer 😕
I took a quick look at scipy repo and bug tracker and it doesn't seem like they have any plans for replacing lapack. I don't know how deep it is integrated in their code base.
Maybe it's worth letting them know they have a community of mobile user/developer, but that gfortran support was dropped some time ago from the NDK.
Maybe they would have suggestions

@AndreMiras AndreMiras merged commit 13177b1 into kivy:develop Jun 6, 2022
@mzakharo mzakharo deleted the scipy branch June 6, 2022 13:33
@mzakharo
Copy link
Contributor Author

mzakharo commented Jun 6, 2022

Unfortunately, besides lapack, some portions of scipy are built with gfortran, I dont think fortran is going away any time soon. The only hope is for LLVM flang to become a full-fledged compiler/linker of fortran objects, and Google adding support for it officially.

@mhsmith
Copy link

mhsmith commented Oct 2, 2024

Building gfortran out-of-tree is possible, but the sysroot, shipped with NDK r23b does not contain enough libraries to properly link objects, generated by gfortran compiler.

@mzakharo: Do you remember which libraries were missing, and what errors this produced?

In the Chaquopy project we've had good results using your prebuilt gfortran to build OpenBLAS and SciPy for Android. But we obviously can't stay on an old version of the NDK forever. For example, NDK version 27 is recommended for 16 KB page support.

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

Successfully merging this pull request may close these issues.

3 participants