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

building apk failes ( python 3 ) #746

Closed
rahnamaj22 opened this issue May 18, 2016 · 12 comments
Closed

building apk failes ( python 3 ) #746

rahnamaj22 opened this issue May 18, 2016 · 12 comments

Comments

@rahnamaj22
Copy link

rahnamaj22 commented May 18, 2016

im trying to build an app { using python 3 } :
--bootstrap=sdl2 --requirements=sdl2,python3crystax,kivy

and i get this error :

`[INFO]:    -> running python3.5 -c import sys; print(sys.path)
cwd is /root/.local/share/python-for-android/build/other_builds/pyjnius-python3crystax-sdl2/armeabi/pyjnius                                                            
[INFO]:    Trying first build of pyjnius to get cython files: this is expected to fail
[INFO]:    -> running python3.5 setup.py build_ext -v

[INFO]:    pyjnius first build failed (as expected)
[INFO]:    Running cython where appropriate
[INFO]:    Cythonize jnius/jnius.pyx
[INFO]:    -> running cython ./jnius/jnius.pyx
[INFO]:    -> running python3.5 setup.py build_ext -v
[INFO]:    STDOUT:                                                                                                                                                 /usr/lib/python3.5/site-packages/setuptools/dist.py:285: UserWarning: Normalizing 1.1-dev to 1.1.dev0

  normalized_version,                                                                                                                                                  
running build_ext                                                                                                                                                      
skipping 'jnius/jnius.c' Cython extension (up-to-date)
building 'jnius' extension
/bin/ccache arm-linux-androideabi-gcc -DANDROID -mandroid -fomit-frame-pointer --sysroot /home/mohammadj22/crystax-ndk-10.3.1/platforms/android-15/arch-arm -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -I/home/mohammadj22/crystax-ndk-10.3.1/sources/python/3.5/include/python -DANDROID -mandroid -fomit-frame-pointer --sysroot /home/mohammadj22/crystax-ndk-10.3.1/platforms/android-15/arch-arm -fPIC -I/usr/include/python3.5m -c jnius/jnius.c -o build/temp.linux-x86_64-3.5/jnius/jnius.o
arm-linux-androideabi-gcc: error: unrecognized argument in option '-mtune=generic'
arm-linux-androideabi-gcc: note: valid arguments to '-mtune=' are: arm1020e arm1020t arm1022e arm1026ej-s arm10e arm10tdmi arm1136j-s arm1136jf-s arm1156t2-s arm1156t2f-s arm1176jz-s arm1176jzf-s arm2 arm250 arm3 arm6 arm60 arm600 arm610 arm620 arm7 arm70 arm700 arm700i arm710 arm7100 arm710c arm710t arm720 arm720t arm740t arm7500 arm7500fe arm7d arm7di arm7dm arm7dmi arm7m arm7tdmi arm7tdmi-s arm8 arm810 arm9 arm920 arm920t arm922t arm926ej-s arm940t arm946e-s arm966e-s arm968e-s arm9e arm9tdmi cortex-a12 cortex-a15 cortex-a15.cortex-a7 cortex-a17 cortex-a17.cortex-a7 cortex-a5 cortex-a53 cortex-a57 cortex-a57.cortex-a53 cortex-a7 cortex-a72 cortex-a72.cortex-a53 cortex-a8 cortex-a9 cortex-m0 cortex-m0.small-multiply cortex-m0plus cortex-m0plus.small-multiply cortex-m1 cortex-m1.small-multiply cortex-m3 cortex-m4 cortex-m7 cortex-r4 cortex-r4f cortex-r5 cortex-r7 ep9312 exynos-m1 fa526 fa606te fa626 fa626te fa726te fmp626 generic-armv7-a iwmmxt iwmmxt2 marvell-pj4 mpcore mpcorenovfp native strongarm strongarm110 strongarm1100 strongarm1110 xgene1 xscale
error: command '/bin/ccache' failed with exit status 1
[INFO]:    STDERR:

[INFO]:    COMMAND:
cd /root/.local/share/python-for-android/build/other_builds/pyjnius-python3crystax-sdl2/armeabi/pyjnius && /bin/python3.5 setup.py build_ext -v

[WARNING]: ERROR: /bin/python3.5 failed!
`

