We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Cryptography recipe does not compile
I'm trying to build Kivy app with:
- sdl2 bootstrap
- recipes python2,kivy,cryptography 
- buildozer 0.32 
- latest python-for-android master branch 

In libffi recipe I had to replace [line](https://github.com/kivy/python-for-android/blob/master/pythonforandroid/recipes/libffi/__init__.py#L43) with:
`shprint(sh.Command('autoreconf'), '-vif', _env=env)`.
Without that change p4a was raising sh.CommandNotFound error. 

Now running `buildozer android_new debug` produces the following error log: http://pastebin.com/22qjBJwL
buildozer.spec file: http://pastebin.com/aLe7nLHG
main.py file: http://pastebin.com/xSReYe6u


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `pythonforandroid/recipes/libffi/__init__.py`
Content:
```
1 from pythonforandroid.recipe import Recipe
2 from pythonforandroid.logger import shprint
3 from pythonforandroid.util import current_directory
4 from os.path import exists, join
5 import sh
6 import glob
7 
8 
9 class LibffiRecipe(Recipe):
10 	name = 'libffi'
11 	version = 'v3.2.1'
12 	url = 'https://github.com/atgreen/libffi/archive/{version}.zip'
13 
14 	patches = ['remove-version-info.patch']
15 
16 	def get_host(self, arch):
17 		with current_directory(self.get_build_dir(arch.arch)):
18 			host = None
19 			with open('Makefile') as f:
20 				for line in f:
21 					if line.startswith('host = '):
22 						host = line.strip()[7:]
23 						break
24 
25 			if not host or not exists(host):
26 				raise RuntimeError('failed to find build output! ({})'
27 				                   .format(host))
28 			
29 			return host
30 
31 	def should_build(self, arch):
32 		# return not bool(glob.glob(join(self.ctx.get_libs_dir(arch.arch),
33 		#                                'libffi.so*')))
34 		return not exists(join(self.ctx.get_libs_dir(arch.arch), 'libffi.so'))
35 		# return not exists(join(self.ctx.get_python_install_dir(), 'lib',
36 		#                        'libffi.so'))
37 
38 	def build_arch(self, arch):
39 		env = self.get_recipe_env(arch)
40 		with current_directory(self.get_build_dir(arch.arch)):
41 			if not exists('configure'):
42 				shprint(sh.Command('./autogen.sh'), _env=env)
43 			shprint(sh.Command('autoreconf -vif'), _env=env)
44 			shprint(sh.Command('./configure'), '--host=' + arch.toolchain_prefix,
45 			        '--prefix=' + self.ctx.get_python_install_dir(),
46 			        '--enable-shared', _env=env)
47 			shprint(sh.make, '-j5', 'libffi.la', _env=env)
48 
49 
50 			# dlname = None
51 			# with open(join(host, 'libffi.la')) as f:
52 			# 	for line in f:
53 			# 		if line.startswith('dlname='):
54 			# 			dlname = line.strip()[8:-1]
55 			# 			break
56 			# 
57 			# if not dlname or not exists(join(host, '.libs', dlname)):
58 			# 	raise RuntimeError('failed to locate shared object! ({})'
59 			# 	                   .format(dlname))
60 
61 			# shprint(sh.sed, '-i', 's/^dlname=.*$/dlname=\'libffi.so\'/', join(host, 'libffi.la'))
62 
63 			shprint(sh.cp, '-t', self.ctx.get_libs_dir(arch.arch),
64 			        join(self.get_host(arch), '.libs', 'libffi.so')) #,
65 			        # join(host, 'libffi.la'))
66 
67 	def get_include_dirs(self, arch):
68 		return [join(self.get_build_dir(arch.arch), self.get_host(arch), 'include')]
69 
70 
71 recipe = LibffiRecipe()
72
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/pythonforandroid/recipes/libffi/__init__.py b/pythonforandroid/recipes/libffi/__init__.py
--- a/pythonforandroid/recipes/libffi/__init__.py
+++ b/pythonforandroid/recipes/libffi/__init__.py
@@ -40,7 +40,7 @@
 		with current_directory(self.get_build_dir(arch.arch)):
 			if not exists('configure'):
 				shprint(sh.Command('./autogen.sh'), _env=env)
-			shprint(sh.Command('autoreconf -vif'), _env=env)
+			shprint(sh.Command('autoreconf'), '-vif', _env=env)
 			shprint(sh.Command('./configure'), '--host=' + arch.toolchain_prefix,
 			        '--prefix=' + self.ctx.get_python_install_dir(),
 			        '--enable-shared', _env=env)

{"golden_diff": "diff --git a/pythonforandroid/recipes/libffi/__init__.py b/pythonforandroid/recipes/libffi/__init__.py\n--- a/pythonforandroid/recipes/libffi/__init__.py\n+++ b/pythonforandroid/recipes/libffi/__init__.py\n@@ -40,7 +40,7 @@\n \t\twith current_directory(self.get_build_dir(arch.arch)):\n \t\t\tif not exists('configure'):\n \t\t\t\tshprint(sh.Command('./autogen.sh'), _env=env)\n-\t\t\tshprint(sh.Command('autoreconf -vif'), _env=env)\n+\t\t\tshprint(sh.Command('autoreconf'), '-vif', _env=env)\n \t\t\tshprint(sh.Command('./configure'), '--host=' + arch.toolchain_prefix,\n \t\t\t        '--prefix=' + self.ctx.get_python_install_dir(),\n \t\t\t        '--enable-shared', _env=env)\n", "issue": "Cryptography recipe does not compile\nI'm trying to build Kivy app with:\n- sdl2 bootstrap\n- recipes python2,kivy,cryptography \n- buildozer 0.32 \n- latest python-for-android master branch \n\nIn libffi recipe I had to replace [line](https://github.com/kivy/python-for-android/blob/master/pythonforandroid/recipes/libffi/__init__.py#L43) with:\n`shprint(sh.Command('autoreconf'), '-vif', _env=env)`.\nWithout that change p4a was raising sh.CommandNotFound error. \n\nNow running `buildozer android_new debug` produces the following error log: http://pastebin.com/22qjBJwL\nbuildozer.spec file: http://pastebin.com/aLe7nLHG\nmain.py file: http://pastebin.com/xSReYe6u\n\n", "before_files": [{"content": "from pythonforandroid.recipe import Recipe\nfrom pythonforandroid.logger import shprint\nfrom pythonforandroid.util import current_directory\nfrom os.path import exists, join\nimport sh\nimport glob\n\n\nclass LibffiRecipe(Recipe):\n\tname = 'libffi'\n\tversion = 'v3.2.1'\n\turl = 'https://github.com/atgreen/libffi/archive/{version}.zip'\n\n\tpatches = ['remove-version-info.patch']\n\n\tdef get_host(self, arch):\n\t\twith current_directory(self.get_build_dir(arch.arch)):\n\t\t\thost = None\n\t\t\twith open('Makefile') as f:\n\t\t\t\tfor line in f:\n\t\t\t\t\tif line.startswith('host = '):\n\t\t\t\t\t\thost = line.strip()[7:]\n\t\t\t\t\t\tbreak\n\n\t\t\tif not host or not exists(host):\n\t\t\t\traise RuntimeError('failed to find build output! ({})'\n\t\t\t\t                   .format(host))\n\t\t\t\n\t\t\treturn host\n\n\tdef should_build(self, arch):\n\t\t# return not bool(glob.glob(join(self.ctx.get_libs_dir(arch.arch),\n\t\t#                                'libffi.so*')))\n\t\treturn not exists(join(self.ctx.get_libs_dir(arch.arch), 'libffi.so'))\n\t\t# return not exists(join(self.ctx.get_python_install_dir(), 'lib',\n\t\t#                        'libffi.so'))\n\n\tdef build_arch(self, arch):\n\t\tenv = self.get_recipe_env(arch)\n\t\twith current_directory(self.get_build_dir(arch.arch)):\n\t\t\tif not exists('configure'):\n\t\t\t\tshprint(sh.Command('./autogen.sh'), _env=env)\n\t\t\tshprint(sh.Command('autoreconf -vif'), _env=env)\n\t\t\tshprint(sh.Command('./configure'), '--host=' + arch.toolchain_prefix,\n\t\t\t        '--prefix=' + self.ctx.get_python_install_dir(),\n\t\t\t        '--enable-shared', _env=env)\n\t\t\tshprint(sh.make, '-j5', 'libffi.la', _env=env)\n\n\n\t\t\t# dlname = None\n\t\t\t# with open(join(host, 'libffi.la')) as f:\n\t\t\t# \tfor line in f:\n\t\t\t# \t\tif line.startswith('dlname='):\n\t\t\t# \t\t\tdlname = line.strip()[8:-1]\n\t\t\t# \t\t\tbreak\n\t\t\t# \n\t\t\t# if not dlname or not exists(join(host, '.libs', dlname)):\n\t\t\t# \traise RuntimeError('failed to locate shared object! ({})'\n\t\t\t# \t                   .format(dlname))\n\n\t\t\t# shprint(sh.sed, '-i', 's/^dlname=.*$/dlname=\\'libffi.so\\'/', join(host, 'libffi.la'))\n\n\t\t\tshprint(sh.cp, '-t', self.ctx.get_libs_dir(arch.arch),\n\t\t\t        join(self.get_host(arch), '.libs', 'libffi.so')) #,\n\t\t\t        # join(host, 'libffi.la'))\n\n\tdef get_include_dirs(self, arch):\n\t\treturn [join(self.get_build_dir(arch.arch), self.get_host(arch), 'include')]\n\n\nrecipe = LibffiRecipe()\n", "path": "pythonforandroid/recipes/libffi/__init__.py"}], "after_files": [{"content": "from pythonforandroid.recipe import Recipe\nfrom pythonforandroid.logger import shprint\nfrom pythonforandroid.util import current_directory\nfrom os.path import exists, join\nimport sh\nimport glob\n\n\nclass LibffiRecipe(Recipe):\n\tname = 'libffi'\n\tversion = 'v3.2.1'\n\turl = 'https://github.com/atgreen/libffi/archive/{version}.zip'\n\n\tpatches = ['remove-version-info.patch']\n\n\tdef get_host(self, arch):\n\t\twith current_directory(self.get_build_dir(arch.arch)):\n\t\t\thost = None\n\t\t\twith open('Makefile') as f:\n\t\t\t\tfor line in f:\n\t\t\t\t\tif line.startswith('host = '):\n\t\t\t\t\t\thost = line.strip()[7:]\n\t\t\t\t\t\tbreak\n\n\t\t\tif not host or not exists(host):\n\t\t\t\traise RuntimeError('failed to find build output! ({})'\n\t\t\t\t                   .format(host))\n\t\t\t\n\t\t\treturn host\n\n\tdef should_build(self, arch):\n\t\t# return not bool(glob.glob(join(self.ctx.get_libs_dir(arch.arch),\n\t\t#                                'libffi.so*')))\n\t\treturn not exists(join(self.ctx.get_libs_dir(arch.arch), 'libffi.so'))\n\t\t# return not exists(join(self.ctx.get_python_install_dir(), 'lib',\n\t\t#                        'libffi.so'))\n\n\tdef build_arch(self, arch):\n\t\tenv = self.get_recipe_env(arch)\n\t\twith current_directory(self.get_build_dir(arch.arch)):\n\t\t\tif not exists('configure'):\n\t\t\t\tshprint(sh.Command('./autogen.sh'), _env=env)\n\t\t\tshprint(sh.Command('autoreconf'), '-vif', _env=env)\n\t\t\tshprint(sh.Command('./configure'), '--host=' + arch.toolchain_prefix,\n\t\t\t        '--prefix=' + self.ctx.get_python_install_dir(),\n\t\t\t        '--enable-shared', _env=env)\n\t\t\tshprint(sh.make, '-j5', 'libffi.la', _env=env)\n\n\n\t\t\t# dlname = None\n\t\t\t# with open(join(host, 'libffi.la')) as f:\n\t\t\t# \tfor line in f:\n\t\t\t# \t\tif line.startswith('dlname='):\n\t\t\t# \t\t\tdlname = line.strip()[8:-1]\n\t\t\t# \t\t\tbreak\n\t\t\t# \n\t\t\t# if not dlname or not exists(join(host, '.libs', dlname)):\n\t\t\t# \traise RuntimeError('failed to locate shared object! ({})'\n\t\t\t# \t                   .format(dlname))\n\n\t\t\t# shprint(sh.sed, '-i', 's/^dlname=.*$/dlname=\\'libffi.so\\'/', join(host, 'libffi.la'))\n\n\t\t\tshprint(sh.cp, '-t', self.ctx.get_libs_dir(arch.arch),\n\t\t\t        join(self.get_host(arch), '.libs', 'libffi.so')) #,\n\t\t\t        # join(host, 'libffi.la'))\n\n\tdef get_include_dirs(self, arch):\n\t\treturn [join(self.get_build_dir(arch.arch), self.get_host(arch), 'include')]\n\n\nrecipe = LibffiRecipe()\n", "path": "pythonforandroid/recipes/libffi/__init__.py"}]}