chaquo / chaquopy

Chaquopy: the Python SDK for Android
https://chaquo.com/chaquopy/
MIT License
748 stars 127 forks source link

Error when building the cython_example wheel #1188

Open mhsmith opened 4 days ago

mhsmith commented 4 days ago

Originally posted by @LDWLM in https://github.com/chaquo/chaquopy/issues/800#issuecomment-2186178582


hello, I come with an error when build the cython_example wheel. my python is create with miniconda create -n python38 python=3.8 and conda activate python38 I goto packages/cython_example/src dir, run cmd python setup.py bdist_wheel generated a so success.

(python38) ➜  pypi git:(master) ✗ sudo apt-get install libcrypt-dev
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
libcrypt-dev is already the newest version (1:4.4.27-1).
0 upgraded, 0 newly installed, 0 to remove and 47 not upgraded.
(python38) ➜  pypi git:(master) ✗ find /usr/include -name crypt.h
/usr/include/tirpc/rpcsvc/crypt.h
/usr/include/crypt.h
(python38) ➜  pypi git:(master) ✗ ./build-wheel.py --python 3.8 --abi arm64-v8a packages/cython-example
build-wheel: mkdir -p /home/atlas/chaquopy/server/pypi/packages/cython-example/build/1.0
build-wheel: cd /home/atlas/chaquopy/server/pypi/packages/cython-example/build/1.0
build-wheel: mkdir -p /home/atlas/chaquopy/server/pypi/packages/cython-example/build/1.0/cp38-cp38-android_21_arm64_v8a
build-wheel: cp -a /home/atlas/chaquopy/server/pypi/packages/cython-example/src /home/atlas/chaquopy/server/pypi/packages/cython-example/build/1.0/cp38-cp38-android_21_arm64_v8a/src
build-wheel: mkdir -p /home/atlas/chaquopy/server/pypi/packages/cython-example/build/1.0/cp38-cp38-android_21_arm64_v8a/requirements
build-wheel: mkdir -p /home/atlas/chaquopy/server/pypi/packages/cython-example/build/1.0/cp38-cp38-android_21_arm64_v8a/requirements/chaquopy/include
build-wheel: mkdir -p /home/atlas/chaquopy/server/pypi/packages/cython-example/build/1.0/cp38-cp38-android_21_arm64_v8a/requirements/chaquopy/lib
build-wheel: unzip -q -d /home/atlas/chaquopy/server/pypi/packages/cython-example/build/1.0/cp38-cp38-android_21_arm64_v8a/requirements/chaquopy /home/atlas/chaquopy/maven/com/chaquo/python/target/3.8.18-0/target-3.8.18-0-arm64-v8a.zip include/* jniLibs/*
build-wheel: mv /home/atlas/chaquopy/server/pypi/packages/cython-example/build/1.0/cp38-cp38-android_21_arm64_v8a/requirements/chaquopy/jniLibs/arm64-v8a/* /home/atlas/chaquopy/server/pypi/packages/cython-example/build/1.0/cp38-cp38-android_21_arm64_v8a/requirements/chaquopy/lib
build-wheel: rm -r /home/atlas/chaquopy/server/pypi/packages/cython-example/build/1.0/cp38-cp38-android_21_arm64_v8a/requirements/chaquopy/jniLibs
build-wheel: ln -s libsqlite3_chaquopy.so /home/atlas/chaquopy/server/pypi/packages/cython-example/build/1.0/cp38-cp38-android_21_arm64_v8a/requirements/chaquopy/lib/libsqlite3.so
build-wheel: ln -s libcrypto_chaquopy.so /home/atlas/chaquopy/server/pypi/packages/cython-example/build/1.0/cp38-cp38-android_21_arm64_v8a/requirements/chaquopy/lib/libcrypto.so
build-wheel: ln -s libssl_chaquopy.so /home/atlas/chaquopy/server/pypi/packages/cython-example/build/1.0/cp38-cp38-android_21_arm64_v8a/requirements/chaquopy/lib/libssl.so
build-wheel: ln -s libpython3.8.so /home/atlas/chaquopy/server/pypi/packages/cython-example/build/1.0/cp38-cp38-android_21_arm64_v8a/requirements/chaquopy/lib/libpython3..so
build-wheel: /home/atlas/chaquopy/server/pypi/build/_bootstrap/3.8/bin/pip --version
build-wheel: mkdir -p /home/atlas/chaquopy/server/pypi/packages/cython-example/build/1.0/cp38-cp38-android_21_arm64_v8a/env
build-wheel: python3.8 -m venv --without-pip /home/atlas/chaquopy/server/pypi/packages/cython-example/build/1.0/cp38-cp38-android_21_arm64_v8a/env
build-wheel: /home/atlas/chaquopy/server/pypi/build/_bootstrap/3.8/bin/pip --python /home/atlas/chaquopy/server/pypi/packages/cython-example/build/1.0/cp38-cp38-android_21_arm64_v8a/env/bin/python install cython==0.29.36 'setuptools >= 40.8.0' wheel
Collecting cython==0.29.36
  Obtaining dependency information for cython==0.29.36 from https://files.pythonhosted.org/packages/51/d2/acc8c151d71afedd9c0976704cf74a3f98fdccccf8ac6576b14ec6b945ac/Cython-0.29.36-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl.metadata
  Downloading Cython-0.29.36-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl.metadata (3.1 kB)
Collecting setuptools>=40.8.0
  Obtaining dependency information for setuptools>=40.8.0 from https://files.pythonhosted.org/packages/55/b3/b3a3415d2debd837106ed417f8681d8af63037fed367fa1b85dbfef081f1/setuptools-70.1.0-py3-none-any.whl.metadata
  Using cached setuptools-70.1.0-py3-none-any.whl.metadata (6.0 kB)
Collecting wheel
  Obtaining dependency information for wheel from https://files.pythonhosted.org/packages/7d/cd/d7460c9a869b16c3dd4e1e403cce337df165368c71d6af229a74699622ce/wheel-0.43.0-py3-none-any.whl.metadata
  Using cached wheel-0.43.0-py3-none-any.whl.metadata (2.2 kB)
Downloading Cython-0.29.36-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (1.9 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.9/1.9 MB 1.3 MB/s eta 0:00:00
Using cached setuptools-70.1.0-py3-none-any.whl (882 kB)
Using cached wheel-0.43.0-py3-none-any.whl (65 kB)
Installing collected packages: wheel, setuptools, cython
Successfully installed cython-0.29.36 setuptools-70.1.0 wheel-0.43.0
build-wheel: abi=arm64-v8a; api_level=21; prefix=/home/atlas/chaquopy/server/pypi/packages/cython-example/build/1.0/cp38-cp38-android_21_arm64_v8a/requirements/chaquopy; . /home/atlas/chaquopy/server/pypi/../../target/build-common.sh; export
build-wheel: mkdir -p /home/atlas/chaquopy/server/pypi/packages/cython-example/build/1.0/cp38-cp38-android_21_arm64_v8a/wrappers
Compiling hello.pyx because it changed.
[1/1] Cythonizing hello.pyx
/home/atlas/chaquopy/server/pypi/packages/cython-example/build/1.0/cp38-cp38-android_21_arm64_v8a/env/lib/python3.8/site-packages/Cython/Compiler/Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /home/atlas/chaquopy/server/pypi/packages/cython-example/build/1.0/cp38-cp38-android_21_arm64_v8a/src/hello.pyx
  tree = Parsing.p_module(s, pxd, full_module_name)
running egg_info
creating cython_example.egg-info
writing cython_example.egg-info/PKG-INFO
writing dependency_links to cython_example.egg-info/dependency_links.txt
writing top-level names to cython_example.egg-info/top_level.txt
writing manifest file 'cython_example.egg-info/SOURCES.txt'
reading manifest file 'cython_example.egg-info/SOURCES.txt'
writing manifest file 'cython_example.egg-info/SOURCES.txt'
build-wheel: abi=arm64-v8a; api_level=21; prefix=/home/atlas/chaquopy/server/pypi/packages/cython-example/build/1.0/cp38-cp38-android_21_arm64_v8a/requirements/chaquopy; . /home/atlas/chaquopy/server/pypi/../../target/build-common.sh; export
build-wheel: /home/atlas/.android/SDK/ndk/22.1.7171670/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar rc /home/atlas/chaquopy/server/pypi/packages/cython-example/build/1.0/cp38-cp38-android_21_arm64_v8a/requirements/chaquopy/lib/libpthread.a
build-wheel: /home/atlas/.android/SDK/ndk/22.1.7171670/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar rc /home/atlas/chaquopy/server/pypi/packages/cython-example/build/1.0/cp38-cp38-android_21_arm64_v8a/requirements/chaquopy/lib/librt.a
build-wheel: cd /home/atlas/chaquopy/server/pypi/packages/cython-example/build/1.0/cp38-cp38-android_21_arm64_v8a/src
build-wheel: Building with PEP 517
running bdist_wheel
running build
running build_ext
building 'hello' extension
creating build
creating build/temp.linux_aarch64-cpython-38
/home/atlas/chaquopy/server/pypi/packages/cython-example/build/1.0/cp38-cp38-android_21_arm64_v8a/wrappers/aarch64-linux-android21-clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -idirafter /home/atlas/chaquopy/server/pypi/packages/cython-example/build/1.0/cp38-cp38-android_21_arm64_v8a/requirements/chaquopy/include -idirafter /home/atlas/chaquopy/server/pypi/packages/cython-example/build/1.0/cp38-cp38-android_21_arm64_v8a/requirements/chaquopy/include/python3.8 -fPIC -I/home/atlas/chaquopy/server/pypi/packages/cython-example/build/1.0/cp38-cp38-android_21_arm64_v8a/env/include -I/home/atlas/.miniconda3/envs/python38/include/python3.8 -c hello.c -o build/temp.linux_aarch64-cpython-38/hello.o
in : ['/home/atlas/.android/SDK/ndk/22.1.7171670/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android21-clang', '-Wno-unused-result', '-Wsign-compare', '-Wunreachable-code', '-DNDEBUG', '-g', '-fwrapv', '-O3', '-Wall', '-idirafter', '/home/atlas/chaquopy/server/pypi/packages/cython-example/build/1.0/cp38-cp38-android_21_arm64_v8a/requirements/chaquopy/include', '-idirafter', '/home/atlas/chaquopy/server/pypi/packages/cython-example/build/1.0/cp38-cp38-android_21_arm64_v8a/requirements/chaquopy/include/python3.8', '-fPIC', '-I/home/atlas/chaquopy/server/pypi/packages/cython-example/build/1.0/cp38-cp38-android_21_arm64_v8a/env/include', '-I/home/atlas/.miniconda3/envs/python38/include/python3.8', '-c', 'hello.c', '-o', 'build/temp.linux_aarch64-cpython-38/hello.o']
out: ['/home/atlas/.android/SDK/ndk/22.1.7171670/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android21-clang', '-Wno-unused-result', '-Wsign-compare', '-Wunreachable-code', '-DNDEBUG', '-g', '-fwrapv', '-O3', '-Wall', '-idirafter', '/home/atlas/chaquopy/server/pypi/packages/cython-example/build/1.0/cp38-cp38-android_21_arm64_v8a/requirements/chaquopy/include', '-idirafter', '/home/atlas/chaquopy/server/pypi/packages/cython-example/build/1.0/cp38-cp38-android_21_arm64_v8a/requirements/chaquopy/include/python3.8', '-fPIC', '-I/home/atlas/chaquopy/server/pypi/packages/cython-example/build/1.0/cp38-cp38-android_21_arm64_v8a/env/include', '-I/home/atlas/.miniconda3/envs/python38/include/python3.8', '-c', 'hello.c', '-o', 'build/temp.linux_aarch64-cpython-38/hello.o']
In file included from hello.c:18:
/home/atlas/.miniconda3/envs/python38/include/python3.8/Python.h:44:10: fatal error: 'crypt.h' file not found
#include <crypt.h>
         ^~~~~~~~~
1 error generated.
error: command '/home/atlas/chaquopy/server/pypi/packages/cython-example/build/1.0/cp38-cp38-android_21_arm64_v8a/wrappers/aarch64-linux-android21-clang' failed with exit code 1
build-wheel: Error: Backend subprocess exited when trying to invoke build_wheel
mhsmith commented 4 days ago

From the "in" and "out" lines, it looks like you've edited compiler-wrapper.py. And your edits have obviously broken its functionality, because its entire purpose is to prevent Android compiler commands from using incompatible Linux include or lib directories from the build environment (/home/atlas/.miniconda3/envs/python38).

What have you changed, and why?