-
Notifications
You must be signed in to change notification settings - Fork 622
🏗️ Refactor Windows compatibility #423
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
base: main
Are you sure you want to change the base?
Changes from all commits
3db8e4f
85e25f9
9bd92bc
e205bf5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -61,3 +61,4 @@ modules.order | |
| Module.symvers | ||
| Mkfile.old | ||
| dkms.conf | ||
| .specstory/ | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,6 +7,9 @@ default: | |
| g++ -m64 -march=native -mtune=native -mssse3 -Wall -Wextra -Wno-deprecated-copy -Ofast -ftree-vectorize -c sha3/keccak.c -o keccak.o | ||
| gcc -m64 -march=native -mtune=native -mssse3 -Wall -Wextra -Ofast -ftree-vectorize -c xxhash/xxhash.c -o xxhash.o | ||
| g++ -m64 -march=native -mtune=native -mssse3 -Wall -Wextra -Wno-deprecated-copy -Ofast -ftree-vectorize -c util.c -o util.o | ||
| gcc -m64 -march=native -mtune=native -mssse3 -Wall -Wextra -Ofast -ftree-vectorize -c os_random.c -o os_random.o | ||
| gcc -m64 -march=native -mtune=native -mssse3 -Wall -Wextra -Ofast -ftree-vectorize -c win_compat.c -o win_compat.o | ||
| gcc -m64 -march=native -mtune=native -mssse3 -Wall -Wextra -Ofast -ftree-vectorize -c win_thread_compat.c -o win_thread_compat.o | ||
| g++ -m64 -march=native -mtune=native -mssse3 -Wall -Wextra -Wno-deprecated-copy -Ofast -ftree-vectorize -c secp256k1/Int.cpp -o Int.o | ||
| g++ -m64 -march=native -mtune=native -mssse3 -Wall -Wextra -Wno-deprecated-copy -Ofast -ftree-vectorize -c secp256k1/Point.cpp -o Point.o | ||
| g++ -m64 -march=native -mtune=native -mssse3 -Wall -Wextra -Wno-deprecated-copy -Ofast -ftree-vectorize -c secp256k1/SECP256K1.cpp -o SECP256K1.o | ||
|
|
@@ -36,9 +39,36 @@ legacy: | |
| g++ -march=native -mtune=native -Wall -Wextra -Ofast -ftree-vectorize -c gmp256k1/IntMod.cpp -o IntMod.o | ||
| g++ -march=native -mtune=native -Wall -Wextra -Ofast -ftree-vectorize -flto -c gmp256k1/Random.cpp -o Random.o | ||
| g++ -march=native -mtune=native -Wall -Wextra -Ofast -ftree-vectorize -flto -c gmp256k1/IntGroup.cpp -o IntGroup.o | ||
| g++ -march=native -mtune=native -Wall -Wextra -Ofast -ftree-vectorize -o keyhunt keyhunt_legacy.cpp base58.o bloom.o oldbloom.o xxhash.o util.o Int.o Point.o GMP256K1.o IntMod.o IntGroup.o Random.o hashing.o sha3.o keccak.o -lm -lpthread -lcrypto -lgmp | ||
| gcc -march=native -mtune=native -Wall -Wextra -Ofast -ftree-vectorize -c os_random.c -o os_random.o | ||
| gcc -march=native -mtune=native -Wall -Wextra -Ofast -ftree-vectorize -c win_compat.c -o win_compat.o | ||
| gcc -march=native -mtune=native -Wall -Wextra -Ofast -ftree-vectorize -c win_thread_compat.c -o win_thread_compat.o | ||
| g++ -march=native -mtune=native -Wall -Wextra -Ofast -ftree-vectorize -o keyhunt keyhunt_legacy.cpp base58.o bloom.o oldbloom.o xxhash.o util.o os_random.o win_compat.o win_thread_compat.o Int.o Point.o GMP256K1.o IntMod.o IntGroup.o Random.o hashing.o sha3.o keccak.o -lm -lpthread -lcrypto -lgmp | ||
| rm -r *.o | ||
| bsgsd: | ||
|
|
||
| CC ?= gcc | ||
| CXX ?= g++ | ||
| AR ?= ar | ||
| CFLAGS ?= -Wall -Wextra | ||
| CXXFLAGS ?= -Wall -Wextra -Wno-deprecated-copy | ||
| LDFLAGS ?= -lm | ||
|
|
||
| # MinGW detection | ||
| MACHINE := $(shell $(CXX) -dumpmachine 2>/dev/null) | ||
| ifneq (,$(findstring mingw,$(MACHINE))) | ||
| IS_MINGW := 1 | ||
| endif | ||
|
|
||
| # MinGW-specific flags (used by target `mingw`) | ||
| CFLAGS_MINGW := -m64 -march=x86-64 -mssse3 -Wall -Wextra -Wno-unused-parameter -Ofast -ftree-vectorize | ||
| CXXFLAGS_MINGW := -m64 -march=x86-64 -mssse3 -Wall -Wextra -Wno-deprecated-copy -Ofast -ftree-vectorize | ||
| # Link libgcc and libstdc++ statically so exe doesn't require libgcc_s_seh-1.dll or libstdc++-6.dll | ||
| # Link libgcc and libstdc++ statically and link winpthread statically to avoid libwinpthread-1.dll | ||
| # Use -Wl,-Bstatic/-Bdynamic around -lwinpthread so other system libs remain dynamic | ||
| LDFLAGS_MINGW := -static-libgcc -static-libstdc++ -Wl,-Bstatic -lwinpthread -Wl,-Bdynamic -lm -lws2_32 -lbcrypt | ||
| # Do not request pthread linkage for MinGW build (avoid libwinpthread dependency) | ||
| THREAD_FLAGS_MINGW := | ||
|
|
||
| default: | ||
| g++ -m64 -march=native -mtune=native -mssse3 -Wall -Wextra -Wno-deprecated-copy -Ofast -ftree-vectorize -flto -c oldbloom/bloom.cpp -o oldbloom.o | ||
| g++ -m64 -march=native -mtune=native -mssse3 -Wall -Wextra -Wno-deprecated-copy -Ofast -ftree-vectorize -flto -c bloom/bloom.cpp -o bloom.o | ||
| gcc -m64 -march=native -mtune=native -mssse3 -Wall -Wextra -Wno-unused-parameter -Ofast -ftree-vectorize -c base58/base58.c -o base58.o | ||
|
|
@@ -57,5 +87,31 @@ bsgsd: | |
| g++ -m64 -march=native -mtune=native -mssse3 -Wall -Wextra -Wno-deprecated-copy -Ofast -o hash/sha256.o -ftree-vectorize -flto -c hash/sha256.cpp | ||
| g++ -m64 -march=native -mtune=native -mssse3 -Wall -Wextra -Wno-deprecated-copy -Ofast -o hash/ripemd160_sse.o -ftree-vectorize -flto -c hash/ripemd160_sse.cpp | ||
| g++ -m64 -march=native -mtune=native -mssse3 -Wall -Wextra -Wno-deprecated-copy -Ofast -o hash/sha256_sse.o -ftree-vectorize -flto -c hash/sha256_sse.cpp | ||
| g++ -m64 -march=native -mtune=native -mssse3 -Wall -Wextra -Wno-deprecated-copy -Ofast -ftree-vectorize -o bsgsd bsgsd.cpp base58.o rmd160.o hash/ripemd160.o hash/ripemd160_sse.o hash/sha256.o hash/sha256_sse.o bloom.o oldbloom.o xxhash.o util.o Int.o Point.o SECP256K1.o IntMod.o Random.o IntGroup.o sha3.o keccak.o -lm -lpthread | ||
| g++ -m64 -march=native -mtune=native -mssse3 -Wall -Wextra -Wno-deprecated-copy -Ofast -o keyhunt keyhunt.cpp base58.o rmd160.o hash/ripemd160.o hash/ripemd160_sse.o hash/sha256.o hash/sha256_sse.o bloom.o oldbloom.o xxhash.o util.o os_random.o win_compat.o win_thread_compat.o Int.o Point.o SECP256K1.o IntMod.o Random.o IntGroup.o sha3.o keccak.o -lm -lpthread | ||
| rm -r *.o | ||
|
|
||
| # Target for building with MinGW (MSYS2 mingw64) | ||
| .PHONY: mingw | ||
| mingw: | ||
| $(CXX) $(CXXFLAGS_MINGW) -c oldbloom/bloom.cpp -o oldbloom.o | ||
| $(CXX) $(CXXFLAGS_MINGW) -c bloom/bloom.cpp -o bloom.o | ||
| $(CC) $(CFLAGS_MINGW) -c base58/base58.c -o base58.o | ||
| $(CC) $(CFLAGS_MINGW) -c rmd160/rmd160.c -o rmd160.o | ||
| $(CXX) $(CXXFLAGS_MINGW) -c sha3/sha3.c -o sha3.o | ||
| $(CXX) $(CXXFLAGS_MINGW) -c sha3/keccak.c -o keccak.o | ||
| $(CC) $(CFLAGS_MINGW) -c xxhash/xxhash.c -o xxhash.o | ||
| $(CXX) $(CXXFLAGS_MINGW) -c util.c -o util.o | ||
| $(CC) $(CFLAGS_MINGW) -c os_random.c -o os_random.o | ||
| $(CC) $(CFLAGS_MINGW) -c win_compat.c -o win_compat.o | ||
|
||
| $(CXX) $(CXXFLAGS_MINGW) -c secp256k1/Int.cpp -o Int.o | ||
| $(CXX) $(CXXFLAGS_MINGW) -c secp256k1/Point.cpp -o Point.o | ||
| $(CXX) $(CXXFLAGS_MINGW) -c secp256k1/SECP256K1.cpp -o SECP256K1.o | ||
| $(CXX) $(CXXFLAGS_MINGW) -c secp256k1/IntMod.cpp -o IntMod.o | ||
| $(CXX) $(CXXFLAGS_MINGW) -c secp256k1/Random.cpp -o Random.o | ||
| $(CXX) $(CXXFLAGS_MINGW) -c secp256k1/IntGroup.cpp -o IntGroup.o | ||
| $(CXX) $(CXXFLAGS_MINGW) -o hash/ripemd160.o -c hash/ripemd160.cpp | ||
| $(CXX) $(CXXFLAGS_MINGW) -o hash/sha256.o -c hash/sha256.cpp | ||
| $(CXX) $(CXXFLAGS_MINGW) -o hash/ripemd160_sse.o -c hash/ripemd160_sse.cpp | ||
| $(CXX) $(CXXFLAGS_MINGW) -o hash/sha256_sse.o -c hash/sha256_sse.cpp | ||
| $(CXX) $(CXXFLAGS_MINGW) -o keyhunt keyhunt.cpp base58.o rmd160.o hash/ripemd160.o hash/ripemd160_sse.o hash/sha256.o hash/sha256_sse.o bloom.o oldbloom.o xxhash.o util.o os_random.o win_compat.o Int.o Point.o SECP256K1.o IntMod.o Random.o IntGroup.o sha3.o keccak.o $(LDFLAGS_MINGW) $(THREAD_FLAGS_MINGW) | ||
| rm -r *.o | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -29,12 +29,18 @@ email: albertobsd@gmail.com | |||||
|
|
||||||
| #include <unistd.h> | ||||||
| #include <pthread.h> | ||||||
| #if !defined(__MINGW32__) && !defined(__MINGW64__) | ||||||
| #include <sys/random.h> | ||||||
| #include <linux/random.h> | ||||||
|
|
||||||
| #include <sys/socket.h> | ||||||
| #include <netinet/in.h> | ||||||
| #include <arpa/inet.h> // for inet_addr() | ||||||
| #else | ||||||
| #include <winsock2.h> | ||||||
| #include <ws2tcpip.h> | ||||||
| #endif | ||||||
| #include "win_compat.h" | ||||||
| #include "os_random.h" | ||||||
| #include <pthread.h> // for pthread functions | ||||||
|
|
||||||
| #define PORT 8080 | ||||||
|
|
@@ -66,7 +72,7 @@ struct tothread { | |||||
| struct bPload { | ||||||
| uint32_t threadid; | ||||||
| uint64_t from; | ||||||
| uint64_t to; | ||||||
| int osr = os_getrandom(&rseedvalue, sizeof(unsigned long)); | ||||||
|
||||||
| int osr = os_getrandom(&rseedvalue, sizeof(unsigned long)); | |
| int osr; |
Copilot
AI
Dec 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unreachable code: line 348 calls exit(0) but line 349 has rseed(clock() + time(NULL)) after it. This line will never execute because the program exits on line 348. This appears to be leftover code that should have been removed.
| rseed(clock() + time(NULL)); |
Copilot
AI
Dec 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function declaration formatting issue: the function signature is split across multiple lines with inconsistent placement. The opening brace placement and parameter alignment don't match standard formatting conventions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplicate target definition: the
defaulttarget is defined at line 1 and again here at line 67. Make will only execute the last definition, which means the first definition will be ignored. This appears to be an error in the diff application - the seconddefault:should likely bebsgsd:based on the context.