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 during Cross-Compiling aws-iot-device-sdk-python-v2 with make #444

Open
Sourabh-ALTEN opened this issue Feb 9, 2023 · 18 comments
Open
Labels
CRT/IoT feature-request A feature should be added or improved. p3 This is a minor priority issue

Comments

@Sourabh-ALTEN
Copy link

Problem:

I am trying to cross-compile aws-iot-device-sdk-python-v2 which requires aws-crt-python. I am working on building a custom Linux distribution using Buildroot for aarch64. But during make I am getting below errors from asm

Build log:

make[4]: *** [aws-lc/crypto/fipsmodule/CMakeFiles/fipsmodule.dir/build.make:337: aws-lc/crypto/fipsmodule/CMakeFiles/fipsmodule.dir/p384/bignum_littleendian_6.S.S.o] Error 1
make[4]: *** [aws-lc/crypto/fipsmodule/CMakeFiles/fipsmodule.dir/build.make:312: aws-lc/crypto/fipsmodule/CMakeFiles/fipsmodule.dir/p384/bignum_montmul_p384.S.S.o] Error 1
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p521/bignum_add_p521.S: Assembler messages:
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p521/bignum_add_p521.S:66: Error: unknown mnemonic `pushq' -- `pushq %rbx'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p521/bignum_add_p521.S:67: Error: unknown mnemonic `pushq' -- `pushq %r12'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p521/bignum_add_p521.S:72: Error: unknown mnemonic `stc' -- `stc'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p521/bignum_add_p521.S:73: Error: unknown mnemonic `movq' -- `movq (%rsi),%rax'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p521/bignum_add_p521.S:74: Error: unknown mnemonic `adcq' -- `adcq (%rdx),%rax'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p521/bignum_add_p521.S:75: Error: unknown mnemonic `movq' -- `movq 8(%rsi),%rcx'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p521/bignum_add_p521.S:76: Error: unknown mnemonic `adcq' -- `adcq 8(%rdx),%rcx'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p521/bignum_add_p521.S:77: Error: unknown mnemonic `movq' -- `movq 16(%rsi),%r8'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p521/bignum_add_p521.S:78: Error: unknown mnemonic `adcq' -- `adcq 16(%rdx),%r8'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p521/bignum_add_p521.S:79: Error: unknown mnemonic `movq' -- `movq 24(%rsi),%r9'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p521/bignum_add_p521.S:80: Error: unknown mnemonic `adcq' -- `adcq 24(%rdx),%r9'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p521/bignum_add_p521.S:81: Error: unknown mnemonic `movq' -- `movq 32(%rsi),%r10'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p521/bignum_add_p521.S:82: Error: unknown mnemonic `adcq' -- `adcq 32(%rdx),%r10'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p521/bignum_add_p521.S:83: Error: unknown mnemonic `movq' -- `movq 40(%rsi),%r11'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p521/bignum_add_p521.S:84: Error: unknown mnemonic `adcq' -- `adcq 40(%rdx),%r11'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p521/bignum_add_p521.S:85: Error: unknown mnemonic `movq' -- `movq 48(%rsi),%r12'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p521/bignum_add_p521.S:86: Error: unknown mnemonic `adcq' -- `adcq 48(%rdx),%r12'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p521/bignum_add_p521.S:87: Error: unknown mnemonic `movq' -- `movq 56(%rsi),%rbx'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p521/bignum_add_p521.S:88: Error: unknown mnemonic `adcq' -- `adcq 56(%rdx),%rbx'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p521/bignum_add_p521.S:89: Error: unknown mnemonic `movq' -- `movq 64(%rsi),%rsi'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p521/bignum_add_p521.S:90: Error: unknown mnemonic `adcq' -- `adcq 64(%rdx),%rsi'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p521/bignum_add_p521.S:95: Error: unknown mnemonic `movq' -- `movq $512,%rdx'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p521/bignum_add_p521.S:96: Error: unknown mnemonic `andq' -- `andq %rsi,%rdx'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p521/bignum_add_p521.S:103: Error: unknown mnemonic `cmpq' -- `cmpq $512,%rdx'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p521/bignum_add_p521.S:105: Error: unknown mnemonic `sbbq' -- `sbbq $0,%rax'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p521/bignum_add_p521.S:106: Error: unknown mnemonic `movq' -- `movq %rax,(%rdi)'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p521/bignum_add_p521.S:107: Error: unknown mnemonic `sbbq' -- `sbbq $0,%rcx'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p521/bignum_add_p521.S:108: Error: unknown mnemonic `movq' -- `movq %rcx,8(%rdi)'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p521/bignum_add_p521.S:109: Error: unknown mnemonic `sbbq' -- `sbbq $0,%r8'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p521/bignum_add_p521.S:110: Error: unknown mnemonic `movq' -- `movq %r8,16(%rdi)'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p521/bignum_add_p521.S:111: Error: unknown mnemonic `sbbq' -- `sbbq $0,%r9'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p521/bignum_add_p521.S:112: Error: unknown mnemonic `movq' -- `movq %r9,24(%rdi)'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p521/bignum_add_p521.S:113: Error: unknown mnemonic `sbbq' -- `sbbq $0,%r10'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p521/bignum_add_p521.S:114: Error: unknown mnemonic `movq' -- `movq %r10,32(%rdi)'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p521/bignum_add_p521.S:115: Error: unknown mnemonic `sbbq' -- `sbbq $0,%r11'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p521/bignum_add_p521.S:116: Error: unknown mnemonic `movq' -- `movq %r11,40(%rdi)'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p521/bignum_add_p521.S:117: Error: unknown mnemonic `sbbq' -- `sbbq $0,%r12'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p521/bignum_add_p521.S:118: Error: unknown mnemonic `movq' -- `movq %r12,48(%rdi)'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p521/bignum_add_p521.S:119: Error: unknown mnemonic `sbbq' -- `sbbq $0,%rbx'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p521/bignum_add_p521.S:120: Error: unknown mnemonic `movq' -- `movq %rbx,56(%rdi)'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p521/bignum_add_p521.S:121: Error: unknown mnemonic `sbbq' -- `sbbq %rdx,%rsi'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p521/bignum_add_p521.S:122: Error: unknown mnemonic `movq' -- `movq %rsi,64(%rdi)'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p521/bignum_add_p521.S:126: Error: unknown mnemonic `popq' -- `popq %r12'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p521/bignum_add_p521.S:127: Error: unknown mnemonic `popq' -- `popq %rbx'
[ 13%] Building ASM object aws-lc/crypto/fipsmodule/CMakeFiles/fipsmodule.dir/p521/bignum_sub_p521.S.S.o
make[4]: *** [aws-lc/crypto/fipsmodule/CMakeFiles/fipsmodule.dir/build.make:342: aws-lc/crypto/fipsmodule/CMakeFiles/fipsmodule.dir/p521/bignum_add_p521.S.S.o] Error 1
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p521/bignum_sub_p521.S: Assembler messages:
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p521/bignum_sub_p521.S:65: Error: unknown mnemonic `pushq' -- `pushq %rbx'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p521/bignum_sub_p521.S:66: Error: unknown mnemonic `pushq' -- `pushq %r12'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p521/bignum_sub_p521.S:70: Error: unknown mnemonic `movq' -- `movq (%rsi),%rax'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p521/bignum_sub_p521.S:71: Error: unknown mnemonic `subq' -- `subq (%rdx),%rax'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p521/bignum_sub_p521.S:72: Error: unknown mnemonic `movq' -- `movq 8(%rsi),%rcx'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p521/bignum_sub_p521.S:73: Error: unknown mnemonic `sbbq' -- `sbbq 8(%rdx),%rcx'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p521/bignum_sub_p521.S:74: Error: unknown mnemonic `movq' -- `movq 16(%rsi),%r8'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p521/bignum_sub_p521.S:75: Error: unknown mnemonic `sbbq' -- `sbbq 16(%rdx),%r8'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p521/bignum_sub_p521.S:76: Error: unknown mnemonic `movq' -- `movq 24(%rsi),%r9'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p521/bignum_sub_p521.S:77: Error: unknown mnemonic `sbbq' -- `sbbq 24(%rdx),%r9'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p521/bignum_sub_p521.S:78: Error: unknown mnemonic `movq' -- `movq 32(%rsi),%r10'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p521/bignum_sub_p521.S:79: Error: unknown mnemonic `sbbq' -- `sbbq 32(%rdx),%r10'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p521/bignum_sub_p521.S:80: Error: unknown mnemonic `movq' -- `movq 40(%rsi),%r11'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p521/bignum_sub_p521.S:81: Error: unknown mnemonic `sbbq' -- `sbbq 40(%rdx),%r11'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p521/bignum_sub_p521.S:82: Error: unknown mnemonic `movq' -- `movq 48(%rsi),%r12'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p521/bignum_sub_p521.S:83: Error: unknown mnemonic `sbbq' -- `sbbq 48(%rdx),%r12'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p521/bignum_sub_p521.S:84: Error: unknown mnemonic `movq' -- `movq 56(%rsi),%rbx'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p521/bignum_sub_p521.S:85: Error: unknown mnemonic `sbbq' -- `sbbq 56(%rdx),%rbx'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p521/bignum_sub_p521.S:86: Error: unknown mnemonic `movq' -- `movq 64(%rsi),%rsi'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p521/bignum_sub_p521.S:87: Error: unknown mnemonic `sbbq' -- `sbbq 64(%rdx),%rsi'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p521/bignum_sub_p521.S:94: Error: unknown mnemonic `sbbq' -- `sbbq $0,%rax'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p521/bignum_sub_p521.S:95: Error: unknown mnemonic `movq' -- `movq %rax,(%rdi)'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p521/bignum_sub_p521.S:96: Error: unknown mnemonic `sbbq' -- `sbbq $0,%rcx'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p521/bignum_sub_p521.S:97: Error: unknown mnemonic `movq' -- `movq %rcx,8(%rdi)'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p521/bignum_sub_p521.S:98: Error: unknown mnemonic `sbbq' -- `sbbq $0,%r8'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p521/bignum_sub_p521.S:99: Error: unknown mnemonic `movq' -- `movq %r8,16(%rdi)'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p521/bignum_sub_p521.S:100: Error: unknown mnemonic `sbbq' -- `sbbq $0,%r9'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p521/bignum_sub_p521.S:101: Error: unknown mnemonic `movq' -- `movq %r9,24(%rdi)'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p521/bignum_sub_p521.S:102: Error: unknown mnemonic `sbbq' -- `sbbq $0,%r10'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p521/bignum_sub_p521.S:103: Error: unknown mnemonic `movq' -- `movq %r10,32(%rdi)'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p521/bignum_sub_p521.S:104: Error: unknown mnemonic `sbbq' -- `sbbq $0,%r11'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p521/bignum_sub_p521.S:105: Error: unknown mnemonic `movq' -- `movq %r11,40(%rdi)'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p521/bignum_sub_p521.S:106: Error: unknown mnemonic `sbbq' -- `sbbq $0,%r12'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p521/bignum_sub_p521.S:107: Error: unknown mnemonic `movq' -- `movq %r12,48(%rdi)'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p521/bignum_sub_p521.S:108: Error: unknown mnemonic `sbbq' -- `sbbq $0,%rbx'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p521/bignum_sub_p521.S:109: Error: unknown mnemonic `movq' -- `movq %rbx,56(%rdi)'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p521/bignum_sub_p521.S:110: Error: unknown mnemonic `sbbq' -- `sbbq $0,%rsi'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p521/bignum_sub_p521.S:111: Error: unknown mnemonic `andq' -- `andq $0x1FF,%rsi'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p521/bignum_sub_p521.S:112: Error: unknown mnemonic `movq' -- `movq %rsi,64(%rdi)'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p521/bignum_sub_p521.S:116: Error: unknown mnemonic `popq' -- `popq %r12'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p521/bignum_sub_p521.S:117: Error: unknown mnemonic `popq' -- `popq %rbx'
make[4]: *** [aws-lc/crypto/fipsmodule/CMakeFiles/fipsmodule.dir/build.make:347: aws-lc/crypto/fipsmodule/CMakeFiles/fipsmodule.dir/p521/bignum_sub_p521.S.S.o] Error 1
make[3]: *** [CMakeFiles/Makefile2:1296: aws-lc/crypto/fipsmodule/CMakeFiles/fipsmodule.dir/all] Error 2
make[3]: *** Waiting for unfinished jobs....
[ 13%] Building ASM object aws-lc/crypto/CMakeFiles/crypto_objects.dir/hrss/asm/poly_rq_mul.S.o
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/crypto/hrss/asm/poly_rq_mul.S: Assembler messages:
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/crypto/hrss/asm/poly_rq_mul.S:304: Error: unknown pseudo-op: `.att_syntax'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/crypto/hrss/asm/poly_rq_mul.S:307: Error: unknown mnemonic `push' -- `push %rbp'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/crypto/hrss/asm/poly_rq_mul.S:309: Error: bad register expression
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/crypto/hrss/asm/poly_rq_mul.S:310: Error: unknown mnemonic `movq' -- `movq %rsp,%rbp'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/crypto/hrss/asm/poly_rq_mul.S:311: Error: bad register expression
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/crypto/hrss/asm/poly_rq_mul.S:312: Error: unknown mnemonic `push' -- `push %r12'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/crypto/hrss/asm/poly_rq_mul.S:313: Error: bad register expression
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/crypto/hrss/asm/poly_rq_mul.S:321: Error: operand 1 must be an integer register -- `mov %rcx,%r8'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/crypto/hrss/asm/poly_rq_mul.S:322: Error: unknown mnemonic `addq' -- `addq $6144+12288+512+9408+32,%r8'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/crypto/hrss/asm/poly_rq_mul.S:323: Error: operand 1 must be an integer register -- `mov %r8,%rax'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/crypto/hrss/asm/poly_rq_mul.S:324: Error: unknown mnemonic `subq' -- `subq $6144,%r8'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/crypto/hrss/asm/poly_rq_mul.S:325: Error: operand 1 must be an integer register -- `mov %r8,%r11'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/crypto/hrss/asm/poly_rq_mul.S:326: Error: unknown mnemonic `subq' -- `subq $12288,%r8'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/crypto/hrss/asm/poly_rq_mul.S:327: Error: operand 1 must be an integer register -- `mov %r8,%r12'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/crypto/hrss/asm/poly_rq_mul.S:328: Error: unknown mnemonic `subq' -- `subq $512,%r8'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/crypto/hrss/asm/poly_rq_mul.S:329: Error: unknown mnemonic `vmovdqa' -- `vmovdqa const3(%rip),%ymm3'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/crypto/hrss/asm/poly_rq_mul.S:330: Error: unknown mnemonic `vmovdqu' -- `vmovdqu 0(%rsi),%ymm0'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/crypto/hrss/asm/poly_rq_mul.S:331: Error: unknown mnemonic `vmovdqu' -- `vmovdqu 88(%rsi),%ymm1'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/crypto/hrss/asm/poly_rq_mul.S:332: Error: unknown mnemonic `vmovdqu' -- `vmovdqu 176(%rsi),%ymm2'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/crypto/hrss/asm/poly_rq_mul.S:333: Error: unknown mnemonic `vmovdqu' -- `vmovdqu 264(%rsi),%ymm12'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/crypto/hrss/asm/poly_rq_mul.S:334: Error: unknown mnemonic `vmovdqu' -- `vmovdqu 1056(%rsi),%ymm4'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/crypto/hrss/asm/poly_rq_mul.S:335: Error: unknown mnemonic `vmovdqu' -- `vmovdqu 1144(%rsi),%ymm5'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/crypto/hrss/asm/poly_rq_mul.S:336: Error: unknown mnemonic `vmovdqu' -- `vmovdqu 1232(%rsi),%ymm6'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/crypto/hrss/asm/poly_rq_mul.S:337: Error: unknown mnemonic `vmovdqu' -- `vmovdqu 1320(%rsi),%ymm7'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/crypto/hrss/asm/poly_rq_mul.S:338: Error: unknown mnemonic `vmovdqu' -- `vmovdqu 352(%rsi),%ymm8'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/crypto/hrss/asm/poly_rq_mul.S:339: Error: unknown mnemonic `vmovdqu' -- `vmovdqu 440(%rsi),%ymm9'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/crypto/hrss/asm/poly_rq_mul.S:340: Error: unknown mnemonic `vmovdqu' -- `vmovdqu 528(%rsi),%ymm10'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/crypto/hrss/asm/poly_rq_mul.S:341: Error: unknown mnemonic `vmovdqu' -- `vmovdqu 616(%rsi),%ymm11'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/crypto/hrss/asm/poly_rq_mul.S:342: Error: unknown mnemonic `vmovdqa' -- `vmovdqa %ymm0,0(%rax)'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/crypto/hrss/asm/poly_rq_mul.S:343: Error: unknown mnemonic `vmovdqa' -- `vmovdqa %ymm1,96(%rax)'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/crypto/hrss/asm/poly_rq_mul.S:344: Error: unknown mnemonic `vpaddw' -- `vpaddw %ymm0,%ymm1,%ymm14'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/crypto/hrss/asm/poly_rq_mul.S:345: Error: unknown mnemonic `vmovdqa' -- `vmovdqa %ymm14,192(%rax)'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/crypto/hrss/asm/poly_rq_mul.S:346: Error: unknown mnemonic `vmovdqa' -- `vmovdqa %ymm2,288(%rax)'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/crypto/hrss/asm/poly_rq_mul.S:347: Error: unknown mnemonic `vmovdqa' -- `vmovdqa %ymm12,384(%rax)'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/crypto/hrss/asm/poly_rq_mul.S:348: Error: unknown mnemonic `vpaddw' -- `vpaddw %ymm2,%ymm12,%ymm14'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/crypto/hrss/asm/poly_rq_mul.S:349: Error: unknown mnemonic `vmovdqa' -- `vmovdqa %ymm14,480(%rax)'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/crypto/hrss/asm/poly_rq_mul.S:350: Error: unknown mnemonic `vpaddw' -- `vpaddw %ymm0,%ymm2,%ymm14'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/crypto/hrss/asm/poly_rq_mul.S:351: Error: unknown mnemonic `vmovdqa' -- `vmovdqa %ymm14,576(%rax)'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/crypto/hrss/asm/poly_rq_mul.S:352: Error: unknown mnemonic `vpaddw' -- `vpaddw %ymm1,%ymm12,%ymm15'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/crypto/hrss/asm/poly_rq_mul.S:353: Error: unknown mnemonic `vmovdqa' -- `vmovdqa %ymm15,672(%rax)'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/crypto/hrss/asm/poly_rq_mul.S:354: Error: unknown mnemonic `vpaddw' -- `vpaddw %ymm14,%ymm15,%ymm14'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/crypto/hrss/asm/poly_rq_mul.S:355: Error: unknown mnemonic `vmovdqa' -- `vmovdqa %ymm14,768(%rax)'
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/crypto/hrss/asm/poly_rq_mul.S:356: Error: unknown mnemonic `vmovdqa' -- `vmovdqa %ymm4,5184(%rax)'
.
.
.
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/crypto/hrss/asm/poly_rq_mul.S:8483: Error: bad register expression
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/crypto/hrss/asm/poly_rq_mul.S:8484: Error: bad register expression
make[4]: *** [aws-lc/crypto/CMakeFiles/crypto_objects.dir/build.make:3083: aws-lc/crypto/CMakeFiles/crypto_objects.dir/hrss/asm/poly_rq_mul.S.o] Error 1
make[3]: *** [CMakeFiles/Makefile2:1269: aws-lc/crypto/CMakeFiles/crypto_objects.dir/all] Error 2
make[2]: *** [Makefile:141: all] Error 2
Traceback (most recent call last):
  File "[...]output/build/python-awscrt-0.16.10/setup.py", line 348, in <module>
    setuptools.setup(
  File "[...]output/host/lib/python3.10/site-packages/setuptools/__init__.py", line 155, in setup
    return distutils.core.setup(**attrs)
  File "[...]output/host/aarch64-buildroot-linux-gnu/sysroot/usr/lib/python3.10/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "[...]output/host/aarch64-buildroot-linux-gnu/sysroot/usr/lib/python3.10/distutils/dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "[...]output/host/aarch64-buildroot-linux-gnu/sysroot/usr/lib/python3.10/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "[...]output/host/aarch64-buildroot-linux-gnu/sysroot/usr/lib/python3.10/distutils/command/build.py", line 135, in run
    self.run_command(cmd_name)
  File "[...]output/host/aarch64-buildroot-linux-gnu/sysroot/usr/lib/python3.10/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "[...]output/host/aarch64-buildroot-linux-gnu/sysroot/usr/lib/python3.10/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "[...]output/build/python-awscrt-0.16.10/setup.py", line 255, in run
    self._build_dependencies(dep_build_dir, dep_install_path)
  File "[...]output/build/python-awscrt-0.16.10/setup.py", line 247, in _build_dependencies
    self._build_dependencies_impl(build_dir, install_path)
  File "[...]output/build/python-awscrt-0.16.10/setup.py", line 204, in _build_dependencies_impl
    run_cmd(build_cmd)
  File "[...]output/build/python-awscrt-0.16.10/setup.py", line 37, in run_cmd
    subprocess.check_call(args)
  File "[...]output/host/aarch64-buildroot-linux-gnu/sysroot/usr/lib/python3.10/subprocess.py", line 369, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/usr/bin/cmake', '--build', 'build/temp.linux-aarch64-3.10/deps', '--config', 'RelWithDebInfo', '--target', 'install']' returned non-zero exit status 2.
make[1]: *** [package/pkg-generic.mk:293: [...]output/build/python-awscrt-0.16.10/.stamp_built] Error 1

I have no idea what it is complaining about. Can anyone please let me know how to reslove this?

Thanks in advance

@TwistedTwigleg
Copy link
Contributor

Based on a quick search with the first error, it seems the platform you are compiling for does not support x86 assembly, as that is what those error codes seem to indicate (example). My guess is that something in the compile process is not properly detecting you are trying to cross compile for ARM and so it tries to pull in x86 assembly.

It looks like the errors are happening in aws-lc specifically. It looks like you have already opened an issue on AWS LC as well for this issue: aws/aws-lc#795


Based on this issue on AWS LC, you may be able to tell CMAKE you are compiling arm by adding the following to this chunk of code in setup.py:

cmake_args.extend([
            f'-DCMAKE_SYSTEM_NAME=Linux',
            f'-DCMAKE_SYSTEM_PROCESSOR=arm'
        ])

As then that may inform CMAKE you are trying to cross compile for ARM and not x86, assuming the issue is that the CMAKE is trying to compile for x86 on an ARM platform.

@Sourabh-ALTEN
Copy link
Author

Hi @TwistedTwigleg thanks for the update.

After adding below to setup.py file

cmake_args.extend([
            f'-DCMAKE_SYSTEM_NAME=Linux',
            f'-DCMAKE_SYSTEM_PROCESSOR=arm'
        ])

I still get same errors

>>> python-awscrt 0.16.10 Building
(cd [...]output/build/python-awscrt-0.16.10//; _PYTHON_HOST_PLATFORM="linux-aarch64" _PYTHON_PROJECT_BASE="[...]output/build/python3-3.10.8" _PYTHON_SYSCONFIGDATA_NAME="`{ [ -e [...]output/host/aarch64-buildroot-linux-gnu/sysroot/usr/lib/python3.10//_sysconfigdata__linux_*.py ] && basename [...]output/host/aarch64-buildroot-linux-gnu/sysroot/usr/lib/python3.10//_sysconfigdata__linux_*.py .py; } || true`" PATH="[...]output/host/bin:[...]output/host/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" PATH="[...]output/host/bin:[...]output/host/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" AR="[...]output/host/bin/aarch64-linux-gcc-ar" AS="[...]output/host/bin/aarch64-linux-as" LD="[...]output/host/bin/aarch64-linux-ld" NM="[...]output/host/bin/aarch64-linux-gcc-nm" CC="[...]output/host/bin/aarch64-linux-gcc" GCC="[...]output/host/bin/aarch64-linux-gcc" CPP="[...]output/host/bin/aarch64-linux-cpp" CXX="[...]output/host/bin/aarch64-linux-g++" FC="[...]output/host/bin/aarch64-linux-gfortran" F77="[...]output/host/bin/aarch64-linux-gfortran" RANLIB="[...]output/host/bin/aarch64-linux-gcc-ranlib" READELF="[...]output/host/bin/aarch64-linux-readelf" STRIP="[...]output/host/bin/aarch64-linux-strip" OBJCOPY="[...]output/host/bin/aarch64-linux-objcopy" OBJDUMP="[...]output/host/bin/aarch64-linux-objdump" AR_FOR_BUILD="/usr/bin/ar" AS_FOR_BUILD="/usr/bin/as" CC_FOR_BUILD="/usr/bin/gcc" GCC_FOR_BUILD="/usr/bin/gcc" CXX_FOR_BUILD="/usr/bin/g++" LD_FOR_BUILD="/usr/bin/ld" CPPFLAGS_FOR_BUILD="-I[...]output/host/include" CFLAGS_FOR_BUILD="-O2 -I[...]output/host/include" CXXFLAGS_FOR_BUILD="-O2 -I[...]output/host/include" LDFLAGS_FOR_BUILD="-L[...]output/host/lib -Wl,-rpath,[...]output/host/lib" FCFLAGS_FOR_BUILD="" DEFAULT_ASSEMBLER="[...]output/host/bin/aarch64-linux-as" DEFAULT_LINKER="[...]output/host/bin/aarch64-linux-ld" CPPFLAGS="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64" CFLAGS="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64  -Os -g0 -D_FORTIFY_SOURCE=1" CXXFLAGS="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64  -Os -g0 -D_FORTIFY_SOURCE=1" LDFLAGS="" FCFLAGS=" -Os -g0" FFLAGS=" -Os -g0" PKG_CONFIG="[...]output/host/bin/pkg-config" STAGING_DIR="[...]output/host/aarch64-buildroot-linux-gnu/sysroot" INTLTOOL_PERL=/usr/bin/perl PYTHONPATH="[...]output/host/aarch64-buildroot-linux-gnu/sysroot/usr/lib/python3.10/" PYTHONNOUSERSITE=1 SETUPTOOLS_USE_DISTUTILS=stdlib _python_sysroot=[...]output/host/aarch64-buildroot-linux-gnu/sysroot _python_prefix=/usr _python_exec_prefix=/usr  [...]output/host/bin/python setup.py build  )
[...]output/build/python-awscrt-0.16.10/setup.py:5: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
  import distutils.ccompiler
running build
running build_py
running build_ext
> /usr/bin/cmake -H[...]output/build/python-awscrt-0.16.10/crt -Bbuild/temp.linux-aarch64-3.10/deps -DCMAKE_INSTALL_PREFIX=build/temp.linux-aarch64-3.10/deps/install -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_SYSTEM_NAME=Linux -DCMAKE_SYSTEM_PROCESSOR=arm
-- Checking for module 'libunwind-generic'
--   Package 'libunwind-generic', required by 'virtual:world', not found
libunwind not found. Disabling unwind tests.
-- Go not found. Disabling some code generation and using pre-generated code in generated-src/
-- Perl not found. Disabling some code generation and using pre-generated code in generated-src/
-- Run check_run file_to_test 'memcmp_invalid_stripped_check.c', flag_to_set 'MEMCMP_INVALID_STRIPPED', and compile_flags '-O2 -g -DNDEBUG'.
CMake Warning at aws-lc/CMakeLists.txt:240 (message):
  Currently, GCC 10.3.0 is not supported due to a memcmp related bug reported
  in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95189.

  We strongly recommend against using the GCC 10.3.0 compiler.


-- Test stdalign_check.c passed, enabling AWS_LC_STDALIGN_AVAILABLE
-- Test builtin_swap_check.c passed, enabling AWS_LC_BUILTIN_SWAP_SUPPORTED
Copying platform assembly files from [...]output/build/python-awscrt-0.16.10/crt/aws-lc/generated-src/linux-x86_64/crypto/ to [...]output/build/python-awscrt-0.16.10/build/temp.linux-aarch64-3.10/deps/aws-lc/crypto
-- Detected CMAKE_SYSTEM_PROCESSOR as x86_64
-- Detected 64-Bit system
-- madvise() support detected
-- clone() support detected
-- S2N found target: crypto
-- CMAKE_AR found: /usr/bin/ar
-- CMake 3.16.3
-- Packaging currently only supported on Fedora.
-- Using libcrypto from AWS-LC
-- Configuring done
-- Generating done
-- Build files have been written to: [...]output/build/python-awscrt-0.16.10/build/temp.linux-aarch64-3.10/deps
> /usr/bin/cmake --build build/temp.linux-aarch64-3.10/deps --config RelWithDebInfo --target install
[  0%] Built target global_target
[  8%] Built target aws-c-common
[  8%] Building ASM object aws-lc/crypto/fipsmodule/CMakeFiles/fipsmodule.dir/p384/bignum_add_p384.S.S.o
[  8%] Building ASM object aws-lc/crypto/fipsmodule/CMakeFiles/fipsmodule.dir/p384/bignum_sub_p384.S.S.o
[  8%] Building ASM object aws-lc/crypto/fipsmodule/CMakeFiles/fipsmodule.dir/p384/bignum_tomont_p384.S.S.o
[  9%] Building ASM object aws-lc/crypto/fipsmodule/CMakeFiles/fipsmodule.dir/p384/bignum_deamont_p384.S.S.o
[  9%] Building ASM object aws-lc/crypto/fipsmodule/CMakeFiles/fipsmodule.dir/p384/bignum_neg_p384.S.S.o
[  9%] Building ASM object aws-lc/crypto/fipsmodule/CMakeFiles/fipsmodule.dir/p384/bignum_montsqr_p384.S.S.o
[  9%] Building ASM object aws-lc/crypto/fipsmodule/CMakeFiles/fipsmodule.dir/p384/bignum_nonzero_6.S.S.o
[ 10%] Building ASM object aws-lc/crypto/fipsmodule/CMakeFiles/fipsmodule.dir/p384/bignum_littleendian_6.S.S.o
[ 10%] Building ASM object aws-lc/crypto/fipsmodule/CMakeFiles/fipsmodule.dir/p384/bignum_montmul_p384.S.S.o
[ 10%] Building ASM object aws-lc/crypto/fipsmodule/CMakeFiles/fipsmodule.dir/p384/bignum_montsqr_p384_alt.S.S.o
[ 10%] Building ASM object aws-lc/crypto/fipsmodule/CMakeFiles/fipsmodule.dir/p384/bignum_montmul_p384_alt.S.S.o
[ 10%] Building ASM object aws-lc/crypto/fipsmodule/CMakeFiles/fipsmodule.dir/p521/bignum_add_p521.S.S.o
[ 11%] Built target aws-c-compression
[ 12%] Built target aws-checksums
[ 13%] Built target aws-c-sdkutils
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p384/bignum_sub_p384.S: Assembler messages:
[...]output/build/python-awscrt-0.16.10/crt/aws-lc/third_party/s2n-bignum/x86_att/p384/bignum_sub_p384.S:67: Error: unknown mnemonic `movq' -- `movq (%rsi),%rax'

@TwistedTwigleg
Copy link
Contributor

Looking at the log, the following stands out to me:

CMake Warning at aws-lc/CMakeLists.txt:240 (message):
  Currently, GCC 10.3.0 is not supported due to a memcmp related bug reported

Can you update the version of GCC you are using? I am not sure if it is related, but it may be possible that because GCC 10.3.0 is unsupported, that is causing other compile-time checks to not run. Regardless, for security purposes it would be beneficial to update GCC if you can.

@Sourabh-ALTEN
Copy link
Author

Hi @TwistedTwigleg , I think I managed to resolve the issue. I used the cmake provided by Buildroot instead of host cmake. And this somehow resolved it. At least build is successful.

@TwistedTwigleg
Copy link
Contributor

Great! I am going to close this issue then.

Please also remember to update the AWS-LC issue you made and close it as well, so there's no duplicates and/or open issues that have been resolved. 🙂

@Sourabh-ALTEN
Copy link
Author

Hello @TwistedTwigleg sorry for opening this issue again.

I did a make clean and trying to do make again to build the image. But, I am getting the same errors as before. Nothing has changed in the configurations (using cmake provided by Buildroot).

>>> python-awscrt 0.16.10 Building
(cd [...]output/build/python-awscrt-0.16.10//; _PYTHON_HOST_PLATFORM="linux-aarch64" _PYTHON_PROJECT_BASE="[...]output/build/python3-3.10.8" _PYTHON_SYSCONFIGDATA_NAME="`{ [ -e [...]output/host/aarch64-buildroot-linux-gnu/sysroot/usr/lib/python3.10//_sysconfigdata__linux_*.py ] && basename [...]output/host/aarch64-buildroot-linux-gnu/sysroot/usr/lib/python3.10//_sysconfigdata__linux_*.py .py; } || true`" PATH="[...]output/host/bin:[...]output/host/sbin:[...]opt/aarch64-buildroot-linux-gnu_sdk-buildroot/bin:[...]opt/aarch64-buildroot-linux-gnu_sdk-buildroot/sbin:[...]opt/aarch64-buildroot-linux-gnu_sdk-buildroot/bin:[...]opt/aarch64-buildroot-linux-gnu_sdk-buildroot/sbin:[...]opt/aarch64-buildroot-linux-gnu_sdk-buildroot/bin:[...]opt/aarch64-buildroot-linux-gnu_sdk-buildroot/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" PATH="[...]output/host/bin:[...]output/host/sbin:[...]opt/aarch64-buildroot-linux-gnu_sdk-buildroot/bin:[...]opt/aarch64-buildroot-linux-gnu_sdk-buildroot/sbin:[...]opt/aarch64-buildroot-linux-gnu_sdk-buildroot/bin:[...]opt/aarch64-buildroot-linux-gnu_sdk-buildroot/sbin:[...]opt/aarch64-buildroot-linux-gnu_sdk-buildroot/bin:[...]opt/aarch64-buildroot-linux-gnu_sdk-buildroot/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" AR="[...]output/host/bin/aarch64-linux-gcc-ar" AS="[...]output/host/bin/aarch64-linux-as" LD="[...]output/host/bin/aarch64-linux-ld" NM="[...]output/host/bin/aarch64-linux-gcc-nm" CC="[...]output/host/bin/aarch64-linux-gcc" GCC="[...]output/host/bin/aarch64-linux-gcc" CPP="[...]output/host/bin/aarch64-linux-cpp" CXX="[...]output/host/bin/aarch64-linux-g++" FC="[...]output/host/bin/aarch64-linux-gfortran" F77="[...]output/host/bin/aarch64-linux-gfortran" RANLIB="[...]output/host/bin/aarch64-linux-gcc-ranlib" READELF="[...]output/host/bin/aarch64-linux-readelf" STRIP="[...]output/host/bin/aarch64-linux-strip" OBJCOPY="[...]output/host/bin/aarch64-linux-objcopy" OBJDUMP="[...]output/host/bin/aarch64-linux-objdump" AR_FOR_BUILD="/usr/bin/ar" AS_FOR_BUILD="/usr/bin/as" CC_FOR_BUILD="/usr/bin/gcc" GCC_FOR_BUILD="/usr/bin/gcc" CXX_FOR_BUILD="/usr/bin/g++" LD_FOR_BUILD="/usr/bin/ld" CPPFLAGS_FOR_BUILD="-I[...]output/host/include" CFLAGS_FOR_BUILD="-O2 -I[...]output/host/include" CXXFLAGS_FOR_BUILD="-O2 -I[...]output/host/include" LDFLAGS_FOR_BUILD="-L[...]output/host/lib -Wl,-rpath,[...]output/host/lib" FCFLAGS_FOR_BUILD="" DEFAULT_ASSEMBLER="[...]output/host/bin/aarch64-linux-as" DEFAULT_LINKER="[...]output/host/bin/aarch64-linux-ld" CPPFLAGS="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64" CFLAGS="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64  -Os -g0 -D_FORTIFY_SOURCE=1" CXXFLAGS="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64  -Os -g0 -D_FORTIFY_SOURCE=1" LDFLAGS="" FCFLAGS=" -Os -g0" FFLAGS=" -Os -g0" PKG_CONFIG="[...]output/host/bin/pkg-config" STAGING_DIR="[...]output/host/aarch64-buildroot-linux-gnu/sysroot" INTLTOOL_PERL=/usr/bin/perl PYTHONPATH="[...]output/host/aarch64-buildroot-linux-gnu/sysroot/usr/lib/python3.10/" PYTHONNOUSERSITE=1 SETUPTOOLS_USE_DISTUTILS=stdlib _python_sysroot=[...]output/host/aarch64-buildroot-linux-gnu/sysroot _python_prefix=/usr _python_exec_prefix=/usr  [...]output/host/bin/python setup.py build  )
[...]output/build/python-awscrt-0.16.10/setup.py:5: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
  import distutils.ccompiler
running build
running build_py
running build_ext
> [...]output/host/bin/cmake -H[...]output/build/python-awscrt-0.16.10/crt -Bbuild/temp.linux-aarch64-3.10/deps -DCMAKE_INSTALL_PREFIX=build/temp.linux-aarch64-3.10/deps/install -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_SYSTEM_NAME=Linux -DCMAKE_SYSTEM_PROCESSOR=arm
-- Go not found. Disabling some code generation and using pre-generated code in generated-src/
-- Perl not found. Disabling some code generation and using pre-generated code in generated-src/
-- Run check_run file_to_test 'memcmp_invalid_stripped_check.c', flag_to_set 'MEMCMP_INVALID_STRIPPED', and compile_flags '-O2 -g -DNDEBUG'.
CMake Warning at aws-lc/CMakeLists.txt:240 (message):
  Currently, GCC 10.3.0 is not supported due to a memcmp related bug reported
  in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95189.

  We strongly recommend against using the GCC 10.3.0 compiler.


-- Test stdalign_check.c passed, enabling AWS_LC_STDALIGN_AVAILABLE
-- Test builtin_swap_check.c passed, enabling AWS_LC_BUILTIN_SWAP_SUPPORTED
Copying platform assembly files from [...]output/build/python-awscrt-0.16.10/crt/aws-lc/generated-src/linux-x86_64/crypto/ to [...]output/build/python-awscrt-0.16.10/build/temp.linux-aarch64-3.10/deps/aws-lc/crypto
-- Detected CMAKE_SYSTEM_PROCESSOR as x86_64
-- Detected 64-Bit system
-- madvise() support detected
-- clone() support detected
-- S2N found target: crypto
-- CMAKE_AR found: /usr/bin/ar
-- CMake 3.16.9
-- Packaging currently only supported on Fedora.
-- Using libcrypto from AWS-LC
-- Configuring done

I am also using this

cmake_args.extend([
            f'-DCMAKE_SYSTEM_NAME=Linux',
            f'-DCMAKE_SYSTEM_PROCESSOR=arm'
        ])

in setup.py

What's not clear is -- Detected CMAKE_SYSTEM_PROCESSOR as x86_64. I expected this to be arm as we have set it in setup.py. I don't know why this is being overwritten during make

@TwistedTwigleg
Copy link
Contributor

Hey @Sourabh-ALTEN,

Not a problem, I will reopen the issue.

Right off, I'm not sure what would have caused it to suddenly change and use the wrong system architecture. It seems to be something with AWS-LC, but from what I can tell, setting DCMAKE_SYSTEM_PROCESSOR should tell it to use ARM. We have not made a new release in that time either, so I'm not sure what would have changed.

What could be happening, and this is entirely hunch based currently, is that AWS LC has it's own way for checking the system processor or the CMAKE process is somehow different, and that this change is what is making the build find the processor on the system building rather than the architecture for cross-compiling.

@graebm
Copy link
Contributor

graebm commented Feb 13, 2023

Would it be possible to get Buildroot to download one of the precompiled wheels such as awscrt-0.16.10-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl, instead of trying to cross-compile the C code locally on your system?

@graebm
Copy link
Contributor

graebm commented Feb 14, 2023

Or can you set the CMAKE_TOOLCHAIN_FILE env var so that CMake figures out the right way to cross-compile?

@Sourabh-ALTEN
Copy link
Author

Sourabh-ALTEN commented Feb 14, 2023

@graebm What should I set in CMAKE_TOOLCHAIN_FILE? Can you please let me know the location of toolchain file?

In the CMakeCache.txt I found

//No help, variable specified on the command line.
CMAKE_SYSTEM_NAME:UNINITIALIZED=Linux

//No help, variable specified on the command line.
CMAKE_SYSTEM_PROCESSOR:UNINITIALIZED=arm

@Sourabh-ALTEN
Copy link
Author

Hello @graebm I think working with precompiled wheels is much better than cross-compiling. But, I wanted to ask about the precompiled wheel for awsiotsdk https://pypi.org/project/awsiotsdk/#files. Can this be used on all target machines? No machine specific wheels are available

@graebm
Copy link
Contributor

graebm commented Feb 14, 2023

I don't know anything about Buildroot other than what I spent 5 minutes googling. I was just spitballing ideas. It's going to be a while before we have time to look into this. I'll dump some information here, for when we have time to dig deeper...

aws-crt-python is a wrapper around a bunch of different C libraries. When building aws-crt-python, CMake is used to build these as static libraries, then Python's setuptools finishes linking them all together into a single shared library. It seems like we need to feed more information to CMake so that it builds for your target platform, instead of naively building for your host platform.

We'll need to dig into how Buildroot and Python C extensions work together to determine to correct build configurations

@Sourabh-ALTEN
Copy link
Author

Hello @graebm @TwistedTwigleg finally I managed to cross-compile it. Included below lines in https://github.com/awslabs/aws-crt-python/blob/main/crt/CMakeLists.txt

set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR arm)

But, when I tried to run the sample https://github.com/aws/aws-iot-device-sdk-python-v2/blob/main/samples/fleetprovisioning.py which parses

import _awscrt
.
And then I get below error:

ImportError: /usr/lib/python3.10/site-packages/_awscrt.cpython-310-aarch64-linux-gnu.so: undefined symbol: aes_hw_encrypt

I don't know what is the reason for this?

However, when I install awsiotsdk and awscrt using pipon the target, I don't get this error.
pip also installs similar file to /usr/lib/python3.10/site-packages/_awscrt.cpython-310-aarch64-linux-gnu.so

When checked with file
cross-compile awscrt:

file _awscrt.cpython-310-aarch64-linux-gnu.so
_awscrt.cpython-310-aarch64-linux-gnu.so: ELF 64-bit LSB shared object, ARM aarch64, version 1 (SYSV), dynamically linked, stripped

pip installed awscrt:

file _awscrt.cpython-310-aarch64-linux-gnu.so
_awscrt.cpython-310-aarch64-linux-gnu.so: ELF 64-bit LSB shared object, ARM aarch64, version 1 (SYSV), dynamically linked, BuildID[sha1]=f8cdc5352e14d28d19d42dbd23cad3db0750310b, with debug_info, not stripped

Could you please let me know how to resolve this?

@TwistedTwigleg
Copy link
Contributor

And then I get below error:

ImportError: /usr/lib/python3.10/site-packages/_awscrt.cpython-310-aarch64-linux-gnu.so: undefined symbol: aes_hw_encrypt

I don't know what is the reason for this?

This appears to be code in AWS-LC that is causing this error to occur. It seems to deal with FIPS keys and is an ARM processor function, from what I can tell.

My guess, and this is pure speculation, is that the cross-compiler either doesn't have the ARM functions required or the cross-compiler is not indicating to AWS-LC which processor it has. Either way, the binary compiled seems not to have the aes_hw_encrypt function and therefore cannot run. I'm guessing in the wheels we provide via pip that the platform we're compiling on includes said functions because the ARM processor is properly detected and/or passed to AWS-LC.

Unfortunately, I have no idea how to tell AWS-LC which processor you have right off, as it seems to be done via build-time checks that determine which is being used. However, you might be able to get around this by disabling ASM entirely, though this may lead to decreased performance as it is not using ARM assembly, by setting set(OPENSSL_NO_ASM true). However, I have not tried this, this is entirely based at looking at AWS-LC's CMAKE file.

(Side thought: I wonder if other submodules in the crt folder are setting the processor NOT to Linux and Arm via the override, set(CMAKE_SYSTEM_NAME Linux) and set(CMAKE_SYSTEM_PROCESSOR arm), and so that is the issue...? Would need investigation to find out...)

When checked with file ...

With the exception of the BuildID, the only other change seems to be that the pip installed version includes debug info and is not stripped. This is probably because we are building with RelWithDebInfo or Debug (thought I'm pretty sure we're building with RelWithDebInfo) and so the binary includes the debug information and is not stripped. It looks like the build you have may be in Release mode and so there is no debug symbols included.

However, the default should be RelWithDebInfo, so there shouldn't be a difference there. Can you share how you are running the command to compile?

@Sourabh-ALTEN
Copy link
Author

@TwistedTwigleg yes, yor right. I think cross-compile didn't work. I see further erros when I do:

strings _awscrt.cpython-310-aarch64-linux-gnu.so | grep -i aes_

Error encountered in [...]/build/python-awscrt-0.16.10/crt/s2n/crypto/s2n_aead_cipher_aes_gcm.c:97
Error encountered in [...]/build/python-awscrt-0.16.10/crt/s2n/crypto/s2n_aead_cipher_aes_gcm.c:98
Error encountered in [...]/build/python-awscrt-0.16.10/crt/s2n/crypto/s2n_aead_cipher_aes_gcm.c:100
Error encountered in [...]/build/python-awscrt-0.16.10/crt/s2n/crypto/s2n_aead_cipher_aes_gcm.c:102
Error encountered in [...]/build/python-awscrt-0.16.10/crt/s2n/crypto/s2n_aead_cipher_aes_gcm.c:121
Error encountered in [...]/build/python-awscrt-0.16.10/crt/s2n/crypto/s2n_aead_cipher_aes_gcm.c:122
Error encountered in [...]/build/python-awscrt-0.16.10/crt/s2n/crypto/s2n_aead_cipher_aes_gcm.c:124
Error encountered in [...]/build/python-awscrt-0.16.10/crt/s2n/crypto/s2n_aead_cipher_aes_gcm.c:126
Error encountered in [...]/build/python-awscrt-0.16.10/crt/s2n/crypto/s2n_aead_cipher_aes_gcm.c:50
Error encountered in [...]/build/python-awscrt-0.16.10/crt/s2n/crypto/s2n_aead_cipher_aes_gcm.c:51
Error encountered in [...]/build/python-awscrt-0.16.10/crt/s2n/crypto/s2n_aead_cipher_aes_gcm.c:52
Error encountered in [...]/build/python-awscrt-0.16.10/crt/s2n/crypto/s2n_aead_cipher_aes_gcm.c:53
Error encountered in [...]/build/python-awscrt-0.16.10/crt/s2n/crypto/s2n_aead_cipher_aes_gcm.c:54
Error encountered in [...]/build/python-awscrt-0.16.10/crt/s2n/crypto/s2n_aead_cipher_aes_gcm.c:57
Error encountered in [...]/build/python-awscrt-0.16.10/crt/s2n/crypto/s2n_aead_cipher_aes_gcm.c:58
Error encountered in [...]/build/python-awscrt-0.16.10/crt/s2n/crypto/s2n_aead_cipher_aes_gcm.c:59
Error encountered in [...]/build/python-awscrt-0.16.10/crt/s2n/crypto/s2n_aead_cipher_aes_gcm.c:66
Error encountered in [...]/build/python-awscrt-0.16.10/crt/s2n/crypto/s2n_aead_cipher_aes_gcm.c:68
Error encountered in [...]/build/python-awscrt-0.16.10/crt/s2n/crypto/s2n_aead_cipher_aes_gcm.c:75
Error encountered in [...]/build/python-awscrt-0.16.10/crt/s2n/crypto/s2n_aead_cipher_aes_gcm.c:76
Error encountered in [...]/build/python-awscrt-0.16.10/crt/s2n/crypto/s2n_aead_cipher_aes_gcm.c:77
Error encountered in [...]/build/python-awscrt-0.16.10/crt/s2n/crypto/s2n_aead_cipher_aes_gcm.c:78
Error encountered in [...]/build/python-awscrt-0.16.10/crt/s2n/crypto/s2n_aead_cipher_aes_gcm.c:79
Error encountered in [...]/build/python-awscrt-0.16.10/crt/s2n/crypto/s2n_aead_cipher_aes_gcm.c:81
Error encountered in [...]/build/python-awscrt-0.16.10/crt/s2n/crypto/s2n_aead_cipher_aes_gcm.c:82
Error encountered in [...]/build/python-awscrt-0.16.10/crt/s2n/crypto/s2n_aead_cipher_aes_gcm.c:83
Error encountered in [...]/build/python-awscrt-0.16.10/crt/s2n/crypto/s2n_aead_cipher_aes_gcm.c:88
Error encountered in [...]/build/python-awscrt-0.16.10/crt/s2n/crypto/s2n_aead_cipher_aes_gcm.c:90
Error encountered in [...]/build/python-awscrt-0.16.10/crt/s2n/crypto/s2n_aead_cipher_aes_gcm.c:109
Error encountered in [...]/build/python-awscrt-0.16.10/crt/s2n/crypto/s2n_aead_cipher_aes_gcm.c:110
Error encountered in [...]/build/python-awscrt-0.16.10/crt/s2n/crypto/s2n_aead_cipher_aes_gcm.c:112
Error encountered in [...]/build/python-awscrt-0.16.10/crt/s2n/crypto/s2n_aead_cipher_aes_gcm.c:114
Error encountered in [...]/build/python-awscrt-0.16.10/crt/s2n/crypto/s2n_aead_cipher_aes_gcm.c:133
Error encountered in [...]/build/python-awscrt-0.16.10/crt/s2n/crypto/s2n_aead_cipher_aes_gcm.c:134
Error encountered in [...]/build/python-awscrt-0.16.10/crt/s2n/crypto/s2n_aead_cipher_aes_gcm.c:136
Error encountered in [...]/build/python-awscrt-0.16.10/crt/s2n/crypto/s2n_aead_cipher_aes_gcm.c:138
Error encountered in [...]/build/python-awscrt-0.16.10/crt/s2n/crypto/s2n_aead_cipher_aes_gcm.c:145
Error encountered in [...]/build/python-awscrt-0.16.10/crt/s2n/crypto/s2n_aead_cipher_aes_gcm.c:146
Error encountered in [...]/build/python-awscrt-0.16.10/crt/s2n/crypto/s2n_aead_cipher_aes_gcm.c:148
Error encountered in [...]/build/python-awscrt-0.16.10/crt/s2n/crypto/s2n_aead_cipher_aes_gcm.c:150
Error encountered in [...]/build/python-awscrt-0.16.10/crt/s2n/crypto/s2n_aead_cipher_aes_gcm.c:169
Error encountered in [...]/build/python-awscrt-0.16.10/crt/s2n/crypto/s2n_aead_cipher_aes_gcm.c:170
Error encountered in [...]/build/python-awscrt-0.16.10/crt/s2n/crypto/s2n_aead_cipher_aes_gcm.c:172
Error encountered in [...]/build/python-awscrt-0.16.10/crt/s2n/crypto/s2n_aead_cipher_aes_gcm.c:174
Error encountered in [...]/build/python-awscrt-0.16.10/crt/s2n/crypto/s2n_aead_cipher_aes_gcm.c:157
Error encountered in [...]/build/python-awscrt-0.16.10/crt/s2n/crypto/s2n_aead_cipher_aes_gcm.c:158
Error encountered in [...]/build/python-awscrt-0.16.10/crt/s2n/crypto/s2n_aead_cipher_aes_gcm.c:160
Error encountered in [...]/build/python-awscrt-0.16.10/crt/s2n/crypto/s2n_aead_cipher_aes_gcm.c:162
Error encountered in [...]/build/python-awscrt-0.16.10/crt/s2n/crypto/s2n_aead_cipher_aes_gcm.c:181
Error encountered in [...]/build/python-awscrt-0.16.10/crt/s2n/crypto/s2n_aead_cipher_aes_gcm.c:182
Error encountered in [...]/build/python-awscrt-0.16.10/crt/s2n/crypto/s2n_aead_cipher_aes_gcm.c:184
Error encountered in [...]/build/python-awscrt-0.16.10/crt/s2n/crypto/s2n_aead_cipher_aes_gcm.c:186
Error encountered in [...]/build/python-awscrt-0.16.10/crt/s2n/crypto/s2n_aead_cipher_aes_gcm.c:202
Error encountered in [...]/build/python-awscrt-0.16.10/crt/s2n/crypto/s2n_aead_cipher_aes_gcm.c:193
TLS_AES_256_GCM_SHA384
TLS_AES_128_GCM_SHA256
Error encountered in [...]/build/python-awscrt-0.16.10/crt/s2n/crypto/s2n_composite_cipher_aes_sha.c:157
Error encountered in [...]/build/python-awscrt-0.16.10/crt/s2n/crypto/s2n_composite_cipher_aes_sha.c:166
Error encountered in [...]/build/python-awscrt-0.16.10/crt/s2n/crypto/s2n_composite_cipher_aes_sha.c:168
Error encountered in [...]/build/python-awscrt-0.16.10/crt/s2n/crypto/s2n_composite_cipher_aes_sha.c:172
Error encountered in [...]/build/python-awscrt-0.16.10/crt/s2n/crypto/s2n_composite_cipher_aes_sha.c:174
Error encountered in [...]/build/python-awscrt-0.16.10/crt/s2n/crypto/s2n_composite_cipher_aes_sha.c:181
Error encountered in [...]/build/python-awscrt-0.16.10/crt/s2n/crypto/s2n_composite_cipher_aes_sha.c:182
Error encountered in [...]/build/python-awscrt-0.16.10/crt/s2n/crypto/s2n_composite_cipher_aes_sha.c:187
Error encountered in [...]/build/python-awscrt-0.16.10/crt/s2n/crypto/s2n_composite_cipher_aes_sha.c:212
Error encountered in [...]/build/python-awscrt-0.16.10/crt/s2n/crypto/s2n_composite_cipher_aes_sha.c:222
Error encountered in [...]/build/python-awscrt-0.16.10/crt/s2n/crypto/s2n_composite_cipher_aes_sha.c:194
Error encountered in [...]/build/python-awscrt-0.16.10/crt/s2n/crypto/s2n_composite_cipher_aes_sha.c:203
Error encountered in [...]/build/python-awscrt-0.16.10/crt/s2n/crypto/s2n_composite_cipher_aes_sha.c:232
Error encountered in [...]/build/python-awscrt-0.16.10/crt/s2n/crypto/s2n_composite_cipher_aes_sha.c:242
Error encountered in [...]/build/python-awscrt-0.16.10/crt/s2n/crypto/s2n_composite_cipher_aes_sha.c:252
Error encountered in [...]/build/python-awscrt-0.16.10/crt/s2n/crypto/s2n_composite_cipher_aes_sha.c:262
Error encountered in [...]/build/python-awscrt-0.16.10/crt/s2n/crypto/s2n_composite_cipher_aes_sha.c:272
Error encountered in [...]/build/python-awscrt-0.16.10/crt/s2n/crypto/s2n_composite_cipher_aes_sha.c:282
AES_KEY_SETUP_FAILED
AES_set_encrypt_key failed.
AES_set_decrypt_key failed.

strings _awscrt.cpython-310-aarch64-linux-gnu.so | grep -i EVP_

Error encountered in [...]/build/python-awscrt-0.16.10/crt/s2n/crypto/s2n_evp_signing.c:154
Error encountered in [...]/build/python-awscrt-0.16.10/crt/s2n/crypto/s2n_evp_signing.c:70
[...]/build/python-awscrt-0.16.10/crt/aws-lc/crypto/evp_extra/evp_asn1.c
[...]/build/python-awscrt-0.16.10/crt/aws-lc/crypto/fipsmodule/evp/evp_ctx.c
EVP_AEAD_CTX_init for AES-128-GCM failed.
EVP_AEAD_CTX_seal for AES-128-GCM failed.
AES-GCM-decrypt KAT failed because EVP_AEAD_CTX_open failed.

Can you share how you are running the command to compile?

Since these packages are not part of standard Buildroot, i had to add them. First I created python-packages https://buildroot.org/downloads/manual/manual.html#_infrastructure_for_python_packages section 18.9.3 (Generating a python-package from a PyPI repository). Then this packages has to be added to buildroot-packages. And selected them in Buildroot config. Modified CMakeLists.txt file in https://github.com/awslabs/aws-crt-python/blob/main/crt/CMakeLists.txt to include set(CMAKE_SYSTEM_NAME Linux) and set(CMAKE_SYSTEM_PROCESSOR arm). Build the Linux image using make.

@jameshilliard
Copy link

We'll need to dig into how Buildroot and Python C extensions work together to determine to correct build configurations

I maintain a lot of buildroot's python cross compilation infrastructure and made a detailed write-up on the buildroot mailing list regarding what is required to support aws-crt-python in buildroot, copying the details here so that it's clear what is needed.

The problem with building aws-crt-python in buildroot is that while the python awscrt package uses setuptools it's not a normal python setuptools package, the setup.py installs both a normal setuptools package and a vendored cmake package(meta package really).

See cmake build wrapper functionality here in the setuptools setup.py file:
https://github.com/awslabs/aws-crt-python/blob/v0.16.10/setup.py#L156-L272

This is the cmake meta project root which is vendored inside of awscrt:
https://github.com/awslabs/aws-crt-python/tree/v0.16.10/crt

See meta cmakelists build:
https://github.com/awslabs/aws-crt-python/blob/v0.16.10/crt/CMakeLists.txt

This meta project is made up of multiple subprojects:

aws-c-auth
aws-c-cal
aws-c-common
aws-c-compression
aws-c-event-stream
aws-checksums
aws-c-http
aws-c-io
aws-c-mqtt
aws-c-s3
aws-c-sdkutils
aws-lc
s2n

In buildroot we expect cmake packages to use our cmake infrastructure as it will set up the cross compilation environment correctly while the awscrt setuptools cmake wrapper does not.

I confirmed that the cmake packages build correctly when using our cmake infrastructure:

################################################################################
#
# python-awscrt
#
################################################################################

PYTHON_AWSCRT_VERSION = 0.16.10
PYTHON_AWSCRT_SOURCE = awscrt-$(PYTHON_AWSCRT_VERSION).tar.gz
PYTHON_AWSCRT_SITE = https://files.pythonhosted.org/packages/ae/98/dda092078f2d47bad08e184ab9d364b8f89166497062bc1cf811c0bbbde2
PYTHON_AWSCRT_SUBDIR = crt

$(eval $(cmake-package))

See:
https://buildroot.org/downloads/manual/manual.html#_infrastructure_for_cmake_based_packages

So what I think you need to do is create buildroot cmake packages for all
these subprojects using buildroot's cmake infrastructure:
https://github.com/awslabs/aws-c-auth
https://github.com/awslabs/aws-c-cal
https://github.com/awslabs/aws-c-common
https://github.com/awslabs/aws-c-compression
https://github.com/awslabs/aws-c-event-stream
https://github.com/awslabs/aws-checksums
https://github.com/awslabs/aws-c-http
https://github.com/awslabs/aws-c-io
https://github.com/awslabs/aws-c-mqtt
https://github.com/awslabs/aws-c-s3
https://github.com/awslabs/aws-c-sdkutils
https://github.com/awslabs/aws-lc
https://github.com/aws/s2n-tls

You will then probably need to modify the setup.py file so that instead of using the cmake build functions have it use the system versions of these libraries pre-installed via the buildroot cmake infrastructure.

You can probably use and check for an env variable such as this in the setup.py:
PYTHON_AWSCRT_USE_SYSTEM_CRT=1

When present have it disable building the cmake libraries itself and search or the installed system crt libraries instead of using the vendored cmake build.

You should upstream this setup.py functionality to the aws-crt-project as well so that we don't need to carry a patch in buildroot for python-awscrt to use the system crt libraries.

Then from the python-awscrt buildroot package you would set that env variable and add all the cmake subprojects as buildroot package dependencies.

First thing you should start with is adding the cmake buildroot packages for the crt subprojects to buildroot and then work on modifying aws-crt-python to work correctly with them instead of trying to use the broken aws-crt-python cmake setuptools wrapper functionality.

So this project will need to support system crt libraries in order for buildroot to support this python package.

If the python package build is calling out to cmake it won't work correctly with buildroot(ie we need a way to disable the vendored cmake component builds) as doing so bypasses our cmake infrastructure. We need to build the cmake components separately and then have the python package build use those compoenents after the are built/installed.

@jameshilliard
Copy link

When building aws-crt-python, CMake is used to build these as static libraries, then Python's setuptools finishes linking them all together into a single shared library.

For buildroot we generally want to allow them to be built and installed as shared libraries unless there is a good reason not to.

It seems like we need to feed more information to CMake so that it builds for your target platform, instead of naively building for your host platform.

This is not likely to be a viable approach for buildroot, we have separate cmake infrastructure that should be used independently of setuptools for building the crt components which require cmake. Trying to replicate all our cmake cross compilation logic in setuptools will be difficult and unreliable.

@graebm graebm added the feature-request A feature should be added or improved. label Apr 25, 2023
@set-soft set-soft mentioned this issue Jul 5, 2023
2 tasks
@jmklix jmklix added the p3 This is a minor priority issue label Jul 7, 2023
@SudipShresthaOr
Copy link

SudipShresthaOr commented Jun 5, 2024

This issue is really frustrating as I was having a similar problem with building in Docker using arm32v7/ubuntu:xenial. It was an ARM-based 32-bit architecture with an Ubuntu 16-based system.

Along with cmake installed, I had to install the following two libraries like this before installing awsiotsdk, and it worked for me:

  1. pip3 install awscliv2==2.2.0
  2. AWS_CRT_BUILD_USE_SYSTEM_LIBCRYPTO=1 pip3 install --no-binary :all: --verbose awscrt=0.20.10
  3. pip3 install awsiotsdk==1.21.5

I wasted around one week trying to figure this out. I hope this helps others.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CRT/IoT feature-request A feature should be added or improved. p3 This is a minor priority issue
Projects
None yet
Development

No branches or pull requests

6 participants