“工具链损坏:无法在buildozer中链接简单的C程序?”尝试使用kivy buildozer制作android应用时

时间:2019-01-18 03:59:37

标签: android python numpy kivy buildozer

我试图用buildozer制作android apk,但出现错误:

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()

0 个答案:

没有答案