# Bitflash Windows build — ImGui + GLFW + OpenGL3 # Run from MSYS2 UCRT64: make -f makefile.mingw CXX = g++ DEPS = ../deps RANDOMX = ../RandomX IMGUI_DIR = imgui # See the long note in Makefile: -w hid the format bug that segfaulted the node # on glibc (issue #5), and -w cannot be narrowed, so format diagnostics are now # fatal and only the categories this tree actually produces are silenced. WARNFLAGS = -Wformat -Werror=format \ -Wno-deprecated-declarations -Wno-write-strings \ -Wno-narrowing -Wno-unused-result CXXFLAGS = -std=gnu++14 -O2 $(WARNFLAGS) -fpermissive -pthread \ -DWIN32 -DNOPCH \ -DSECP256K1_STATIC -DBITFLASH_NODE_BUILD \ -I$(DEPS)/include -I$(RANDOMX)/src \ -I$(DEPS)/include/nlohmann \ -IC:/msys64/ucrt64/include \ -I$(IMGUI_DIR) LIBS = -L$(DEPS)/lib -lsecp256k1 \ -L$(RANDOMX)/build -lrandomx \ -lsodium -lssl -lcrypto -ldb_cxx -lsqlite3 -lpthread \ -LC:/msys64/ucrt64/lib \ -lglfw3 -lopengl32 -lgdi32 \ -lkernel32 -luser32 -lcomdlg32 -lwinspool -lwinmm \ -lshell32 -lcomctl32 -lole32 -loleaut32 -luuid \ -lrpcrt4 -ladvapi32 -lws2_32 -lmswsock -lcrypt32 IMGUI_OBJS = obj/imgui.o obj/imgui_draw.o obj/imgui_tables.o \ obj/imgui_widgets.o obj/imgui_impl_glfw.o obj/imgui_impl_opengl3.o NODE_OBJS = obj/util.o obj/script.o obj/db.o obj/net.o obj/main.o \ obj/sha.o obj/nostr.o obj/randomx_pow.o \ obj/btfaddr.o obj/btfchan.o obj/btfrv.o obj/btftunnel.o obj/rpc.o \ obj/selftest.o obj/bip32.o obj/walletcmd.o obj/wallet_sqlite.o \ obj/proxy.o obj/tor.o GUI_OBJS = obj/gui.o obj/main_gui.o obj/bitflash_res.o # Every header a .cpp here includes has to be listed, not just the interesting # ones. sockcount.h was missing, and it declares a struct that lives in a # function-local static shared across translation units: editing it rebuilt # some objects and not others, and the linker said so in a warning easy to walk # past -- "duplicate section ... has different size". That is one object # indexing a struct by the old layout and another by the new one, in the same # binary. Nothing crashed here, and nothing would say so if it had. HEADERS = headers_core.h headers.h util.h main.h serialize.h uint256.h \ key.h bignum.h script.h db.h base58.h net.h nostr.h \ randomx_pow.h btfaddr.h btfchan.h btfrv.h btftunnel.h \ selftest.h walletcmd.h wallet_sqlite.h sockcount.h proxy.h tor.h compat.h font_roboto.h all: bitflash.exe obj/bitflash_res.o: bitflash.rc rc/bitcoin.ico mkdir -p obj windres -o $@ -i bitflash.rc obj/%.o: %.cpp $(HEADERS) mkdir -p obj $(CXX) -c $(CXXFLAGS) -o $@ $< obj/sha.o: sha.cpp sha.h mkdir -p obj $(CXX) -c $(CXXFLAGS) -O3 -o $@ $< obj/imgui.o: $(IMGUI_DIR)/imgui.cpp mkdir -p obj $(CXX) -c $(CXXFLAGS) -o $@ $< obj/imgui_draw.o: $(IMGUI_DIR)/imgui_draw.cpp mkdir -p obj $(CXX) -c $(CXXFLAGS) -o $@ $< obj/imgui_tables.o: $(IMGUI_DIR)/imgui_tables.cpp mkdir -p obj $(CXX) -c $(CXXFLAGS) -o $@ $< obj/imgui_widgets.o: $(IMGUI_DIR)/imgui_widgets.cpp mkdir -p obj $(CXX) -c $(CXXFLAGS) -o $@ $< obj/imgui_impl_glfw.o: $(IMGUI_DIR)/imgui_impl_glfw.cpp mkdir -p obj $(CXX) -c $(CXXFLAGS) -o $@ $< obj/imgui_impl_opengl3.o: $(IMGUI_DIR)/imgui_impl_opengl3.cpp mkdir -p obj $(CXX) -c $(CXXFLAGS) -o $@ $< bitflash.exe: $(IMGUI_OBJS) $(NODE_OBJS) $(GUI_OBJS) $(CXX) $(CXXFLAGS) -mwindows -o $@ $^ $(LIBS) @echo "Built: bitflash.exe" clean: rm -rf obj bitflash.exe test_bip32.exe test_bip32.exe: test_bip32.cpp bip32.cpp bip32.h bip39_english.h $(CXX) $(CXXFLAGS) -o $@ test_bip32.cpp bip32.cpp -lssl -lcrypto -lcrypt32 @echo "Built: test_bip32.exe" tests: test_bip32.exe bitflash.exe ./test_bip32.exe ./bitflash.exe -selftest=wallet-keypool ./bitflash.exe -selftest=wallet-hd ./bitflash.exe -selftest=wallet-format ./bitflash.exe -selftest=wallet-sqlite ./bitflash.exe -selftest=wallet-sqlite-migration ./bitflash.exe -selftest=wallet-crypto ./bitflash.exe -selftest=wallet-encrypt ./bitflash.exe -selftest=wallet-sqlite-encrypt ./bitflash.exe -selftest=wallet-backend-default ./bitflash.exe -selftest=wallet-convert ./bitflash.exe -selftest=net-message ./bitflash.exe -selftest=network-params ./bitflash.exe -selftest=consensus-limits ./bitflash.exe -selftest=pool-stratum ./bitflash.exe -selftest=socks5-proxy ./bitflash.exe -selftest=managed-tor