cryptoadvance / specter-diy

DIY airgapped hardware wallet that uses QR codes for communication with the host
MIT License
440 stars 73 forks source link

unixport on Apple M-chips doesn't compile #219

Open stepansnigirev opened 1 year ago

stepansnigirev commented 1 year ago

Compiles fine with micropython master

CC ../../../usermods/secp256k1/mpy/libsecp256k1.c
../../../usermods/secp256k1/mpy/libsecp256k1.c:496:48: warning: passing 'char *' to parameter of type 'unsigned char *' converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Wpointer-sign]
    int res = secp256k1_ec_privkey_negate(ctx, vstr.buf);
                                               ^~~~~~~~
../../../usermods/secp256k1/secp256k1/include/secp256k1.h:641:20: note: passing argument to parameter 'seckey' here
    unsigned char *seckey
                   ^
../../../usermods/secp256k1/mpy/libsecp256k1.c:578:51: warning: passing 'char *' to parameter of type 'unsigned char *' converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Wpointer-sign]
    int res = secp256k1_ec_privkey_tweak_add(ctx, priv2.buf, tweakbuf.buf);
                                                  ^~~~~~~~~
../../../usermods/secp256k1/secp256k1/include/secp256k1.h:680:20: note: passing argument to parameter 'seckey' here
    unsigned char *seckey,
                   ^
../../../usermods/secp256k1/mpy/libsecp256k1.c:1230:25: warning: assigning to 'unsigned char *' from 'char *' converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Wpointer-sign]
            bfactors[i] = vstr.buf;
                        ^ ~~~~~~~~
../../../usermods/secp256k1/mpy/libsecp256k1.c:1472:56: warning: passing 'char *' to parameter of type 'unsigned char *' converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Wpointer-sign]
    int res = secp256k1_surjectionproof_serialize(ctx, vstr.buf, &l, ptr);
                                                       ^~~~~~~~
../../../usermods/secp256k1/secp256k1/include/secp256k1_surjectionproof.h:93:18: note: passing argument to parameter 'output' here
  unsigned char *output,
                 ^
../../../usermods/secp256k1/mpy/libsecp256k1.c:1559:46: warning: passing 'char *' to parameter of type 'unsigned char *' converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Wpointer-sign]
    int res = secp256k1_rangeproof_sign(ctx, vstr.buf, &prooflen,
                                             ^~~~~~~~
../../../usermods/secp256k1/secp256k1/include/secp256k1_rangeproof.h:252:18: note: passing argument to parameter 'proof' here
  unsigned char *proof,
                 ^
../../../usermods/secp256k1/mpy/libsecp256k1.c:1724:48: warning: passing 'char *' to parameter of type 'unsigned char *' converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Wpointer-sign]
    int res = secp256k1_rangeproof_rewind(ctx, vbf_out.buf, &value_out,
                                               ^~~~~~~~~~~
../../../usermods/secp256k1/secp256k1/include/secp256k1_rangeproof.h:208:18: note: passing argument to parameter 'blind_out' here
  unsigned char *blind_out,
                 ^
../../../usermods/secp256k1/mpy/libsecp256k1.c:1725:29: warning: passing 'char *' to parameter of type 'unsigned char *' converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Wpointer-sign]
                            msg.buf, &msglenout,
                            ^~~~~~~
../../../usermods/secp256k1/secp256k1/include/secp256k1_rangeproof.h:210:18: note: passing argument to parameter 'message_out' here
  unsigned char *message_out,
                 ^
../../../usermods/secp256k1/mpy/libsecp256k1.c:1888:61: warning: passing 'char *' to parameter of type 'unsigned char *' converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Wpointer-sign]
    int res = secp256k1_rangeproof_rewind_preallocated(ctx, vbf_out.buf, &value_out,
                                                            ^~~~~~~~~~~
../../../usermods/secp256k1/mpy/config/rangeproof_preallocated/rangeproof_preallocated.h:10:17: note: passing argument to parameter 'blind_out' here
 unsigned char *blind_out, uint64_t *value_out, unsigned char *message_out, size_t *outlen, const unsigned char *nonce,
                ^
../../../usermods/secp256k1/mpy/libsecp256k1.c:1889:29: warning: passing 'char *' to parameter of type 'unsigned char *' converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Wpointer-sign]
                            msg.buf, &msglenout,
                            ^~~~~~~
../../../usermods/secp256k1/mpy/config/rangeproof_preallocated/rangeproof_preallocated.h:10:64: note: passing argument to parameter 'message_out' here
 unsigned char *blind_out, uint64_t *value_out, unsigned char *message_out, size_t *outlen, const unsigned char *nonce,
                                                               ^
