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

error building compiled components in netifaces #1539

Closed
subbNine opened this issue Dec 18, 2018 · 7 comments
Closed

error building compiled components in netifaces #1539

subbNine opened this issue Dec 18, 2018 · 7 comments

Comments

@subbNine
Copy link

Versions

  • Python: 2.7.13
  • OS: Buildozer VM
  • Kivy: 1.10

Description

I run into errors when i try to build an apk. The errors occur during the compilation of netifaces. without including netifaces as a requirement in buildozer.spec file the apk build process goes to completion, which confirms that the error is as a result of compling netifaces.

buildozer.spec

Command:

Spec file:
Requirement from buildozer.spec file

requirements = python2,kivy==master,git+https://gitlab.com/kivymd/KivyMD.git,netifaces

Logs

[INFO]:    Building netifaces for armeabi-v7a
[INFO]:    netifaces apparently isn't already in site-packages
[INFO]:    Building compiled components in netifaces
[INFO]:    -> directory context /home/kivy/.buildozer/android/platform/build/build/other_builds/netifaces-python2/armeabi-v7a/netifaces
[INFO]:    -> running hostpython setup.py build_ext -v
           working: error: command 'arm-linux-androideabi-gcc' failed with exit status 1                                                                                        Exception in thread background thread for pid 8512:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/threading.py", line 754, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/usr/local/lib/python2.7/dist-packages/sh.py", line 2170, in background_thread
    handle_exit_code(exit_code)
  File "/usr/local/lib/python2.7/dist-packages/sh.py", line 1929, in fn
    return self.command.handle_command_exit_code(exit_code)
  File "/usr/local/lib/python2.7/dist-packages/sh.py", line 672, in handle_command_exit_code
    raise exc
ErrorReturnCode_1: 

  RAN: /home/kivy/.buildozer/android/platform/build/build/other_builds/hostpython2/desktop/hostpython2/hostpython setup.py build_ext -v

  STDOUT:
running build_ext
checking for getifaddrs...not found. (cached)
checking for getnameinfo...not found. (cached)
checking for socket IOCTLs...not found. (cached)
checking for optional header files...netpacket/packet.h linux/atm.h. (cached)
checking whether struct sockaddr has a length field...no. (cached)
checking which sockaddr_xxx structs are defined...none! (cached)
checking for routing socket support...no. (cached)
checking for sysctl(CTL_NET...) support...no. (cached)
checking for netlink support...no. (cached)
building 'netifaces' extension
arm-linux-androideabi-gcc -DANDROID -mandroid -fomit-frame-pointer -D__ANDROID_API__=19 -I/home/kivy/.buildozer/android/platform/android-ndk-r9c/platforms/android-19/arch-arm -isysroot /home/kivy/.buildozer/android/platform/android-ndk-r9c/platforms/android-19/arch-arm -I/home/kivy/.buildozer/android/platform/build/build/python-installs/touchpadapp/include/python2.7 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DANDROID -mandroid -fomit-frame-pointer -D__ANDROID_API__=19 -I/home/kivy/.buildozer/android/platform/android-ndk-r9c/platforms/android-19/arch-arm -isysroot /home/kivy/.buildozer/android/platform/android-ndk-r9c/platforms/android-19/arch-arm -I/home/kivy/.buildozer/android/platform/build/build/python-installs/touchpadapp/include/python2.7 -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -mthumb -I/home/kivy/.buildozer/android/platform/build/build/python-installs/touchpadapp/include/python2.7 -fPIC -DNETIFACES_VERSION=0.10.4 -DHAVE_NETPACKET_PACKET_H=1 -DHAVE_LINUX_ATM_H=1 -I/home/kivy/.buildozer/android/platform/build/build/other_builds/hostpython2/desktop/hostpython2/Include -I/home/kivy/.buildozer/android/platform/build/build/other_builds/hostpython2/desktop/hostpython2 -c netifaces.c -o build/temp.linux-x86_64-2.7/netifaces.o
netifaces.c:185:6: error: #error You need to add code for your platform.
 #    error You need to add code for your platform.
      ^
netifaces.c: In function 'gateways':
netifaces.c:1213:22: warning: unused variable 'defaults' [-Wunused-variable]
   PyObject *result, *defaults;
                      ^
