问题
I am trying to package a simple Kivy app in iOS using the instruction in the site:
https://github.com/kivy/kivy-ios
My app is very simple with 1 line:
from firebase import firebase
The app can be packaged successfully in android using linux. However, I am having problem packaging it to iOS. I need to build a recipe named pycrypto but it's giving me the below error. I tried both python2 and python3. I still ended up with the same error. It seems the url link is dead (https://ftp.dlitz.net/pub/dlitz/crypto/pycrypto/pycrypto-2.6.1.tar.gz)
https://kivy.org/doc/stable/guide/packaging-ios.html
hcaos-iMac:kivy-ios hcao$ ./toolchain.py build pycrypto
[INFO ] Building with 4 processes, where supported
[INFO ] Want to build ['pycrypto']
[INFO ] Loaded recipe pycrypto (depends of ['python', 'openssl'], optional are [])
[INFO ] Loaded recipe python (depends of [u'python3'], optional are [])
[INFO ] Loaded recipe openssl (depends of [], optional are [])
[INFO ] Loaded recipe python3 (depends of ['hostpython3', 'libffi', 'openssl'], optional are [])
[INFO ] Loaded recipe hostpython3 (depends of [], optional are ['openssl'])
[INFO ] Loaded recipe libffi (depends of [], optional are [])
[INFO ] Build order is ['libffi', 'openssl', 'hostpython3', u'python3', 'python', 'pycrypto']
[INFO ] Recipe order is ['libffi', 'openssl', 'hostpython3', 'python3', 'pycrypto']
[INFO ] Include dir added: {arch.arch}/ffi
[INFO ] Include dir added: {arch.arch}/openssl
[INFO ] Global: hostpython located at /Users/hcao/Desktop/kivyios-python3/kivy-ios/dist/hostpython3/bin/python
[INFO ] Global: hostpgen located at /Users/hcao/Desktop/kivyios-python3/kivy-ios/dist/hostpython3/bin/pgen
[DEBUG ] Cached result: Download libffi. Ignoring
[DEBUG ] Cached result: Extract libffi. Ignoring
[DEBUG ] Cached result: Build_all libffi. Ignoring
[DEBUG ] Cached result: Download openssl. Ignoring
[DEBUG ] Cached result: Extract openssl. Ignoring
[DEBUG ] Cached result: Build_all openssl. Ignoring
[DEBUG ] Cached result: Download hostpython3. Ignoring
[DEBUG ] Cached result: Extract hostpython3. Ignoring
[DEBUG ] Cached result: Build_all hostpython3. Ignoring
[DEBUG ] Cached result: Download python3. Ignoring
[DEBUG ] Cached result: Extract python3. Ignoring
[DEBUG ] Cached result: Build_all python3. Ignoring
[INFO ] Download pycrypto
[INFO ] Downloading https://ftp.dlitz.net/pub/dlitz/crypto/pycrypto/pycrypto-2.6.1.tar.gz
Traceback (most recent call last):
File "./toolchain.py", line 1569, in <module>
ToolchainCL()
File "./toolchain.py", line 1284, in __init__
getattr(self, args.command)()
File "./toolchain.py", line 1325, in build
build_recipes(args.recipe, ctx)
File "./toolchain.py", line 1161, in build_recipes
recipe.execute()
File "/Users/hcao/Desktop/kivyios-python3/kivy-ios/toolchain.py", line 726, in execute
self.download()
File "/Users/hcao/Desktop/kivyios-python3/kivy-ios/toolchain.py", line 84, in _cache_execution
f(self, *args, **kwargs)
File "/Users/hcao/Desktop/kivyios-python3/kivy-ios/toolchain.py", line 761, in download
self.download_file(self.url.format(version=self.version), fn)
File "/Users/hcao/Desktop/kivyios-python3/kivy-ios/toolchain.py", line 478, in download_file
urlretrieve(url, filename, report_hook)
File "/Library/Python/2.7/site-packages/future/backports/urllib/request.py", line 1731, in retrieve
fp = self.open(url, data)
File "/Library/Python/2.7/site-packages/future/backports/urllib/request.py", line 1703, in open
raise_with_traceback(IOError('socket error', msg))
File "/Library/Python/2.7/site-packages/future/backports/urllib/request.py", line 1697, in open
return getattr(self, name)(url)
File "/Library/Python/2.7/site-packages/future/backports/urllib/request.py", line 1907, in open_https
return self._open_generic_http(self._https_connection, url, data)
File "/Library/Python/2.7/site-packages/future/backports/urllib/request.py", line 1856, in _open_generic_http
http_conn.request("GET", selector, headers=headers)
File "/Library/Python/2.7/site-packages/future/backports/http/client.py", line 1083, in request
self._send_request(method, url, body, headers)
File "/Library/Python/2.7/site-packages/future/backports/http/client.py", line 1121, in _send_request
self.endheaders(body)
File "/Library/Python/2.7/site-packages/future/backports/http/client.py", line 1079, in endheaders
self._send_output(message_body)
File "/Library/Python/2.7/site-packages/future/backports/http/client.py", line 924, in _send_output
self.send(msg)
File "/Library/Python/2.7/site-packages/future/backports/http/client.py", line 860, in send
self.connect()
File "/Library/Python/2.7/site-packages/future/backports/http/client.py", line 1221, in connect
self.timeout, self.source_address)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 575, in create_connection
raise err
IOError: [Errno socket error] [Errno 61] Connection refused
回答1:
Answer can be found at https://github.com/kivy/kivy-ios/issues/384 Pycrypto can be built but it won't run properly. The workaround is to avoid firebase (which requires pycrypto) altogether. Use requests and json instead for simple get and post methods.
来源:https://stackoverflow.com/questions/57864387/unable-to-build-pycrypto-recipe-in-python3-toolchain