9 warnings generated.
CC ../../../usermods/udisplay_f469/display_unix.c
CC ../../../usermods/udisplay_f469/display_unix_sdl.c
In file included from ../../../usermods/udisplay_f469/display_unix_sdl.c:1:
In file included from ../../../usermods/udisplay_f469/lv_sdl_hal/SDL/modSDL.c:3:
In file included from ../../../usermods/udisplay_f469/lv_sdl_hal/SDL/SDL_mouse.h:25:
In file included from /usr/local/include/SDL2/SDL.h:38:
In file included from /usr/local/include/SDL2/SDL_cpuinfo.h:99:
In file included from /Library/Developer/CommandLineTools/usr/lib/clang/13.1.6/include/immintrin.h:13:
In file included from /Library/Developer/CommandLineTools/usr/lib/clang/13.1.6/include/x86gprintrin.h:15:
/Library/Developer/CommandLineTools/usr/lib/clang/13.1.6/include/hresetintrin.h:42:27: error: invalid input constraint 'a' in asm
  __asm__ ("hreset $0" :: "a"(__eax));
                          ^
In file included from ../../../usermods/udisplay_f469/display_unix_sdl.c:1:
In file included from ../../../usermods/udisplay_f469/lv_sdl_hal/SDL/modSDL.c:3:
In file included from ../../../usermods/udisplay_f469/lv_sdl_hal/SDL/SDL_mouse.h:25:
In file included from /usr/local/include/SDL2/SDL.h:38:
In file included from /usr/local/include/SDL2/SDL_cpuinfo.h:99:
In file included from /Library/Developer/CommandLineTools/usr/lib/clang/13.1.6/include/immintrin.h:17:
/Library/Developer/CommandLineTools/usr/lib/clang/13.1.6/include/mmintrin.h:50:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
    return (__m64)__builtin_ia32_vec_init_v2si(__i, 0);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/usr/lib/clang/13.1.6/include/mmintrin.h:129:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
    return (__m64)__builtin_ia32_packsswb((__v4hi)__m1, (__v4hi)__m2);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/usr/lib/clang/13.1.6/include/mmintrin.h:159:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
    return (__m64)__builtin_ia32_packssdw((__v2si)__m1, (__v2si)__m2);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/usr/lib/clang/13.1.6/include/mmintrin.h:189:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
    return (__m64)__builtin_ia32_packuswb((__v4hi)__m1, (__v4hi)__m2);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/usr/lib/clang/13.1.6/include/mmintrin.h:216:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
    return (__m64)__builtin_ia32_punpckhbw((__v8qi)__m1, (__v8qi)__m2);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/usr/lib/clang/13.1.6/include/mmintrin.h:239:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
    return (__m64)__builtin_ia32_punpckhwd((__v4hi)__m1, (__v4hi)__m2);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/usr/lib/clang/13.1.6/include/mmintrin.h:260:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
    return (__m64)__builtin_ia32_punpckhdq((__v2si)__m1, (__v2si)__m2);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/usr/lib/clang/13.1.6/include/mmintrin.h:287:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
    return (__m64)__builtin_ia32_punpcklbw((__v8qi)__m1, (__v8qi)__m2);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/usr/lib/clang/13.1.6/include/mmintrin.h:310:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
    return (__m64)__builtin_ia32_punpcklwd((__v4hi)__m1, (__v4hi)__m2);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/usr/lib/clang/13.1.6/include/mmintrin.h:331:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
    return (__m64)__builtin_ia32_punpckldq((__v2si)__m1, (__v2si)__m2);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/usr/lib/clang/13.1.6/include/mmintrin.h:352:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
    return (__m64)__builtin_ia32_paddb((__v8qi)__m1, (__v8qi)__m2);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/usr/lib/clang/13.1.6/include/mmintrin.h:373:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
    return (__m64)__builtin_ia32_paddw((__v4hi)__m1, (__v4hi)__m2);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/usr/lib/clang/13.1.6/include/mmintrin.h:394:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
    return (__m64)__builtin_ia32_paddd((__v2si)__m1, (__v2si)__m2);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/usr/lib/clang/13.1.6/include/mmintrin.h:416:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
    return (__m64)__builtin_ia32_paddsb((__v8qi)__m1, (__v8qi)__m2);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/usr/lib/clang/13.1.6/include/mmintrin.h:439:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
    return (__m64)__builtin_ia32_paddsw((__v4hi)__m1, (__v4hi)__m2);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/usr/lib/clang/13.1.6/include/mmintrin.h:461:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
    return (__m64)__builtin_ia32_paddusb((__v8qi)__m1, (__v8qi)__m2);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/usr/lib/clang/13.1.6/include/mmintrin.h:483:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
    return (__m64)__builtin_ia32_paddusw((__v4hi)__m1, (__v4hi)__m2);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/usr/lib/clang/13.1.6/include/mmintrin.h:504:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
    return (__m64)__builtin_ia32_psubb((__v8qi)__m1, (__v8qi)__m2);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make[1]: *** [build/udisplay_f469/display_unix_sdl.o] Error 1
make: *** [unix] Error 2
moneymanolis commented 1 year ago

I also tried to run the simulator today on my new Mac (ARM64). Managed to build micropython (master) and could run simulate.py with it, but of course it then complained about not having lvgl etc. since we "bake" additional libraries into the micropython binary.

Would be great if we could upgrade the Micropython version to make the simulator work again. I can also test to build other commits below master of Micropython if this helps.