Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trying to build pandas with buildozer results in missing headers errors #2626

Closed
aki-k opened this issue Jun 27, 2022 · 7 comments
Closed

Trying to build pandas with buildozer results in missing headers errors #2626

aki-k opened this issue Jun 27, 2022 · 7 comments

Comments

@aki-k
Copy link

aki-k commented Jun 27, 2022

Software Versions

  • Python: 3.8.10
  • OS: Ubuntu Linux 20.04.4
  • Kivy: 2.1.0
  • Kivy installation method: buildozer

Describe the bug
I get missing header error messages with "buildozer android debug"

In file included from pandas/_libs/window/aggregations.cpp:41:
/home/aki/p4a_pandas_test/.buildozer/android/platform/build-armeabi-v7a/build/other_builds/python3-libbz2-liblzma/armeabi-v7a__ndk_target_21/python3/Include/Python.h:14:2: error: "Something's broken.  UCHAR_MAX should be defined in limits.h."
#error "Something's broken.  UCHAR_MAX should be defined in limits.h."
 ^
/home/aki/p4a_pandas_test/.buildozer/android/platform/build-armeabi-v7a/build/other_builds/python3-libbz2-liblzma/armeabi-v7a__ndk_target_21/python3/Include/Python.h:18:2: error: "Python's source code assumes C's unsigned char is an 8-bit type."
#error "Python's source code assumes C's unsigned char is an 8-bit type."
 ^
/home/aki/p4a_pandas_test/.buildozer/android/platform/build-armeabi-v7a/build/other_builds/python3-libbz2-liblzma/armeabi-v7a__ndk_target_21/python3/Include/Python.h:27:5: error: "Python.h requires that stdio.h define NULL."
#   error "Python.h requires that stdio.h define NULL."
    ^
In file included from pandas/_libs/window/aggregations.cpp:41:
In file included from /home/aki/p4a_pandas_test/.buildozer/android/platform/build-armeabi-v7a/build/other_builds/python3-libbz2-liblzma/armeabi-v7a__ndk_target_21/python3/Include/Python.h:30:
/home/aki/.buildozer/android/platform/android-ndk-r23c/sources/cxx-stl/llvm-libc++/include/string.h:73:64: error: use of undeclared identifier 'strchr'
char* __libcpp_strchr(const char* __s, int __c) {return (char*)strchr(__s, __c);}
                                                               ^
/home/aki/.buildozer/android/platform/android-ndk-r23c/sources/cxx-stl/llvm-libc++/include/string.h:80:75: error: use of undeclared identifier 'strpbrk'
char* __libcpp_strpbrk(const char* __s1, const char* __s2) {return (char*)strpbrk(__s1, __s2);}
                                                                          ^
/home/aki/.buildozer/android/platform/android-ndk-r23c/sources/cxx-stl/llvm-libc++/include/string.h:87:65: error: use of undeclared identifier 'strrchr'; did you mean 'strchr'?
char* __libcpp_strrchr(const char* __s, int __c) {return (char*)strrchr(__s, __c);}
                                                                ^

Expected behavior
I was expecting pandas to build into an APK file together with Kivy.

To Reproduce
I setup buildozer + needed Ubuntu packages and then I cloned https://github.com/tshirtman/p4a_pandas_test
Then I changed unpacked = 'android-ndk-r23c' and archive = 'android-ndk-r23c-linux.zip' in /home/aki/.local/lib/python3.8/site-packages/buildozer/targets/android.py
After that I ran buildozer android debug.

Code and Logs and screenshots
Here is my buildozer.spec and
build output

Additional context
I tried to fix the headers errors by modifying the code to #include "full path/limits.h" and got a little
further with the compile but I don't think it's the correct fix.

I tried to get help in Kivy discord but was unable to get the build working.

@misl6 misl6 transferred this issue from kivy/kivy Jun 27, 2022
@misl6
Copy link
Member

misl6 commented Jun 27, 2022

Hi @aki-k ,
I've transferred your original issue to python-for-android, as it's not directly related to kivy/kivy.

There's a chance that the pandas recipe needs to be updated to work on top of the latest changes available on the develop branch.

I will keep the issue open, and tag it as "need-analysis", meanwhile, did you tried to use the latest stable version of python-for-android?

@aki-k
Copy link
Author

aki-k commented Jun 27, 2022

@misl6

I'm not sure where to set the version of python-for-android. Do you set it in the spec file as

# (str) python-for-android fork to use, defaults to upstream (kivy) 
#p4a.fork = kivy

@misl6
Copy link
Member

misl6 commented Jun 27, 2022

# (str) python-for-android branch to use, defaults to master
p4a.branch = develop

Instead of develop you may want to target master.
Feel free to join us on Discord if you need some additional guidance 😃

@Android-for-Python
Copy link

I can confirm this is p4a=develop only, p4a=master is good.

#error "Something's broken.  UCHAR_MAX should be defined in limits.h."
#error "Python's source code assumes C's unsigned char is an 8-bit type."
#   error "Python.h requires that stdio.h define NULL."

@aki-k
Copy link
Author

aki-k commented Jul 3, 2022

Changing the NDK version to r19c fixed this problem for me (and also p4a.branch = master).

@aki-k aki-k closed this as completed Jul 3, 2022
@Aden-w
Copy link

Aden-w commented Sep 21, 2022

Changing the NDK version to r19c and p4a.branch = master , the problems still exist.....

@aki-k
Copy link
Author

aki-k commented Sep 23, 2022

I made it work in a bit different way:

install as root:

apt install --no-install-recommends autoconf automake
autopoint build-essential ccache cmake gettext git
libffi-dev libltdl-dev libssl-dev liblzma-dev libtool
openjdk-13-jdk patch pkg-config sudo unzip zip
python3-pip python3-setuptools zlib1g-dev lld gfortran

install as user:

pip3 install --user --upgrade Cython==0.29.19 virtualenv buildozer

. ${HOME}/.profile

git clone https://github.com/tshirtman/p4a_pandas_test
cd p4a_pandas_test

edit p4a_pandas_test/buildozer.spec:

android.ndk = 23b
p4a.branch = develop
android.gradle_dependencies = "androidx.work:work-runtime:2.2.0", "androidx.annotation:annotation:1.1.0"
android.enable_androidx = True # (the only setting that didn't exist in the spec file by default)

yes | buildozer android debug

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants