Build failed: Please set the environment variable 'LEGACY_NDK' to point to a NDK location with gcc/gfortran support (supported NDK version: 'r21e')

684 views
Skip to first unread message

Yassin Marmoud

unread,
Dec 19, 2022, 9:51:40 PM12/19/22
to Kivy users support
any help for this error please with some details because i tried all the solutions in google thanks 

the error :
---------------------------------------
.....
[DEBUG]:        make[2]: warning: -j8 forced in submake: resetting jobserver mode.
[DEBUG]:        [ 95%] Linking C executable jpegtran-static
[DEBUG]:        [ 95%] Building C object CMakeFiles/tjbench-static.dir/tjutil.c.o
[DEBUG]:        [ 96%] Building C object CMakeFiles/tjbench-static.dir/tjbench.c.o
[DEBUG]:        [ 97%] Building C object CMakeFiles/tjunittest-static.dir/tjunittest.c.o
[DEBUG]:        [ 97%] Building C object CMakeFiles/tjunittest-static.dir/tjutil.c.o
[DEBUG]:        [ 99%] Building C object CMakeFiles/tjunittest-static.dir/md5/md5.c.o
[DEBUG]:        [ 99%] Building C object CMakeFiles/tjunittest-static.dir/md5/md5hl.c.o
[DEBUG]:        [ 99%] Built target jpegtran-static
[DEBUG]:        [ 99%] Linking C executable tjunittest-static
[DEBUG]:        [100%] Linking C executable tjbench-static
[DEBUG]:        [100%] Built target tjunittest-static
[DEBUG]:        [100%] Built target tjbench-static
[INFO]:    <- directory context /mnt/c/users/ymarmoud/Desktop/final/.buildozer/android/platform/python-for-android
[WARNING]: install_libs called with no libraries to install!
[INFO]:    Building lapack for arm64-v8a
[INFO]:    -> directory context /mnt/c/users/ymarmoud/Desktop/final/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/other_builds/lapack/arm64-v8a__ndk_target_21/lapack/build
[ERROR]:   Build failed: Please set the environment variable 'LEGACY_NDK' to point to a NDK location with gcc/gfortran support (supported NDK version: 'r21e')
# Command failed: ['/usr/bin/python3', '-m', 'pythonforandroid.toolchain', 'create', '--dist_name=RecoVine', '--bootstrap=sdl2', '--requirements=python3,kivy==2.0.0,kivymd==0.104.2,threading,webbrowser,datetime,pillow,plyer,opencv,imutils,numpy,collections,keras,scipy', '--arch=arm64-v8a', '--arch=armeabi-v7a', '--copy-libs', '--color=always', '--storage-dir=/mnt/c/users/ymarmoud/Desktop/final/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a', '--ndk-api=21', '--ignore-setup-py', '--debug']
# ENVIRONMENT:
#     LANG = 'C.UTF-8'
#     TERM = 'xterm-256color'
#     PATH = '/root/.buildozer/android/platform/apache-ant-1.9.4/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin'
#     MAIL = '/var/mail/root'
#     LOGNAME = 'root'
#     USER = 'root'
#     HOME = '/root'
#     SHELL = '/bin/bash'
#     SUDO_COMMAND = '/usr/local/bin/buildozer -v android debug'
#     SUDO_USER = 'hisoka'
#     SUDO_UID = '1000'
#     SUDO_GID = '1000'
#     PACKAGES_PATH = '/root/.buildozer/android/packages'
#     ANDROIDSDK = '/root/.buildozer/android/platform/android-sdk'
#     ANDROIDNDK = '/root/.buildozer/android/platform/android-ndk-r25b'
#     ANDROIDAPI = '32'
#     ANDROIDMINAPI = '21'
#
# Buildozer failed to execute the last command
# The error might be hidden in the log above this error
# Please read the full log, and search for it before
# raising an issue with buildozer itself.
# In case of a bug report, please add a full log with log_level = 2
----------------------------------------------------------

Robert

unread,
Dec 19, 2022, 11:00:21 PM12/19/22
to Kivy users support
I know why this message occurs, it is scipy related  https://github.com/kivy/python-for-android/pull/2615
But I don't have any explicit instructions for implementation.

Generally you have to download NDK 19c (as I said I don't...) and point the environment variable at your copy.

(This might work, no warranty:
in buildozer.spec set  android.ndk = 19c for one build,
the build will fail at some point but you will have 19c under ~/.buildozer
then comment android.ndk,
buildozer appclean,
set the environment variable,
and build....)

This because some of SciPy is written in Fortran, and the current NDK does not support Fortran, so we use a legacy NDK only to compile the Fortran.

Eason Liu

unread,
Jul 19, 2023, 10:06:00 AM7/19/23
to Kivy users support
FYI This answer solved the issue with scipy for me: https://stackoverflow.com/a/74276746/3892445
Reply all
Reply to author
Forward
0 new messages