full log :

`sudo python-for-android apk --private /home/mohammadj22/A*/UI2/this/  --package=org.mohammad.newpuzzle --name="newpuzzle" --version=0.15 --bootstrap=sdl2 --requirements=sdl2,python3crystax,kivy,jnius --dist_name=new1 --sdk_dir=/home/mohammadj22/AndroidSDK/  --ndk_dir=/home/mohammadj22/crystax-ndk-10.3.1/  --android_api=15  --mtune=arm8
[INFO]:    This python-for-android revamp is an experimental alpha release!
[INFO]:    It should work (mostly), but you may experience missing features or bugs.
/usr/lib64/python3.5/re.py:203: FutureWarning: split() requires a non-empty pattern match.
  return _compile(pattern, flags).split(string, maxsplit)
[INFO]:    Will compile for the following archs: armeabi
[INFO]:    Getting Android API version from user argument
[INFO]:    Available Android APIs are (15)
[INFO]:    Requested API target 15 is available, continuing.
[INFO]:    Getting NDK dir from from user argument
[INFO]:    Got NDK version from $ANDROIDNDKVER
[INFO]:    Got Android NDK version from the NDK dir: it is 10.3.1
[INFO]:    Using Crystax NDK 10.3.1
[INFO]:    Found virtualenv at /bin/virtualenv
[INFO]:    Found the following toolchain versions: ['4.9', '5', 'clang3.6', 'clang3.7']
[INFO]:    Picking the latest gcc toolchain, here 5
[INFO]:    No existing dists meet the given requirements!
[INFO]:    No dist exists that meets your requirements, so one will be built.
[INFO]:    Bootstrap requires recipes ['sdl2', ('python2', 'python3crystax')]
[INFO]:    Loaded recipe kivy (depends on [('python2', 'python3crystax'), ('sdl2', 'pygame'), 'pyjnius'])
[INFO]:    No recipe named jnius; will attempt to install with pip
[INFO]:    Loaded recipe sdl2 (depends on [('python2', 'python3crystax'), 'sdl2_image', 'sdl2_mixer', 'sdl2_ttf'], conflicts ['sdl', 'pygame', 'pygame_bootstrap_components'])
[INFO]:    Loaded recipe python3crystax (depends on ['hostpython3crystax'], conflicts ['python2', 'python3'])
[INFO]:    Loaded recipe pyjnius (depends on [('python2', 'python3crystax'), 'six', ('sdl2', 'sdl', 'webviewjni')])
[INFO]:    Loaded recipe sdl2_image (depends on [])
[INFO]:    Loaded recipe sdl2_mixer (depends on [])
[INFO]:    Loaded recipe sdl2_ttf (depends on [])
[INFO]:    Loaded recipe hostpython3crystax (depends on [], conflicts ['hostpython2'])
[INFO]:    Loaded recipe six (depends on [('python2', 'python3crystax')])
[INFO]:    Found a single valid recipe set (this is good)
[INFO]:    The selected bootstrap is sdl2
[INFO]:    # Creating dist with sdl2 bootstrap
[INFO]:    Dist will have name new1 and recipes (sdl2, python3crystax, kivy, jnius)
[INFO]:    -> running cp -r /usr/lib/python3.5/site-packages/pythonforandroid/bootstraps/sdl2/build /root/.local/share/python-for-android/bu...(and 40 more)
[INFO]:    -> directory context /root/.local/share/python-for-android/build/bootstrap_builds/sdl2-python3crystax
[INFO]:    <- directory context /home/mohammadj22/A*/UI2/this
[INFO]:    Recipe build order is ['hostpython3crystax', 'sdl2_image', 'sdl2_mixer', 'sdl2_ttf', 'python3crystax', 'sdl2', 'six', 'pyjnius', 'kivy']
[INFO]:    The requirements (jnius) were not found as recipes, they will be installed with pip.
[INFO]:    # Downloading recipes 
[INFO]:    Downloading hostpython3crystax
[INFO]:    Skipping hostpython3crystax download as no URL is set
[INFO]:    Downloading sdl2_image
[INFO]:    -> running mkdir -p /root/.local/share/python-for-android/packages/sdl2_image
[INFO]:    -> directory context /root/.local/share/python-for-android/packages/sdl2_image
[INFO]:    -> running basename https://www.libsdl.org/projects/SDL_image/release/SDL2_image-2.0.1.tar.gz
[INFO]:    sdl2_image download already cached, skipping                                                                                                                
[WARNING]: Should check headers here! Skipping for now.
[INFO]:    <- directory context /home/mohammadj22/A*/UI2/this
[INFO]:    Downloading sdl2_mixer
[INFO]:    -> running mkdir -p /root/.local/share/python-for-android/packages/sdl2_mixer
[INFO]:    -> directory context /root/.local/share/python-for-android/packages/sdl2_mixer
[INFO]:    -> running basename https://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-2.0.1.tar.gz
[INFO]:    sdl2_mixer download already cached, skipping                                                                                                                
[WARNING]: Should check headers here! Skipping for now.
[INFO]:    <- directory context /home/mohammadj22/A*/UI2/this
[INFO]:    Downloading sdl2_ttf
[INFO]:    -> running mkdir -p /root/.local/share/python-for-android/packages/sdl2_ttf
[INFO]:    -> directory context /root/.local/share/python-for-android/packages/sdl2_ttf
[INFO]:    -> running basename https://www.libsdl.org/projects/SDL_ttf/release/SDL2_ttf-2.0.14.tar.gz
[INFO]:    sdl2_ttf download already cached, skipping                                                                                                                  
[WARNING]: Should check headers here! Skipping for now.
[INFO]:    <- directory context /home/mohammadj22/A*/UI2/this
[INFO]:    Downloading python3crystax
[INFO]:    -> running mkdir -p /root/.local/share/python-for-android/packages/python3crystax
[INFO]:    -> directory context /root/.local/share/python-for-android/packages/python3crystax
[INFO]:    -> running basename 
[WARNING]: Should check headers here! Skipping for now.
Downloading python3crystax from 
[INFO]:    -> running rm -f .mark-
[INFO]:    -> running touch .mark-
[INFO]:    <- directory context /home/mohammadj22/A*/UI2/this
[INFO]:    Downloading sdl2
[INFO]:    -> running mkdir -p /root/.local/share/python-for-android/packages/sdl2
[INFO]:    -> directory context /root/.local/share/python-for-android/packages/sdl2
[INFO]:    -> running basename https://www.libsdl.org/release/SDL2-2.0.4.tar.gz
[INFO]:    sdl2 download already cached, skipping                                                                                                                      
[WARNING]: Should check headers here! Skipping for now.
[INFO]:    <- directory context /home/mohammadj22/A*/UI2/this
[INFO]:    Downloading six
[INFO]:    -> running mkdir -p /root/.local/share/python-for-android/packages/six
[INFO]:    -> directory context /root/.local/share/python-for-android/packages/six
[INFO]:    -> running basename https://pypi.python.org/packages/source/s/six/six-1.9.0.tar.gz
[INFO]:    six download already cached, skipping                                                                                                                       
[WARNING]: Should check headers here! Skipping for now.
[INFO]:    <- directory context /home/mohammadj22/A*/UI2/this
[INFO]:    Downloading pyjnius
[INFO]:    -> running mkdir -p /root/.local/share/python-for-android/packages/pyjnius
[INFO]:    -> directory context /root/.local/share/python-for-android/packages/pyjnius
[INFO]:    -> running basename https://github.com/kivy/pyjnius/archive/master.zip
[INFO]:    pyjnius download already cached, skipping                                                                                                                   
[WARNING]: Should check headers here! Skipping for now.
[INFO]:    <- directory context /home/mohammadj22/A*/UI2/this
[INFO]:    Downloading kivy
[INFO]:    -> running mkdir -p /root/.local/share/python-for-android/packages/kivy
[INFO]:    -> directory context /root/.local/share/python-for-android/packages/kivy
[INFO]:    -> running basename https://github.com/kivy/kivy/archive/master.zip
[INFO]:    kivy download already cached, skipping                                                                                                                      
[WARNING]: Should check headers here! Skipping for now.
[INFO]:    <- directory context /home/mohammadj22/A*/UI2/this
[INFO]:    # Building all recipes for arch armeabi
[INFO]:    # Unpacking recipes
[INFO]:    Unpacking hostpython3crystax for armeabi
[INFO]:    Skipping hostpython3crystax unpack as no URL is set
[INFO]:    Unpacking sdl2_image for armeabi
[INFO]:    -> running basename https://www.libsdl.org/projects/SDL_image/release/SDL2_image-2.0.1.tar.gz
[INFO]:    -> directory context /root/.local/share/python-for-android/build/bootstrap_builds/sdl2-python3crystax/jni                                                   
[INFO]:    sdl2_image is already unpacked, skipping
[INFO]:    <- directory context /home/mohammadj22/A*/UI2/this
[INFO]:    Unpacking sdl2_mixer for armeabi
[INFO]:    -> running basename https://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-2.0.1.tar.gz
[INFO]:    -> directory context /root/.local/share/python-for-android/build/bootstrap_builds/sdl2-python3crystax/jni                                                   
[INFO]:    sdl2_mixer is already unpacked, skipping
[INFO]:    <- directory context /home/mohammadj22/A*/UI2/this
[INFO]:    Unpacking sdl2_ttf for armeabi
[INFO]:    -> running basename https://www.libsdl.org/projects/SDL_ttf/release/SDL2_ttf-2.0.14.tar.gz
[INFO]:    -> directory context /root/.local/share/python-for-android/build/bootstrap_builds/sdl2-python3crystax/jni                                                   
[INFO]:    sdl2_ttf is already unpacked, skipping
[INFO]:    <- directory context /home/mohammadj22/A*/UI2/this
[INFO]:    Unpacking python3crystax for armeabi
[INFO]:    -> running basename 
[INFO]:    -> directory context /root/.local/share/python-for-android/build/other_builds/python3crystax-version3.5/armeabi
[INFO]:    python3crystax is already unpacked, skipping
[INFO]:    <- directory context /home/mohammadj22/A*/UI2/this
[INFO]:    Unpacking sdl2 for armeabi
[INFO]:    -> running basename https://www.libsdl.org/release/SDL2-2.0.4.tar.gz
[INFO]:    -> directory context /root/.local/share/python-for-android/build/bootstrap_builds/sdl2-python3crystax/jni                                                   
[INFO]:    sdl2 is already unpacked, skipping
[INFO]:    <- directory context /home/mohammadj22/A*/UI2/this
[INFO]:    Unpacking six for armeabi
[INFO]:    -> running basename https://pypi.python.org/packages/source/s/six/six-1.9.0.tar.gz
[INFO]:    -> directory context /root/.local/share/python-for-android/build/other_builds/six-python3crystax/armeabi                                                    
[INFO]:    six is already unpacked, skipping
[INFO]:    <- directory context /home/mohammadj22/A*/UI2/this
[INFO]:    Unpacking pyjnius for armeabi
[INFO]:    -> running basename https://github.com/kivy/pyjnius/archive/master.zip
[INFO]:    -> directory context /root/.local/share/python-for-android/build/other_builds/pyjnius-python3crystax-sdl2/armeabi                                           
[INFO]:    pyjnius is already unpacked, skipping
[INFO]:    <- directory context /home/mohammadj22/A*/UI2/this
[INFO]:    Unpacking kivy for armeabi
[INFO]:    -> running basename https://github.com/kivy/kivy/archive/master.zip
[INFO]:    -> directory context /root/.local/share/python-for-android/build/other_builds/kivy-python3crystax-sdl2/armeabi                                              
[INFO]:    kivy is already unpacked, skipping
[INFO]:    <- directory context /home/mohammadj22/A*/UI2/this
[INFO]:    # Prebuilding recipes
[INFO]:    Prebuilding hostpython3crystax for armeabi
[INFO]:    hostpython3crystax has no prebuild_armeabi, skipping
[INFO]:    Prebuilding sdl2_image for armeabi
[INFO]:    sdl2_image has no prebuild_armeabi, skipping
[INFO]:    Applying patches for sdl2_image[armeabi]
[INFO]:    sdl2_image already patched, skipping
[INFO]:    Prebuilding sdl2_mixer for armeabi
[INFO]:    sdl2_mixer has no prebuild_armeabi, skipping
[INFO]:    Applying patches for sdl2_mixer[armeabi]
[INFO]:    sdl2_mixer already patched, skipping
[INFO]:    Prebuilding sdl2_ttf for armeabi
[INFO]:    sdl2_ttf has no prebuild_armeabi, skipping
[INFO]:    Prebuilding python3crystax for armeabi
[INFO]:    python3crystax has no prebuild_armeabi, skipping
[INFO]:    Prebuilding sdl2 for armeabi
[INFO]:    sdl2 has no prebuild_armeabi, skipping
[INFO]:    Applying patches for sdl2[armeabi]
[INFO]:    sdl2 already patched, skipping
[INFO]:    Prebuilding six for armeabi
[INFO]:    six has no prebuild_armeabi, skipping
[INFO]:    Prebuilding pyjnius for armeabi
[INFO]:    pyjnius has no prebuild_armeabi, skipping
[INFO]:    Applying patches for pyjnius[armeabi]
[INFO]:    pyjnius already patched, skipping
[INFO]:    Prebuilding kivy for armeabi
[INFO]:    kivy has no prebuild_armeabi, skipping
[INFO]:    # Building recipes
[INFO]:    Building hostpython3crystax for armeabi
[INFO]:    Building sdl2_image for armeabi
[INFO]:    Building sdl2_mixer for armeabi
[INFO]:    Building sdl2_ttf for armeabi
[INFO]:    Building python3crystax for armeabi
[INFO]:    Extracting CrystaX python3 from NDK package
[INFO]:    Building sdl2 for armeabi
ccache found, will optimize builds
path is /home/mohammadj22/crystax-ndk-10.3.1/toolchains/arm-linux-androideabi-5/prebuilt/linux-x86/bin/:/home/mohammadj22/crystax-ndk-10.3.1/toolchains/arm-linux-androideabi-5/prebuilt/linux-x86_64/bin/:/home/mohammadj22/crystax-ndk-10.3.1:/home/mohammadj22/AndroidSDK/tools:/sbin:/bin:/usr/sbin:/usr/bin
[INFO]:    -> directory context /root/.local/share/python-for-android/build/bootstrap_builds/sdl2-python3crystax/jni
[INFO]:    -> running ndk-build V=1
[INFO]:    <- directory context /home/mohammadj22/A*/UI2/this                                                                                                          
[INFO]:    Building six for armeabi
name is None <class 'pythonforandroid.recipes.six.SixRecipe'>
[INFO]:    Python package already exists in site-packages
[INFO]:    six said it is already built, skipping
[INFO]:    Building pyjnius for armeabi
name is jnius <class 'pythonforandroid.recipes.pyjnius.PyjniusRecipe'>
[INFO]:    jnius apparently isn't already in site-packages
[INFO]:    Cythonizing anything necessary in pyjnius
ccache found, will optimize builds
path is /home/mohammadj22/crystax-ndk-10.3.1/toolchains/arm-linux-androideabi-5/prebuilt/linux-x86/bin/:/home/mohammadj22/crystax-ndk-10.3.1/toolchains/arm-linux-androideabi-5/prebuilt/linux-x86_64/bin/:/home/mohammadj22/crystax-ndk-10.3.1:/home/mohammadj22/AndroidSDK/tools:/sbin:/bin:/usr/sbin:/usr/bin
[INFO]:    -> directory context /root/.local/share/python-for-android/build/other_builds/pyjnius-python3crystax-sdl2/armeabi/pyjnius
[INFO]:    -> running python3.5 -c import sys; print(sys.path)
cwd is /root/.local/share/python-for-android/build/other_builds/pyjnius-python3crystax-sdl2/armeabi/pyjnius                                                            
[INFO]:    Trying first build of pyjnius to get cython files: this is expected to fail
[INFO]:    -> running python3.5 setup.py build_ext -v

[INFO]:    pyjnius first build failed (as expected)
[INFO]:    Running cython where appropriate
[INFO]:    Cythonize jnius/jnius.pyx
[INFO]:    -> running cython ./jnius/jnius.pyx
[INFO]:    -> running python3.5 setup.py build_ext -v
[INFO]:    STDOUT:                                                                                                                                                     
        /usr/lib/python3.5/site-packages/setuptools/dist.py:285: UserWarning: Normalizing '1.1-dev' to '1.1.dev0'
  normalized_version,                                                                                                                                                   
running build_ext                                                                                                                                                       
skipping 'jnius/jnius.c' Cython extension (up-to-date)
building 'jnius' extension
/bin/ccache arm-linux-androideabi-gcc -DANDROID -mandroid -fomit-frame-pointer --sysroot /home/mohammadj22/crystax-ndk-10.3.1/platforms/android-15/arch-arm -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -I/home/mohammadj22/crystax-ndk-10.3.1/sources/python/3.5/include/python -DANDROID -mandroid -fomit-frame-pointer --sysroot /home/mohammadj22/crystax-ndk-10.3.1/platforms/android-15/arch-arm -fPIC -I/usr/include/python3.5m -c jnius/jnius.c -o build/temp.linux-x86_64-3.5/jnius/jnius.o
arm-linux-androideabi-gcc: error: unrecognized argument in option '-mtune=generic'
arm-linux-androideabi-gcc: note: valid arguments to '-mtune=' are: arm1020e arm1020t arm1022e arm1026ej-s arm10e arm10tdmi arm1136j-s arm1136jf-s arm1156t2-s arm1156t2f-s arm1176jz-s arm1176jzf-s arm2 arm250 arm3 arm6 arm60 arm600 arm610 arm620 arm7 arm70 arm700 arm700i arm710 arm7100 arm710c arm710t arm720 arm720t arm740t arm7500 arm7500fe arm7d arm7di arm7dm arm7dmi arm7m arm7tdmi arm7tdmi-s arm8 arm810 arm9 arm920 arm920t arm922t arm926ej-s arm940t arm946e-s arm966e-s arm968e-s arm9e arm9tdmi cortex-a12 cortex-a15 cortex-a15.cortex-a7 cortex-a17 cortex-a17.cortex-a7 cortex-a5 cortex-a53 cortex-a57 cortex-a57.cortex-a53 cortex-a7 cortex-a72 cortex-a72.cortex-a53 cortex-a8 cortex-a9 cortex-m0 cortex-m0.small-multiply cortex-m0plus cortex-m0plus.small-multiply cortex-m1 cortex-m1.small-multiply cortex-m3 cortex-m4 cortex-m7 cortex-r4 cortex-r4f cortex-r5 cortex-r7 ep9312 exynos-m1 fa526 fa606te fa626 fa626te fa726te fmp626 generic-armv7-a iwmmxt iwmmxt2 marvell-pj4 mpcore mpcorenovfp native strongarm strongarm110 strongarm1100 strongarm1110 xgene1 xscale
error: command '/bin/ccache' failed with exit status 1
[INFO]:    STDERR:

[INFO]:    COMMAND:
cd /root/.local/share/python-for-android/build/other_builds/pyjnius-python3crystax-sdl2/armeabi/pyjnius && /bin/python3.5 setup.py build_ext -v

[WARNING]: ERROR: /bin/python3.5 failed!
`
@rahnamaj22
Copy link
Author

