AndreMiras / EtherollApp

Provably fair dice game running on the Ethereum blockchain
MIT License
57 stars 22 forks source link

Pycryptodome compilation error on Gentoo #99

Closed AndreMiras closed 6 years ago

AndreMiras commented 6 years ago
running build_ext                                                                                                                                                                                                                                                          
warning: no support for Intel AESNI instructions                                                                                                                                                                                                                           
building 'Crypto.Hash._MD2' extension                                                                                                                                                                                                                                      
creating build/temp.linux-x86_64-3.6                                                                                                                                                                                                                                       
creating build/temp.linux-x86_64-3.6/src                                                                                                                                                                                                                                   
arm-linux-androideabi-gcc -DANDROID -mandroid -fomit-frame-pointer -D__ANDROID_API__=19 -I/home/andre/.buildozer/crystax-ndk-10.3.2-linux-x86_64/platforms/android-19/arch-arm -isysroot /home/andre/.buildozer/crystax-ndk-10.3.2-linux-x86_64/platforms/android-19/arch-$
rm -I/home/andre/Progz/EtherollApp/.buildozer/android/platform/build/build/python-installs/etheroll/include/python3.6 -DANDROID -mandroid -fomit-frame-pointer -D__ANDROID_API__=19 -I/home/andre/.buildozer/crystax-ndk-10.3.2-linux-x86_64/platforms/android-19/arch-arm
-isysroot /home/andre/.buildozer/crystax-ndk-10.3.2-linux-x86_64/platforms/android-19/arch-arm -I/home/andre/Progz/EtherollApp/.buildozer/android/platform/build/build/python-installs/etheroll/include/python3.6 -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -mthumb -fPI$
 -DLTC_NO_ASM -Isrc/ -I/usr/include/python3.6m -c src/MD2.c -o build/temp.linux-x86_64-3.6/src/MD2.o
arm-linux-androideabi-gcc -DANDROID -mandroid -fomit-frame-pointer -D__ANDROID_API__=19 -I/home/andre/.buildozer/crystax-ndk-10.3.2-linux-x86_64/platforms/android-19/arch-arm -isysroot /home/andre/.buildozer/crystax-ndk-10.3.2-linux-x86_64/platforms/android-19/arch-$
rm -I/home/andre/Progz/EtherollApp/.buildozer/android/platform/build/build/python-installs/etheroll/include/python3.6 -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions --sysroot /home/andre/.buildozer/crystax-ndk-10.3.2-linux-x86_64/platforms/android-19/arch-arm -lm
-L/home/andre/Progz/EtherollApp/.buildozer/android/platform/build/build/libs_collections/etheroll/armeabi-v7a -L/home/andre/.buildozer/crystax-ndk-10.3.2-linux-x86_64/sources/crystax/libs/armeabi-v7a -lcrystax -DANDROID -mandroid -fomit-frame-pointer -D__ANDROID_API$
_=19 -I/home/andre/.buildozer/crystax-ndk-10.3.2-linux-x86_64/platforms/android-19/arch-arm -isysroot /home/andre/.buildozer/crystax-ndk-10.3.2-linux-x86_64/platforms/android-19/arch-arm -I/home/andre/Progz/EtherollApp/.buildozer/android/platform/build/build/python-$
nstalls/etheroll/include/python3.6 -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -mthumb build/temp.linux-x86_64-3.6/src/MD2.o -L/usr/lib64 -lpython3.6m -o build/lib.linux-x86_64-3.6/Crypto/Hash/_MD2.cpython-36m-x86_64-linux-gnu.so
/home/andre/.buildozer/crystax-ndk-10.3.2-linux-x86_64/toolchains/arm-linux-androideabi-5/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/5.3/../../../../arm-linux-androideabi/bin/ld: warning: skipping incompatible /usr/lib64/libm.so while searching for m
/home/andre/.buildozer/crystax-ndk-10.3.2-linux-x86_64/toolchains/arm-linux-androideabi-5/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/5.3/../../../../arm-linux-androideabi/bin/ld: warning: skipping incompatible /usr/lib64/libpython3.6m.so while search$
ng for python3.6m
/home/andre/.buildozer/crystax-ndk-10.3.2-linux-x86_64/toolchains/arm-linux-androideabi-5/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/5.3/../../../../arm-linux-androideabi/bin/ld: error: cannot find -lpython3.6m
/home/andre/.buildozer/crystax-ndk-10.3.2-linux-x86_64/toolchains/arm-linux-androideabi-5/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/5.3/../../../../arm-linux-androideabi/bin/ld: warning: skipping incompatible /usr/lib64/libdl.so while searching for $
l
/home/andre/.buildozer/crystax-ndk-10.3.2-linux-x86_64/toolchains/arm-linux-androideabi-5/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/5.3/../../../../arm-linux-androideabi/bin/ld: warning: skipping incompatible /usr/lib64/libc.so while searching for c
collect2: error: ld returned 1 exit status
error: command 'arm-linux-androideabi-gcc' failed with exit status 1

  STDERR:

