albertobsd / keyhunt

privkey hunt for crypto currencies that use secp256k1 elliptic curve
MIT License
668 stars 391 forks source link

Mac M1 Max Build #155

Closed graffitilogic closed 1 year ago

graffitilogic commented 2 years ago

Hey there - any luck on your Mac-compatible build? Just checking in, I know you have alot of people throwing suggestions at you. I was just curious if there would be a performance implication to the gmp approach when its done.

Will your GMP build be able to leverage any extra performance benefit out of the M1 Max chip, leverage the GPU cores on the processor or is all that still a pretty big leap away?

-- make output on my m1 max machine / macOS 12.01 --

++ -O3 -c oldbloom/bloom.cpp -o oldbloom.o g++ -O3 -c bloom/bloom.cpp -o bloom.o gcc -O3 -c base58/base58.c -o base58.o gcc -O3 -c rmd160/rmd160.c -o rmd160.o g++ -O3 -c sha3/sha3.c -o sha3.o clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated] g++ -O3 -c sha3/keccak.c -o keccak.o clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated] sha3/keccak.c:59:2: warning: '(' and '{' tokens introducing statement expression appear in different macro expansion contexts [-Wcompound-token-split-by-macro] FOR5(y, { ^~~~~ sha3/keccak.c:37:11: note: expanded from macro 'FOR5' (X) = 0; (STMT); \ ^ sha3/keccak.c:59:10: note: '{' token is here FOR5(y, { ^ sha3/keccak.c:37:12: note: expanded from macro 'FOR5' (X) = 0; (STMT); \ ^~~~ sha3/keccak.c:65:2: warning: '}' and ')' tokens terminating statement expression appear in different macro expansion contexts [-Wcompound-token-split-by-macro] }); ^ sha3/keccak.c:37:12: note: expanded from macro 'FOR5' (X) = 0; (STMT); \ ^~~~ sha3/keccak.c:59:2: note: ')' token is here FOR5(y, { ^~~~~ sha3/keccak.c:37:16: note: expanded from macro 'FOR5' (X) = 0; (STMT); \ ^ sha3/keccak.c:59:2: warning: '(' and '{' tokens introducing statement expression appear in different macro expansion contexts [-Wcompound-token-split-by-macro] FOR5(y, { ^~~~~ sha3/keccak.c:38:11: note: expanded from macro 'FOR5' (X) = 1; (STMT); \ ^ sha3/keccak.c:59:10: note: '{' token is here FOR5(y, { ^ sha3/keccak.c:38:12: note: expanded from macro 'FOR5' (X) = 1; (STMT); \ ^~~~ sha3/keccak.c:65:2: warning: '}' and ')' tokens terminating statement expression appear in different macro expansion contexts [-Wcompound-token-split-by-macro] }); ^ sha3/keccak.c:38:12: note: expanded from macro 'FOR5' (X) = 1; (STMT); \ ^~~~ sha3/keccak.c:59:2: note: ')' token is here FOR5(y, { ^~~~~ sha3/keccak.c:38:16: note: expanded from macro 'FOR5' (X) = 1; (STMT); \ ^ sha3/keccak.c:59:2: warning: '(' and '{' tokens introducing statement expression appear in different macro expansion contexts [-Wcompound-token-split-by-macro] FOR5(y, { ^~~~~ sha3/keccak.c:39:11: note: expanded from macro 'FOR5' (X) = 2; (STMT); \ ^ sha3/keccak.c:59:10: note: '{' token is here FOR5(y, { ^ sha3/keccak.c:39:12: note: expanded from macro 'FOR5' (X) = 2; (STMT); \ ^~~~ sha3/keccak.c:65:2: warning: '}' and ')' tokens terminating statement expression appear in different macro expansion contexts [-Wcompound-token-split-by-macro] }); ^ sha3/keccak.c:39:12: note: expanded from macro 'FOR5' (X) = 2; (STMT); \ ^~~~ sha3/keccak.c:59:2: note: ')' token is here FOR5(y, { ^~~~~ sha3/keccak.c:39:16: note: expanded from macro 'FOR5' (X) = 2; (STMT); \ ^ sha3/keccak.c:59:2: warning: '(' and '{' tokens introducing statement expression appear in different macro expansion contexts [-Wcompound-token-split-by-macro] FOR5(y, { ^~~~~ sha3/keccak.c:40:11: note: expanded from macro 'FOR5' (X) = 3; (STMT); \ ^ sha3/keccak.c:59:10: note: '{' token is here FOR5(y, { ^ sha3/keccak.c:40:12: note: expanded from macro 'FOR5' (X) = 3; (STMT); \ ^~~~ sha3/keccak.c:65:2: warning: '}' and ')' tokens terminating statement expression appear in different macro expansion contexts [-Wcompound-token-split-by-macro] }); ^ sha3/keccak.c:40:12: note: expanded from macro 'FOR5' (X) = 3; (STMT); \ ^~~~ sha3/keccak.c:59:2: note: ')' token is here FOR5(y, { ^~~~~ sha3/keccak.c:40:16: note: expanded from macro 'FOR5' (X) = 3; (STMT); \ ^ sha3/keccak.c:59:2: warning: '(' and '{' tokens introducing statement expression appear in different macro expansion contexts [-Wcompound-token-split-by-macro] FOR5(y, { ^~~~~ sha3/keccak.c:41:11: note: expanded from macro 'FOR5' (X) = 4; (STMT); \ ^ sha3/keccak.c:59:10: note: '{' token is here FOR5(y, { ^ sha3/keccak.c:41:12: note: expanded from macro 'FOR5' (X) = 4; (STMT); \ ^~~~ sha3/keccak.c:65:2: warning: '}' and ')' tokens terminating statement expression appear in different macro expansion contexts [-Wcompound-token-split-by-macro] }); ^ sha3/keccak.c:41:12: note: expanded from macro 'FOR5' (X) = 4; (STMT); \ ^~~~ sha3/keccak.c:59:2: note: ')' token is here FOR5(y, { ^~~~~ sha3/keccak.c:41:16: note: expanded from macro 'FOR5' (X) = 4; (STMT); \ ^ sha3/keccak.c:66:2: warning: '(' and '{' tokens introducing statement expression appear in different macro expansion contexts [-Wcompound-token-split-by-macro] FOR5(y, { ^~~~~ sha3/keccak.c:37:11: note: expanded from macro 'FOR5' (X) = 0; (STMT); \ ^ sha3/keccak.c:66:10: note: '{' token is here FOR5(y, { ^ sha3/keccak.c:37:12: note: expanded from macro 'FOR5' (X) = 0; (STMT); \ ^~~~ sha3/keccak.c:72:2: warning: '}' and ')' tokens terminating statement expression appear in different macro expansion contexts [-Wcompound-token-split-by-macro] }); ^ sha3/keccak.c:37:12: note: expanded from macro 'FOR5' (X) = 0; (STMT); \ ^~~~ sha3/keccak.c:66:2: note: ')' token is here FOR5(y, { ^~~~~ sha3/keccak.c:37:16: note: expanded from macro 'FOR5' (X) = 0; (STMT); \ ^ sha3/keccak.c:66:2: warning: '(' and '{' tokens introducing statement expression appear in different macro expansion contexts [-Wcompound-token-split-by-macro] FOR5(y, { ^~~~~ sha3/keccak.c:38:11: note: expanded from macro 'FOR5' (X) = 1; (STMT); \ ^ sha3/keccak.c:66:10: note: '{' token is here FOR5(y, { ^ sha3/keccak.c:38:12: note: expanded from macro 'FOR5' (X) = 1; (STMT); \ ^~~~ sha3/keccak.c:72:2: warning: '}' and ')' tokens terminating statement expression appear in different macro expansion contexts [-Wcompound-token-split-by-macro] }); ^ sha3/keccak.c:38:12: note: expanded from macro 'FOR5' (X) = 1; (STMT); \ ^~~~ sha3/keccak.c:66:2: note: ')' token is here FOR5(y, { ^~~~~ sha3/keccak.c:38:16: note: expanded from macro 'FOR5' (X) = 1; (STMT); \ ^ sha3/keccak.c:66:2: warning: '(' and '{' tokens introducing statement expression appear in different macro expansion contexts [-Wcompound-token-split-by-macro] FOR5(y, { ^~~~~ sha3/keccak.c:39:11: note: expanded from macro 'FOR5' (X) = 2; (STMT); \ ^ sha3/keccak.c:66:10: note: '{' token is here FOR5(y, { ^ sha3/keccak.c:39:12: note: expanded from macro 'FOR5' (X) = 2; (STMT); \ ^~~~ sha3/keccak.c:72:2: warning: '}' and ')' tokens terminating statement expression appear in different macro expansion contexts [-Wcompound-token-split-by-macro] }); ^ sha3/keccak.c:39:12: note: expanded from macro 'FOR5' (X) = 2; (STMT); \ ^~~~ sha3/keccak.c:66:2: note: ')' token is here FOR5(y, { ^~~~~ sha3/keccak.c:39:16: note: expanded from macro 'FOR5' (X) = 2; (STMT); \ ^ sha3/keccak.c:66:2: warning: '(' and '{' tokens introducing statement expression appear in different macro expansion contexts [-Wcompound-token-split-by-macro] FOR5(y, { ^~~~~ sha3/keccak.c:40:11: note: expanded from macro 'FOR5' (X) = 3; (STMT); \ ^ sha3/keccak.c:66:10: note: '{' token is here FOR5(y, { ^ sha3/keccak.c:40:12: note: expanded from macro 'FOR5' (X) = 3; (STMT); \ ^~~~ sha3/keccak.c:72:2: warning: '}' and ')' tokens terminating statement expression appear in different macro expansion contexts [-Wcompound-token-split-by-macro] }); ^ sha3/keccak.c:40:12: note: expanded from macro 'FOR5' (X) = 3; (STMT); \ ^~~~ sha3/keccak.c:66:2: note: ')' token is here FOR5(y, { ^~~~~ sha3/keccak.c:40:16: note: expanded from macro 'FOR5' (X) = 3; (STMT); \ ^ sha3/keccak.c:66:2: warning: '(' and '{' tokens introducing statement expression appear in different macro expansion contexts [-Wcompound-token-split-by-macro] FOR5(y, { ^~~~~ sha3/keccak.c:41:11: note: expanded from macro 'FOR5' (X) = 4; (STMT); \ ^ sha3/keccak.c:66:10: note: '{' token is here FOR5(y, { ^ sha3/keccak.c:41:12: note: expanded from macro 'FOR5' (X) = 4; (STMT); \ ^~~~ sha3/keccak.c:72:2: warning: '}' and ')' tokens terminating statement expression appear in different macro expansion contexts [-Wcompound-token-split-by-macro] }); ^ sha3/keccak.c:41:12: note: expanded from macro 'FOR5' (X) = 4; (STMT); \ ^~~~ sha3/keccak.c:66:2: note: ')' token is here FOR5(y, { ^~~~~ sha3/keccak.c:41:16: note: expanded from macro 'FOR5' (X) = 4; (STMT); \ ^ sha3/keccak.c:73:24: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]

pragma GCC diagnostic pop

                   ^

sha3/keccak.c:119:2: warning: '(' and '{' tokens introducing statement expression appear in different macro expansion contexts [-Wcompound-token-split-by-macro] FOR5(y, { ^~~~~ sha3/keccak.c:37:11: note: expanded from macro 'FOR5' (X) = 0; (STMT); \ ^ sha3/keccak.c:119:10: note: '{' token is here FOR5(y, { ^ sha3/keccak.c:37:12: note: expanded from macro 'FOR5' (X) = 0; (STMT); \ ^~~~ sha3/keccak.c:130:2: warning: '}' and ')' tokens terminating statement expression appear in different macro expansion contexts [-Wcompound-token-split-by-macro] }); ^ sha3/keccak.c:37:12: note: expanded from macro 'FOR5' (X) = 0; (STMT); \ ^~~~ sha3/keccak.c:119:2: note: ')' token is here FOR5(y, { ^~~~~ sha3/keccak.c:37:16: note: expanded from macro 'FOR5' (X) = 0; (STMT); \ ^ sha3/keccak.c:119:2: warning: '(' and '{' tokens introducing statement expression appear in different macro expansion contexts [-Wcompound-token-split-by-macro] FOR5(y, { ^~~~~ sha3/keccak.c:38:11: note: expanded from macro 'FOR5' (X) = 1; (STMT); \ ^ sha3/keccak.c:119:10: note: '{' token is here FOR5(y, { ^ sha3/keccak.c:38:12: note: expanded from macro 'FOR5' (X) = 1; (STMT); \ ^~~~ sha3/keccak.c:130:2: warning: '}' and ')' tokens terminating statement expression appear in different macro expansion contexts [-Wcompound-token-split-by-macro] }); ^ sha3/keccak.c:38:12: note: expanded from macro 'FOR5' (X) = 1; (STMT); \ ^~~~ sha3/keccak.c:119:2: note: ')' token is here FOR5(y, { ^~~~~ sha3/keccak.c:38:16: note: expanded from macro 'FOR5' (X) = 1; (STMT); \ ^ sha3/keccak.c:119:2: warning: '(' and '{' tokens introducing statement expression appear in different macro expansion contexts [-Wcompound-token-split-by-macro] FOR5(y, { ^~~~~ sha3/keccak.c:39:11: note: expanded from macro 'FOR5' (X) = 2; (STMT); \ ^ sha3/keccak.c:119:10: note: '{' token is here FOR5(y, { ^ sha3/keccak.c:39:12: note: expanded from macro 'FOR5' (X) = 2; (STMT); \ ^~~~ sha3/keccak.c:130:2: warning: '}' and ')' tokens terminating statement expression appear in different macro expansion contexts [-Wcompound-token-split-by-macro] }); ^ sha3/keccak.c:39:12: note: expanded from macro 'FOR5' (X) = 2; (STMT); \ ^~~~ sha3/keccak.c:119:2: note: ')' token is here FOR5(y, { ^~~~~ sha3/keccak.c:39:16: note: expanded from macro 'FOR5' (X) = 2; (STMT); \ ^ sha3/keccak.c:119:2: warning: '(' and '{' tokens introducing statement expression appear in different macro expansion contexts [-Wcompound-token-split-by-macro] FOR5(y, { ^~~~~ sha3/keccak.c:40:11: note: expanded from macro 'FOR5' (X) = 3; (STMT); \ ^ sha3/keccak.c:119:10: note: '{' token is here FOR5(y, { ^ sha3/keccak.c:40:12: note: expanded from macro 'FOR5' (X) = 3; (STMT); \ ^~~~ sha3/keccak.c:130:2: warning: '}' and ')' tokens terminating statement expression appear in different macro expansion contexts [-Wcompound-token-split-by-macro] }); ^ sha3/keccak.c:40:12: note: expanded from macro 'FOR5' (X) = 3; (STMT); \ ^~~~ sha3/keccak.c:119:2: note: ')' token is here FOR5(y, { ^~~~~ sha3/keccak.c:40:16: note: expanded from macro 'FOR5' (X) = 3; (STMT); \ ^ sha3/keccak.c:119:2: warning: '(' and '{' tokens introducing statement expression appear in different macro expansion contexts [-Wcompound-token-split-by-macro] FOR5(y, { ^~~~~ sha3/keccak.c:41:11: note: expanded from macro 'FOR5' (X) = 4; (STMT); \ ^ sha3/keccak.c:119:10: note: '{' token is here FOR5(y, { ^ sha3/keccak.c:41:12: note: expanded from macro 'FOR5' (X) = 4; (STMT); \ ^~~~ sha3/keccak.c:130:2: warning: '}' and ')' tokens terminating statement expression appear in different macro expansion contexts [-Wcompound-token-split-by-macro] }); ^ sha3/keccak.c:41:12: note: expanded from macro 'FOR5' (X) = 4; (STMT); \ ^~~~ sha3/keccak.c:119:2: note: ')' token is here FOR5(y, { ^~~~~ sha3/keccak.c:41:16: note: expanded from macro 'FOR5' (X) = 4; (STMT); \ ^ sha3/keccak.c:131:24: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]

pragma GCC diagnostic pop

                   ^

32 warnings generated. gcc -O3 -c xxhash/xxhash.c -o xxhash.o g++ -O3 -c util.c -o util.o clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated] g++ -m64 -mssse3 -Wno-unused-result -Wno-write-strings -O2 -c secp256k1/Int.cpp -o Int.o clang: warning: argument unused during compilation: '-mssse3' [-Wunused-command-line-argument] In file included from secp256k1/Int.cpp:18: secp256k1/Int.h:204:27: error: invalid output constraint '=d' in asm asm( "mulq %[b];" :"=d"(rhi),"=a"(rlo) :"1"(a),[b]"rm"(b)); ^ secp256k1/Int.h:211:43: error: invalid output constraint '=D' in asm asm ("movq %1,%0;shrdq %3,%2,%0;" : "=D"(c) : "r"(a),"r"(b),"c"(n)); ^ secp256k1/Int.h:218:43: error: invalid output constraint '=D' in asm asm ("movq %1,%0;shldq %3,%2,%0;" : "=D"(c) : "r"(b),"r"(a),"c"(n)); ^ secp256k1/Int.h:234:7: error: use of undeclared identifier '__builtin_ia32_addcarryx_u64' c = _addcarry_u64(c, _umul128(x[1], y, &h), carry, dst + 1); carry = h; ^ secp256k1/Int.h:223:32: note: expanded from macro '_addcarry_u64'

define _addcarry_u64(a,b,c,d) __builtin_ia32_addcarryx_u64(a,b,c,(long long unsigned int*)d);

                           ^

secp256k1/Int.h:235:7: error: use of undeclared identifier '__builtin_ia32_addcarryx_u64' c = _addcarry_u64(c, _umul128(x[2], y, &h), carry, dst + 2); carry = h; ^ secp256k1/Int.h:223:32: note: expanded from macro '_addcarry_u64'

define _addcarry_u64(a,b,c,d) __builtin_ia32_addcarryx_u64(a,b,c,(long long unsigned int*)d);

                           ^

secp256k1/Int.h:236:7: error: use of undeclared identifier '__builtin_ia32_addcarryx_u64' c = _addcarry_u64(c, _umul128(x[3], y, &h), carry, dst + 3); carry = h; ^ secp256k1/Int.h:223:32: note: expanded from macro '_addcarry_u64'

define _addcarry_u64(a,b,c,d) __builtin_ia32_addcarryx_u64(a,b,c,(long long unsigned int*)d);

                           ^

secp256k1/Int.h:237:7: error: use of undeclared identifier '__builtin_ia32_addcarryx_u64' c = _addcarry_u64(c, _umul128(x[4], y, &h), carry, dst + 4); carry = h; ^ secp256k1/Int.h:223:32: note: expanded from macro '_addcarry_u64'

define _addcarry_u64(a,b,c,d) __builtin_ia32_addcarryx_u64(a,b,c,(long long unsigned int*)d);

                           ^

secp256k1/Int.h:253:7: error: use of undeclared identifier '__builtin_ia32_addcarryx_u64' c = _addcarry_u64(c, _umul128(x[1], y, &h), carry, dst + 1); carry = h; ^ secp256k1/Int.h:223:32: note: expanded from macro '_addcarry_u64'

define _addcarry_u64(a,b,c,d) __builtin_ia32_addcarryx_u64(a,b,c,(long long unsigned int*)d);

                           ^

secp256k1/Int.h:254:7: error: use of undeclared identifier '__builtin_ia32_addcarryx_u64' c = _addcarry_u64(c, _umul128(x[2], y, &h), carry, dst + 2); carry = h; ^ secp256k1/Int.h:223:32: note: expanded from macro '_addcarry_u64'

define _addcarry_u64(a,b,c,d) __builtin_ia32_addcarryx_u64(a,b,c,(long long unsigned int*)d);

                           ^

secp256k1/Int.h:255:7: error: use of undeclared identifier '__builtin_ia32_addcarryx_u64' c = _addcarry_u64(c, _umul128(x[3], y, &h), carry, dst + 3); carry = h; ^ secp256k1/Int.h:223:32: note: expanded from macro '_addcarry_u64'

define _addcarry_u64(a,b,c,d) __builtin_ia32_addcarryx_u64(a,b,c,(long long unsigned int*)d);

                           ^

secp256k1/Int.h:262:3: error: use of undeclared identifier '__builtin_ia32_addcarryx_u64' _addcarry_u64(c, 0ULL, carry, dst + (NB64BLOCK - 1)); ^ secp256k1/Int.h:223:32: note: expanded from macro '_addcarry_u64'

define _addcarry_u64(a,b,c,d) __builtin_ia32_addcarryx_u64(a,b,c,(long long unsigned int*)d);

                           ^

In file included from secp256k1/Int.cpp:24: In file included from /Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/emmintrin.h:13: In file included from /Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/xmmintrin.h:13: /Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:33:5: error: use of undeclared identifier 'builtin_ia32_emms'; did you mean 'builtin_isless'? builtin_ia32_emms(); ^ /Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:33:5: note: 'builtin_isless' declared here /Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:33:25: error: too few arguments to function call, expected 2, have 0 __builtin_ia32_emms();


/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:50:19: error: use of undeclared identifier '__builtin_ia32_vec_init_v2si'
    return (__m64)__builtin_ia32_vec_init_v2si(__i, 0);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:67:12: error: use of undeclared identifier '__builtin_ia32_vec_ext_v2si'
    return __builtin_ia32_vec_ext_v2si((__v2si)__m, 0);
           ^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:129:19: error: use of undeclared identifier '__builtin_ia32_packsswb'
    return (__m64)__builtin_ia32_packsswb((__v4hi)__m1, (__v4hi)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:159:19: error: use of undeclared identifier '__builtin_ia32_packssdw'
    return (__m64)__builtin_ia32_packssdw((__v2si)__m1, (__v2si)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:189:19: error: use of undeclared identifier '__builtin_ia32_packuswb'
    return (__m64)__builtin_ia32_packuswb((__v4hi)__m1, (__v4hi)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:216:19: error: use of undeclared identifier '__builtin_ia32_punpckhbw'
    return (__m64)__builtin_ia32_punpckhbw((__v8qi)__m1, (__v8qi)__m2);
                  ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [default] Error 1
dem10 commented 2 years ago

ARM processors are not supported in this version of the tool.

albertobsd commented 1 year ago

Try now compile the legacy version

make legacy

vladkens commented 3 months ago

Also ran into problems running on macOS, so I made an alternative version (also in pure C): https://github.com/vladkens/ecloop