my OS is fedora(23) , i tried on another fedora and i got the same error .
but when i tried with Ubuntu there was no error , and building apk was sucessfull, though, the built apk file didn't lunch after installing on my android device [ crushed as soon as i opened the program ]

@AndreMiras
Copy link
Member

AndreMiras commented Oct 29, 2018

That error popped again kivy/buildozer#735 and it was again Fedora (28 this time).
I'm reopening to track it here because it's the original.

Edit:
And I don't know yet how to solve. If you absolutely need to use buildozer/p4a, you can give it a try in a Ubuntu Docker container or VM. Anyway, I think we're getting closer confirming this is something on Fedora. If you feel like debugging it, you're more than welcome. I don't think any of the core developers are running Fedora so the fix will probably come from the community.

@pat1
Copy link

pat1 commented Oct 29, 2018

I am not sure to understand ...
the error in my case is
arm-linux-androideabi-gcc: error: unrecognized argument in option '-mtune=generic'
and it is true: the gcc version used in CrystaX NDK do not support this option:

in
/opt/crystax-ndk-10.3.2/toolchains
arm-linux-androideabi-4.9
arm-linux-androideabi-5

in arm-linux-androideabi-5/prebuilt/linux-x86_64/bin
./arm-linux-androideabi-gcc --version
arm-linux-androideabi-gcc (GCC) 5.3 20151204
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