Traceback (most recent call last):
  File "/usr/lib64/python3.5/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib64/python3.5/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/andre/Progz/EtherollApp/.buildozer/android/platform/python-for-android-new-toolchain/pythonforandroid/toolchain.py", line 977, in <module>
    main()
  File "/home/andre/Progz/EtherollApp/.buildozer/android/platform/python-for-android-new-toolchain/pythonforandroid/toolchain.py", line 973, in main
    ToolchainCL()
  File "/home/andre/Progz/EtherollApp/.buildozer/android/platform/python-for-android-new-toolchain/pythonforandroid/toolchain.py", line 512, in __init__
    getattr(self, args.subparser_name.replace('-', '_'))(args)
  File "/home/andre/Progz/EtherollApp/.buildozer/android/platform/python-for-android-new-toolchain/pythonforandroid/toolchain.py", line 147, in wrapper_func
    build_dist_from_args(ctx, dist, args)
  File "/home/andre/Progz/EtherollApp/.buildozer/android/platform/python-for-android-new-toolchain/pythonforandroid/toolchain.py", line 191, in build_dist_from_args
    build_recipes(build_order, python_modules, ctx)
  File "/home/andre/Progz/EtherollApp/.buildozer/android/platform/python-for-android-new-toolchain/pythonforandroid/build.py", line 573, in build_recipes
    recipe.build_arch(arch)
  File "/home/andre/Progz/EtherollApp/.buildozer/android/platform/python-for-android-new-toolchain/pythonforandroid/recipe.py", line 785, in build_arch
    self.install_python_package(arch)
  File "/home/andre/Progz/EtherollApp/.buildozer/android/platform/python-for-android-new-toolchain/pythonforandroid/recipe.py", line 806, in install_python_package
    _env=hpenv, *self.setup_extra_args)
  File "/home/andre/Progz/EtherollApp/.buildozer/android/platform/python-for-android-new-toolchain/pythonforandroid/logger.py", line 176, in shprint
    for line in output:
  File "/home/andre/.local/lib64/python3.5/site-packages/sh.py", line 720, in next
    self.wait()
  File "/home/andre/.local/lib64/python3.5/site-packages/sh.py", line 651, in wait
    self.handle_command_exit_code(exit_code)
  File "/home/andre/.local/lib64/python3.5/site-packages/sh.py", line 672, in handle_command_exit_code
    raise exc
sh.ErrorReturnCode_1:

  RAN: /usr/bin/python3.6 setup.py install -O2 --root=/home/andre/Progz/EtherollApp/.buildozer/android/platform/build/build/python-installs/etheroll --install-lib=.
AndreMiras commented 6 years ago

It seems to be because we got the -L/usr/lib64 being added for some reasons. So it tries to link again system libraries, which are of course incompatible with ARM ones.

AndreMiras commented 6 years ago

Some also having the same issue but with some default -I/usr/include/python3.6m also getting added. I can reproduce it cloning pycryptodome and trying to build the extension with the cross-compiler.

PATH="$HOME/.buildozer/crystax-ndk-10.3.2-linux-x86_64/toolchains/arm-linux-androideabi-5/prebuilt/linux-x86_64/bin:$PATH"
CC=arm-linux-androideabi-gcc python setup.py build_ext -v

And I get the following output:

Testing support for x86intrin.h header
Target does not support x86intrin.h header
running build_ext
Testing support for 128-bit integer
Target does not support 128-bit integer
Testing support for intrin.h header
Target does not support intrin.h header
Testing support for cpuid.h header
Target does not support cpuid.h header
Testing support for posix_memalign
Target does not support posix_memalign
Testing support for memalign
Target does not support memalign
Warning: compiler does not support AESNI instructions
Warning: compiler does not support CLMUL instructions
building 'Crypto.Hash._MD2' extension
arm-linux-androideabi-gcc -fPIC -DPYCRYPTO_LITTLE_ENDIAN -DLTC_NO_ASM -Isrc/ -I/usr/include/python3.6m -c src/MD2.c -o build/temp.linux-x86_64-3.6/src/MD2.o -O3
In file included from src/MD2.c:28:0:
src/common.h:34:19: fatal error: stdio.h: No such file or directory
compilation terminated.
error: command 'arm-linux-androideabi-gcc' failed with exit status 1
AndreMiras commented 6 years ago

OK it might be because it's being added by core build_ext, see https://github.com/python/cpython/blob/3.6/Lib/distutils/command/build_ext.py#L164