"Сломанный набор инструментов: не может связать простую программу на C в buildozer?" при попытке сделать приложение для Android с Kivy buildozer - PullRequest
0 голосов
/ 18 января 2019

Я пытался сделать Android APK с помощью buildozer, но есть ошибка:

File "numpy/core/setup.py", line 686, in get_mathlib_info
raise RuntimeError("Broken toolchain: cannot link a simple C program". 

RuntimeError: Неработающая цепочка инструментов: невозможно связать простую программу на C

Нет проблем с установкой numpy или других библиотек, я хорошо установил numpy, ошибка только при попытке сделать apk. Но я не знаю, как решить эту ошибку. Я не нашел решения в интернете, поэтому буду очень признателен, если кто-нибудь сможет мне помочь!

Я использую Xubuntu 12, kivy 1.9.1, python 2.7

Мой buildozer.spec , основные вещи, которые я изменил:

# (str) Title of your application
title = Face_detect

# (str) Package name
package.name = myapp
# (str) Package domain (needed for android/ios packaging)
package.domain = org.test
# (str) Source code where the main.py live
source.dir = .
# (list) Source files to include (let empty to include all the files)
source.include_exts = py,png,jpg,kv,atlas,xml
# (str) Application versioning (method 1)
version = 0.1
# (list) Application requirements
# comma separated e.g. requirements = sqlite3,kivy
requirements = hostpython2,kivy,numpy,opencv
# (str) Custom source folders for requirements
# Sets custom source for any requirements with recipes
# requirements.source.kivy = ../../kivy
# (str) Supported orientation (one of landscape, portrait or all)
orientation = portrait
# change the major version of python used by the app
osx.python_version = 3
# Kivy version to use
osx.kivy_version = 1.9.1
#
# Android specific
#
# (bool) Indicate if the application should be fullscreen or not
fullscreen = 1
# (list) Permissions
android.permissions = CAMERA
# (int) Android API to use
#android.api = 21
# (int) Minimum API required
#android.minapi = 9
# (int) Android SDK version to use
#android.sdk = 20
# (str) Android NDK version to use
android.ndk = 13b
# (str) Android NDK directory (if empty, it will be automatically downloaded.)
android.ndk_path = /home/kivy/.buildozer/android/platform/android-ndk-r13b
# (str) python-for-android branch to use, defaults to stable
#p4a.branch = stable
# (str) The Android arch to build for, choices: armeabi-v7a, arm64-v8a, x86
android.arch = armeabi-v7a
# (str) python-for-android git clone directory (if empty, it will be automatically cloned from github)
#p4a.source_dir = home/kivy/python-for-android

main.py

from kivy.app import App
import numpy as np
import cv2

class DetectApp(App):
    def build(self):
        # multiple cascades: https://github.com/Itseez/opencv/tree/master/data/haarcascades
        #https://github.com/Itseez/opencv/blob/master/data/haarcascades/haarcascade_frontalface_default.xml
        face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')
        #https://github.com/Itseez/opencv/blob/master/data/haarcascades/haarcascade_eye.xml
        eye_cascade = cv2.CascadeClassifier('haarcascade_eye.xml')
        cap = cv2.VideoCapture(0)
        while 1:
            ret, img = cap.read()
            gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
            faces = face_cascade.detectMultiScale(gray, 1.3, 5)

            for (x,y,w,h) in faces:
                cv2.rectangle(img,(x,y),(x+w,y+h),(255,0,0),2)
                roi_gray = gray[y:y+h, x:x+w]
                roi_color = img[y:y+h, x:x+w]

                eyes = eye_cascade.detectMultiScale(roi_gray)
                for (ex,ey,ew,eh) in eyes:
                    cv2.rectangle(roi_color,(ex,ey),(ex+ew,ey+eh),(0,255,0),2)

            cv2.imshow('img',img)
            k = cv2.waitKey(30) & 0xff
            if k == 27:
                break

        cap.release()
        cv2.destroyAllWindows()

DetectApp().run()
...