if I try to build pyjnius:

/opt/crystax-ndk-10.3.2/toolchains/arm-linux-androideabi-5/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc -DANDROID -mtune=generic -mandroid -fomit-frame-pointer -D__ANDROID_API__=19 -I/opt/crystax-ndk-10.3.2/platforms/android-19/arch-arm -isysroot /opt/crystax-ndk-10.3.2/platforms/android-19/arch-arm -I/home/pat1/git/rmap/buildozer/android/platform/build/build/python-installs/rmap/include/python3.6 -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64  -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -DANDROID -mandroid -fomit-frame-pointer -D__ANDROID_API__=19 -I/opt/crystax-ndk-10.3.2/platforms/android-19/arch-arm -isysroot /opt/crystax-ndk-10.3.2/platforms/android-19/arch-arm -I/home/pat1/git/rmap/buildozer/android/platform/build/build/python-installs/rmap/include/python3.6 -I/opt/crystax-ndk-10.3.2/sources/python/3.6/include/python/ -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -mthumb -I/opt/crystax-ndk-10.3.2/sources/python/3.6/include/python -fPIC -I/usr/include/python3.6m -c jnius/jnius.c -o build/temp.linux-x86_64-3.6/jnius/jnius.o
arm-linux-androideabi-gcc: error: unrecognized argument in option '-mtune=generic'
arm-linux-androideabi-gcc: note: valid arguments to '-mtune=' are: arm1020e arm1020t arm1022e arm1026ej-s arm10e arm10tdmi arm1136j-s arm1136jf-s arm1156t2-s arm1156t2f-s arm1176jz-s arm1176jzf-s arm2 arm250 arm3 arm6 arm60 arm600 arm610 arm620 arm7 arm70 arm700 arm700i arm710 arm7100 arm710c arm710t arm720 arm720t arm740t arm7500 arm7500fe arm7d arm7di arm7dm arm7dmi arm7m arm7tdmi arm7tdmi-s arm8 arm810 arm9 arm920 arm920t arm922t arm926ej-s arm940t arm946e-s arm966e-s arm968e-s arm9e arm9tdmi cortex-a12 cortex-a15 cortex-a15.cortex-a7 cortex-a17 cortex-a17.cortex-a7 cortex-a5 cortex-a53 cortex-a57 cortex-a57.cortex-a53 cortex-a7 cortex-a72 cortex-a72.cortex-a53 cortex-a8 cortex-a9 cortex-m0 cortex-m0.small-multiply cortex-m0plus cortex-m0plus.small-multiply cortex-m1 cortex-m1.small-multiply cortex-m3 cortex-m4 cortex-m7 cortex-r4 cortex-r4f cortex-r5 cortex-r7 ep9312 exynos-m1 fa526 fa606te fa626 fa626te fa726te fmp626 generic-armv7-a iwmmxt iwmmxt2 marvell-pj4 mpcore mpcorenovfp native strongarm strongarm110 strongarm1100 strongarm1110 xgene1 xscale