netifaces.c: At top level:
netifaces.c:316:1: warning: 'string_from_sockaddr' defined but not used [-Wunused-function]
 string_from_sockaddr (struct sockaddr *addr,
 ^
netifaces.c:446:1: warning: 'add_to_family' defined but not used [-Wunused-function]
 add_to_family (PyObject *result, int family, PyObject *obj)
 ^
error: command 'arm-linux-androideabi-gcc' failed with exit status 1


  STDERR:


Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/home/kivy/.buildozer/android/platform/python-for-android-new-toolchain/pythonforandroid/toolchain.py", line 978, in <module>
    main()
  File "/home/kivy/.buildozer/android/platform/python-for-android-new-toolchain/pythonforandroid/toolchain.py", line 975, in main
    ToolchainCL()
  File "/home/kivy/.buildozer/android/platform/python-for-android-new-toolchain/pythonforandroid/toolchain.py", line 512, in __init__
    getattr(self, args.subparser_name.replace('-', '_'))(args)
  File "/home/kivy/.buildozer/android/platform/python-for-android-new-toolchain/pythonforandroid/toolchain.py", line 149, in wrapper_func
    build_dist_from_args(ctx, dist, args)
  File "/home/kivy/.buildozer/android/platform/python-for-android-new-toolchain/pythonforandroid/toolchain.py", line 193, in build_dist_from_args
    build_recipes(build_order, python_modules, ctx)
  File "pythonforandroid/build.py", line 573, in build_recipes
  File "pythonforandroid/recipe.py", line 843, in build_arch
  File "pythonforandroid/recipe.py", line 855, in build_compiled_components
  File "pythonforandroid/logger.py", line 175, in shprint
  File "/usr/local/lib/python2.7/dist-packages/sh.py", line 720, in next
    self.wait()
  File "/usr/local/lib/python2.7/dist-packages/sh.py", line 651, in wait
    self.handle_command_exit_code(exit_code)
  File "/usr/local/lib/python2.7/dist-packages/sh.py", line 672, in handle_command_exit_code
    raise exc
sh.ErrorReturnCode_1: 

  RAN: /home/kivy/.buildozer/android/platform/build/build/other_builds/hostpython2/desktop/hostpython2/hostpython setup.py build_ext -v

  STDOUT:
running build_ext
checking for getifaddrs...not found. (cached)
checking for getnameinfo...not found. (cached)
checking for socket IOCTLs...not found. (cached)
checking for optional header files...netpacket/packet.h linux/atm.h. (cached)
checking whether struct sockaddr has a length field...no. (cached)
checking which sockaddr_xxx structs are defined...none! (cached)
checking for routing socket support...no. (cached)
checking for sysctl(CTL_NET...) support...no. (cached)
checking for netlink support...no. (cached)
building 'netifaces' extension
arm-linux-androideabi-gcc -DANDROID -mandroid -fomit-frame-pointer -D__ANDROID_API__=19 -I/home/kivy/.buildozer/android/platform/android-ndk-r9c/platforms/android-19/arch-arm -isysroot /home/kivy/.buildozer/android/platform/android-ndk-r9c/platforms/android-19/arch-arm -I/home/kivy/.buildozer/android/platform/build/build/python-installs/touchpadapp/include/python2.7 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DANDROID -mandroid -fomit-frame-pointer -D__ANDROID_API__=19 -I/home/kivy/.buildozer/android/platform/android-ndk-r9c/platforms/android-19/arch-arm -isysroot /home/kivy/.buildozer/android/platform/android-ndk-r9c/platforms/android-19/arch-arm -I/home/kivy/.buildozer/android/platform/build/build/python-installs/touchpadapp/include/python2.7 -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -mthumb -I/home/kivy/.buildozer/android/platform/build/build/python-installs/touchpadapp/include/python2.7 -fPIC -DNETIFACES_VERSION=0.10.4 -DHAVE_NETPACKET_PACKET_H=1 -DHAVE_LINUX_ATM_H=1 -I/home/kivy/.buildozer/android/platform/build/build/other_builds/hostpython2/desktop/hostpython2/Include -I/home/kivy/.buildozer/android/platform/build/build/other_builds/hostpython2/desktop/hostpython2 -c netifaces.c -o build/temp.linux-x86_64-2.7/netifaces.o
netifaces.c:185:6: error: #error You need to add code for your platform.
 #    error You need to add code for your platform.
      ^
netifaces.c: In function 'gateways':
netifaces.c:1213:22: warning: unused variable 'defaults' [-Wunused-variable]
   PyObject *result, *defaults;
                      ^
netifaces.c: At top level:
netifaces.c:316:1: warning: 'string_from_sockaddr' defined but not used [-Wunused-function]
 string_from_sockaddr (struct sockaddr *addr,
 ^
netifaces.c:446:1: warning: 'add_to_family' defined but not used [-Wunused-function]
 add_to_family (PyObject *result, int family, PyObject *obj)
 ^
error: command 'arm-linux-androideabi-gcc' failed with exit status 1


  STDERR:

# Command failed: /usr/bin/python -m pythonforandroid.toolchain create --dist_name=touchpadapp --bootstrap=sdl2 --requirements=python2,kivy==master,git+https://gitlab.com/kivymd/KivyMD.git,netifaces --arch armeabi-v7a --copy-libs --color=always --storage-dir=/home/kivy/.buildozer/android/platform/build
# 
# Buildozer failed to execute the last command
# The error might be hidden in the log above this error
# Please read the full log, and search for it before
# raising an issue with buildozer itself.
# In case of a bug report, please add a full log with log_level = 2

@AndreMiras
Copy link
Member

Yes netifaces recipe seems pretty unmaintaned, last commit is from summer 2016 96edc06.
It's even disabled in Travis: https://github.com/kivy/python-for-android/blob/5f66527/ci/constants.py#L40
So contributions to fix it are welcome 😄
http://srujansv-blog.tumblr.com/post/125383612642/fixing-netifaces-error-you-need-to-add-code-for

@inclement
Copy link
Member

We should fix netifaces or just remove the recipe. If the project is really not active any more, probably the latter.

@subbNine
Copy link
Author

subbNine commented Feb 4, 2019

oh my! I would prefer we fix it please. that's the only library i know of that i can use to get the IP address from an android device. Using netifaces on PyDroid, does exactly what i want. PyDroid is a python interpreter for android devices.

@AndreMiras
Copy link
Member

We still accept pull request contributions @princeIta 😄

@opacam
Copy link
Member

opacam commented Feb 4, 2019

@AndreMiras, I think that netifaces should work now, at least the compilation issues should be gone, it was fixed in here: #1549

@princeIta, please, can you check again if netifaces works for you and close this issue if that it's the case? I just made a build with netifaces and python2 without problems...

Note: be aware that you need to change your android's ndk to version r17c...also you should check the following variables in your buildozer.spec file:

android.api = 28
android.minapi = 21

I see that your minapi is set to 19, and that was for the old python recipe...now we use 21 (that it's important because otherwise you will not be able to successfully build the python recipe).

@AndreMiras
Copy link
Member

Thanks @opacam I confirm I could build it in Docker with the following command:

python setup_testapp_python3.py apk --sdk-dir $ANDROID_SDK_HOME --ndk-dir $ANDROID_NDK_HOME --requirements python3,kivy,netifaces

I'm not sure why it's still in the the ci/constants.py however. I'll check if it builds in Travis and PR

AndreMiras added a commit to AndreMiras/python-for-android that referenced this issue Feb 4, 2019
AndreMiras added a commit to AndreMiras/python-for-android that referenced this issue Feb 4, 2019
Only `python2` build fails with:
```
  RAN: /home/user/.local/share/python-for-android/build/other_builds/hostpython2/desktop/hostpython2/native-build/python setup.py build_ext -v

  STDOUT:
Traceback (most recent call last):
  File "setup.py", line 1, in <module>
    import setuptools
ImportError: No module named setuptools
```
@AndreMiras
Copy link
Member

Proof it's building in https://api.travis-ci.org/v3/job/488531781/log.txt via #1675

AndreMiras added a commit that referenced this issue Feb 4, 2019
…_recipe

Bumps netiffaces version & removes from broken list, refs #1539
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