question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

error building compiled components in netifaces

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
AndreMirascommented, Feb 4, 2019

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

1reaction
opacamcommented, Feb 4, 2019

@AndreMiras, I think that netifaces should work now, at least the compilation issues should be gone, it was fixed in here: https://github.com/kivy/python-for-android/pull/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).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Developers - netifaces recipe broken - - Bountysource
NetifacesRecipe'>) [INFO]: netifaces apparently isn't already in site-packages [INFO]: Building compiled components in netifaces ccache found, will optimize ...
Read more >
Why is my pip install not installing netifaces - Stack Overflow
ERROR: Failed building wheel for netifaces Running setup.py clean for netifaces Failed to build netifaces Installing collected packages: ...
Read more >
Could not install dependency netdisco - Development
First try to install netdisco manually with pip, possibly getting some more verbose error logging. You might be missing a build dependency for ......
Read more >
Python 3 Microsoft Visual C++ 14.0 is required
How to fix the error Visual C++ 14.0 required by installing Microsoft Visual C++ Build Tools.
Read more >
Package List — Spack 0.20.0.dev0 documentation
Versions: main, 1.1.4, 1.1.3, 1.0.2; Build Dependencies: pkgconfig, conmon, squashfs, go, uuid, libgpg-error, libseccomp, git, cryptsetup ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found