'-mtune=generic' not supported is confirmed
If I remove "mtune" option:

/opt/crystax-ndk-10.3.2/toolchains/arm-linux-androideabi-5/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc -DANDROID  -mandroid -fomit-frame-pointer -D__ANDROID_API__=19 -I/opt/crystax-ndk-10.3.2/platforms/android-19/arch-arm -isysroot /opt/crystax-ndk-10.3.2/platforms/android-19/arch-arm -I/home/pat1/git/rmap/buildozer/android/platform/build/build/python-installs/rmap/include/python3.6 -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64  -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -DANDROID -mandroid -fomit-frame-pointer -D__ANDROID_API__=19 -I/opt/crystax-ndk-10.3.2/platforms/android-19/arch-arm -isysroot /opt/crystax-ndk-10.3.2/platforms/android-19/arch-arm -I/home/pat1/git/rmap/buildozer/android/platform/build/build/python-installs/rmap/include/python3.6 -I/opt/crystax-ndk-10.3.2/sources/python/3.6/include/python/ -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -mthumb -I/opt/crystax-ndk-10.3.2/sources/python/3.6/include/python -fPIC -I/usr/include/python3.6m -c jnius/jnius.c -o build/temp.linux-x86_64-3.6/jnius/jnius.o
cc1: error: unrecognized command line option '-m64'
cc1: error: unrecognized command line option '-fstack-clash-protection'
cc1: error: unrecognized command line option '-fcf-protection'
cc1: fatal error: inaccessible plugin file plugin/annobin.so expanded from short plugin name annobin: No such file or directory
compilation terminated.

so '-m64', '-fstack-clash-protection', '-fcf-protection' are not supported too.

Seems to me that this is not a Fedora specific issue.

@AndreMiras
Copy link
Member

AndreMiras commented Oct 29, 2018

I get your point and I didn't investigate, but it could actually be distribution related even if we're sharing the same toolchain.
I saw before that some distribution may set some default compiler flags when you don't expect it.
I'll share if I come across it again.

Edit:
These kinda things:

python -c "import sysconfig; print(sysconfig.get_config_var('CFLAGS'))"

On Ubuntu for instance I get:

-fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-nbjU53/python2.7-2.7.15~rc1=. -fstack-protector-strong -Wformat -Werror=format-security

There're other settings, e.g. sysconfig.get_config_var('OPT') and I know some other distributions behave otherwise, even when the toolchain is shared.

I don't know if that actually is the problem because I didn't investigate, but well it could definitely be distribution related, it won't be the first time.

@pat1
Copy link

pat1 commented Oct 30, 2018

python -c "import sysconfig; print(sysconfig.get_config_var('CFLAGS'))"
-fno-strict-aliasing -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv  -DNDEBUG -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv

the same as:

python-config --cflags
-I/usr/include/python2.7 -I/usr/include/python2.7 -fno-strict-aliasing -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv

Seems distutils uses whatever the Python library was compiled with so cython use those options that are no good for cross compilation.
I am looking for how to change the compiler option for cython ...

@AndreMiras
Copy link
Member

Nice so I made a good guess 😄
Thanks for taking a look at that issue 👍

@pat1
Copy link

pat1 commented Oct 30, 2018

in Estension you can pass extra_compile_args as argument:
Extension("hello", extra_compile_args="-Wall")
but documentation say that those args are added so it is not usefull.

Stackoverflow suggest to set OPT env variable:
https://stackoverflow.com/questions/6928110/how-may-i-override-the-compiler-gcc-flags-that-setup-py-uses-by-default

An other option is passing CFLAGS to python's configure script at build time and distutils should places CFLAGS at the head of the compiler invocation ...

I will try as soon as possible to find a solution ...

@pat1
Copy link

pat1 commented Nov 1, 2018

Nothing of the above works.
I think the only solution is to override the Cython.Distutils.build_ext class.

@pat1
Copy link

pat1 commented Nov 3, 2018

For now the only workaround I found is to remove gcc unsupported options in:
/usr/lib64/python2.7/_sysconfigdata.py
/usr/lib64/python3.6/_sysconfigdata_m_linux_x86_64-linux-gnu.py

looking for a better solution ...
any suggestions?

@inclement
Copy link
Member

Closing as (as I understand) only a python3crystax issue. Please feel free to reopen if it also affects the new python3 recipe.

@purushottam858
Copy link

purushottam858 commented Dec 7, 2020

I have same issue.
kivy 1.11.1
kivymd 0.104.1
python 3.7.9

what is the solution for this error ?

@BRAINSTORMMaxB
Copy link

I had the same issue, it is solved simply:
python3 -m pip install pyjnius

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

6 participants