From 6727ec9fc261ace247a12ddf523b74a5834e8eb9 Mon Sep 17 00:00:00 2001 From: DarshanBPatel Date: Mon, 20 Jan 2025 15:23:35 +0530 Subject: [PATCH 01/13] feat: everuthing in one comments --- Makefile | 6 ++++-- config.nims | 6 ++++++ scripts/windows_setup.sh | 27 +++++++++++++++++++-------- 3 files changed, 29 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index 99ceadbb17..7c81c423d6 100644 --- a/Makefile +++ b/Makefile @@ -40,9 +40,11 @@ ifeq ($(detected_OS),Windows) export TMP := $(TMP_DIR) export TEMP := $(TMP_DIR) - # Add the necessary libraries to the linker flags - LIBS = -static -lws2_32 -lbcrypt -luserenv -lntdll -lminiupnpc + MINGW_PATH = /c/msys64/mingw64 + NIM_PARAMS += --passL:"-L$(MINGW_PATH)/lib" + LIBS = -static -lws2_32 -lbcrypt -luserenv -lntdll -lminiupnpc -lnatpmp -lpq NIM_PARAMS += $(foreach lib,$(LIBS),--passL:"$(lib)") + NIM_PARAMS += --passC:"-I$(MINGW_PATH)/include" endif ########## diff --git a/config.nims b/config.nims index 25066dcb26..07c26dc62b 100644 --- a/config.nims +++ b/config.nims @@ -7,6 +7,8 @@ else: if defined(windows): switch("passL", "rln.lib") + switch("define", "postgres=false") + # Exclude postgres-related files from compilation # Automatically add all vendor subdirectories for dir in walkDir("./vendor"): @@ -14,6 +16,10 @@ if defined(windows): switch("path", dir.path) switch("path", dir.path / "src") + switch("path", "./vendor/nim-nat-traversal") + switch("path", "./vendor/nim-nat-traversal/vendor/libnatpmp-upstream") + switch("path", "./vendor/nim-nat-traversal/vendor/miniupnp/miniupnpc") + # disable timestamps in Windows PE headers - https://wiki.debian.org/ReproducibleBuilds/TimestampsInPEBinaries switch("passL", "-Wl,--no-insert-timestamp") # increase stack size diff --git a/scripts/windows_setup.sh b/scripts/windows_setup.sh index 02b9bdc4c4..0bec445736 100644 --- a/scripts/windows_setup.sh +++ b/scripts/windows_setup.sh @@ -32,7 +32,7 @@ build_component() { local dir="$1" local command="$2" local name="$3" - + echo "Building $name" if [ -d "$dir" ]; then change_directory "$dir" @@ -53,16 +53,27 @@ execute_command "mkdir -p tmp" echo "3. Building Nim" build_component "vendor/nimbus-build-system/vendor/Nim" "./build_all.bat" "Nim" -echo "4. Building miniupnpc" +echo "4. changing branch" +cd "vendor/nim-nat-traversal/vendor/miniupnp" +git checkout little_chore_windows_support +cd ../../../.. + +echo "5. Building miniupnpc" build_component "vendor/nim-nat-traversal/vendor/miniupnp/miniupnpc" "./mingw32make.bat" "miniupnpc" -echo "5. Building libnatpmp" -build_component "vendor/nim-nat-traversal/vendor/libnatpmp-upstream" "./build.bat" "libnatpmp" +echo "6. Building libnatpmp" +cd ./vendor/nim-nat-traversal/vendor/libnatpmp-upstream +./build.bat +mv natpmp.a libnatpmp.a +cd ../../../../ -echo "6. Building libunwind" -build_component "vendor/nim-libbacktrace" "make install/usr/lib/libunwind.a" "libunwind" +echo "7. Building libunwind" +cd vendor/nim-libbacktrace +make all +make install/usr/lib/libunwind.a +cd ../../ -echo "7. Building wakunode2" -execute_command "make wakunode2 V=1 NIMFLAGS="-d:disableMarchNative -d:postgres -d:chronicles_colors:none" " +echo "8. Building wakunode2" +make wakunode2 V=1 echo "Windows setup completed successfully!" From b3aa22897561442678f1e88493edecfaaf69ea27 Mon Sep 17 00:00:00 2001 From: darshankabariya Date: Tue, 28 Jan 2025 12:01:23 +0530 Subject: [PATCH 02/13] chore: remove command use --- scripts/windows_setup.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/windows_setup.sh b/scripts/windows_setup.sh index 0bec445736..0679a1986e 100644 --- a/scripts/windows_setup.sh +++ b/scripts/windows_setup.sh @@ -51,7 +51,9 @@ echo "2. Creating tmp directory" execute_command "mkdir -p tmp" echo "3. Building Nim" -build_component "vendor/nimbus-build-system/vendor/Nim" "./build_all.bat" "Nim" +cd vendor/nimbus-build-system/vendor/Nim +./build_all.bat +cd ../../../../.. echo "4. changing branch" cd "vendor/nim-nat-traversal/vendor/miniupnp" @@ -59,7 +61,9 @@ git checkout little_chore_windows_support cd ../../../.. echo "5. Building miniupnpc" -build_component "vendor/nim-nat-traversal/vendor/miniupnp/miniupnpc" "./mingw32make.bat" "miniupnpc" +cd vendor/nim-nat-traversal/vendor/miniupnp/miniupnpc +./mingw32make.bat +cd ../../../../.. echo "6. Building libnatpmp" cd ./vendor/nim-nat-traversal/vendor/libnatpmp-upstream From 3f04ad84974c8fd898b103687ed0ee72c51bed6f Mon Sep 17 00:00:00 2001 From: darshankabariya Date: Tue, 28 Jan 2025 14:08:04 +0530 Subject: [PATCH 03/13] chore: remove command use --- scripts/windows_setup.sh | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/scripts/windows_setup.sh b/scripts/windows_setup.sh index 0679a1986e..a28f592d34 100644 --- a/scripts/windows_setup.sh +++ b/scripts/windows_setup.sh @@ -53,17 +53,17 @@ execute_command "mkdir -p tmp" echo "3. Building Nim" cd vendor/nimbus-build-system/vendor/Nim ./build_all.bat -cd ../../../../.. - -echo "4. changing branch" -cd "vendor/nim-nat-traversal/vendor/miniupnp" -git checkout little_chore_windows_support cd ../../../.. -echo "5. Building miniupnpc" -cd vendor/nim-nat-traversal/vendor/miniupnp/miniupnpc -./mingw32make.bat -cd ../../../../.. +# echo "4. changing branch" +# cd "vendor/nim-nat-traversal/vendor/miniupnp" +# git checkout little_chore_windows_support +# cd ../../../.. + +# echo "5. Building miniupnpc" +# cd vendor/nim-nat-traversal/vendor/miniupnp/miniupnpc +# ./mingw32make.bat +# cd ../../../../.. echo "6. Building libnatpmp" cd ./vendor/nim-nat-traversal/vendor/libnatpmp-upstream @@ -78,6 +78,6 @@ make install/usr/lib/libunwind.a cd ../../ echo "8. Building wakunode2" -make wakunode2 V=1 +make wakunode2 LOG_LEVEL=DEBUG echo "Windows setup completed successfully!" From 398f00879f6bdee2ca719c32cd9b48b0607988c0 Mon Sep 17 00:00:00 2001 From: darshankabariya Date: Tue, 28 Jan 2025 17:34:06 +0530 Subject: [PATCH 04/13] chore: remove command use --- scripts/windows_setup.sh | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/scripts/windows_setup.sh b/scripts/windows_setup.sh index a28f592d34..3975ecbbd8 100644 --- a/scripts/windows_setup.sh +++ b/scripts/windows_setup.sh @@ -55,15 +55,10 @@ cd vendor/nimbus-build-system/vendor/Nim ./build_all.bat cd ../../../.. -# echo "4. changing branch" -# cd "vendor/nim-nat-traversal/vendor/miniupnp" -# git checkout little_chore_windows_support -# cd ../../../.. - -# echo "5. Building miniupnpc" -# cd vendor/nim-nat-traversal/vendor/miniupnp/miniupnpc +echo "5. Building miniupnpc" +cd vendor/nim-nat-traversal/vendor/miniupnp/miniupnpc # ./mingw32make.bat -# cd ../../../../.. +cd ../../../../.. echo "6. Building libnatpmp" cd ./vendor/nim-nat-traversal/vendor/libnatpmp-upstream From 266cecfd79cab335ee3dc7843ea6f281b9db7a9a Mon Sep 17 00:00:00 2001 From: darshankabariya Date: Tue, 28 Jan 2025 17:39:43 +0530 Subject: [PATCH 05/13] chore: remove command use --- scripts/windows_setup.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/windows_setup.sh b/scripts/windows_setup.sh index 3975ecbbd8..6ef532134f 100644 --- a/scripts/windows_setup.sh +++ b/scripts/windows_setup.sh @@ -57,6 +57,7 @@ cd ../../../.. echo "5. Building miniupnpc" cd vendor/nim-nat-traversal/vendor/miniupnp/miniupnpc +git checkout little_chore_windows_support # ./mingw32make.bat cd ../../../../.. From 7790450c56e4fef86768dfe6cda6215cf860fcbe Mon Sep 17 00:00:00 2001 From: DarshanBPatel Date: Sun, 16 Feb 2025 22:42:38 +0530 Subject: [PATCH 06/13] chore: msys2 to mingw migration --- Makefile | 11 +++-------- config.nims | 19 ++++++++++++++++++- scripts/build_rln.sh | 9 ++++++--- scripts/windows_setup.sh | 2 +- waku/common/databases/db_postgres/dbconn.nim | 12 ++++++------ 5 files changed, 34 insertions(+), 19 deletions(-) diff --git a/Makefile b/Makefile index 7c81c423d6..3bccf074b9 100644 --- a/Makefile +++ b/Makefile @@ -34,15 +34,10 @@ ifneq (,$(findstring MINGW,$(detected_OS))) endif ifeq ($(detected_OS),Windows) - # Define a new temporary directory for Windows - TMP_DIR := $(CURDIR)/tmp - $(shell mkdir -p $(TMP_DIR)) - export TMP := $(TMP_DIR) - export TEMP := $(TMP_DIR) - - MINGW_PATH = /c/msys64/mingw64 + # Update MINGW_PATH to standard MinGW location + MINGW_PATH = /mingw64 NIM_PARAMS += --passL:"-L$(MINGW_PATH)/lib" - LIBS = -static -lws2_32 -lbcrypt -luserenv -lntdll -lminiupnpc -lnatpmp -lpq + LIBS = -static -lws2_32 -lbcrypt -liphlpapi -luserenv -lntdll -lminiupnpc -lnatpmp -lpq NIM_PARAMS += $(foreach lib,$(LIBS),--passL:"$(lib)") NIM_PARAMS += --passC:"-I$(MINGW_PATH)/include" endif diff --git a/config.nims b/config.nims index 07c26dc62b..dcb5fc7036 100644 --- a/config.nims +++ b/config.nims @@ -8,7 +8,24 @@ else: if defined(windows): switch("passL", "rln.lib") switch("define", "postgres=false") - # Exclude postgres-related files from compilation + + # MinGW library paths + switch("passL", "-L/mingw64/lib") + switch("passC", "-I/mingw64/include") + + # Standard MinGW linking + switch("passL", "-static -lws2_32 -lbcrypt -luserenv -lntdll") + + # NAT traversal libraries + switch("passL", "-lminiupnpc -Lvendor/nim-nat-traversal/vendor/miniupnp/miniupnpc") + switch("passL", "-lnatpmp -Lvendor/nim-nat-traversal/vendor/libnatpmp-upstream") + + # Disable timestamp in PE headers + switch("passL", "-Wl,--no-insert-timestamp") + switch("passL", "-Wl,--stack,8388608") + + # Chronicles configuration + switch("define", "chronicles_colors=off") # Automatically add all vendor subdirectories for dir in walkDir("./vendor"): diff --git a/scripts/build_rln.sh b/scripts/build_rln.sh index 992c1f4347..01f258f849 100755 --- a/scripts/build_rln.sh +++ b/scripts/build_rln.sh @@ -43,12 +43,15 @@ else # first, check if submodule version = version in Makefile cargo metadata --format-version=1 --no-deps --manifest-path "${build_dir}/rln/Cargo.toml" - if [[ "$OSTYPE" == "msys" || "$OSTYPE" == "win32" ]]; then + detected_OS=$(uname -s) + if [[ "$detected_OS" == MINGW* || "$detected_OS" == MSYS* ]]; then + # Use sed for version extraction in Windows/Git Bash environment submodule_version=$(cargo metadata --format-version=1 --no-deps --manifest-path "${build_dir}/rln/Cargo.toml" | sed -n 's/.*"name":"rln","version":"\([^"]*\)".*/\1/p') else - submodule_version=$(cargo metadata --format-version=1 --no-deps --manifest-path "${build_dir}/rln/Cargo.toml" | jq -r '.packages[] | select(.name == "rln") | .version') + # Use sed instead of jq for cross-platform compatibility + submodule_version=$(cargo metadata --format-version=1 --no-deps --manifest-path "${build_dir}/rln/Cargo.toml" | sed -n 's/.*"name":"rln","version":"\([^"]*\)".*/\1/p') fi - + if [[ "v${submodule_version}" != "${rln_version}" ]]; then echo "Submodule version (v${submodule_version}) does not match version in Makefile (${rln_version})" echo "Please update the submodule to ${rln_version}" diff --git a/scripts/windows_setup.sh b/scripts/windows_setup.sh index 6ef532134f..9edab29be0 100644 --- a/scripts/windows_setup.sh +++ b/scripts/windows_setup.sh @@ -58,7 +58,7 @@ cd ../../../.. echo "5. Building miniupnpc" cd vendor/nim-nat-traversal/vendor/miniupnp/miniupnpc git checkout little_chore_windows_support -# ./mingw32make.bat +mingw32-make -f Makefile.mingw CC=gcc CXX=g++ cd ../../../../.. echo "6. Building libnatpmp" diff --git a/waku/common/databases/db_postgres/dbconn.nim b/waku/common/databases/db_postgres/dbconn.nim index 287ed4e8da..487a1d84ee 100644 --- a/waku/common/databases/db_postgres/dbconn.nim +++ b/waku/common/databases/db_postgres/dbconn.nim @@ -182,12 +182,12 @@ proc waitQueryToFinish( let asyncFd = cast[asyncengine.AsyncFD](pqsocket(dbConnWrapper.dbConn)) - asyncengine.addReader2(asyncFd, onDataAvailable).isOkOr: - dbConnWrapper.futBecomeFree.fail(newException(ValueError, $error)) - return err("failed to add event reader in waitQueryToFinish: " & $error) - defer: - asyncengine.removeReader2(asyncFd).isOkOr: - return err("failed to remove event reader in waitQueryToFinish: " & $error) + ## asyncengine.addReader2(asyncFd, onDataAvailable).isOkOr: + ## dbConnWrapper.futBecomeFree.fail(newException(ValueError, $error)) + ## return err("failed to add event reader in waitQueryToFinish: " & $error) + ## defer: + ## asyncengine.removeReader2(asyncFd).isOkOr: + ## return err("failed to remove event reader in waitQueryToFinish: " & $error) await futDataAvailable From 96caa51a1c46a767285dc5d1d8409f9e350337b3 Mon Sep 17 00:00:00 2001 From: DarshanBPatel Date: Mon, 17 Feb 2025 01:44:38 +0530 Subject: [PATCH 07/13] chore: on chronological order --- scripts/windows_setup.sh | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/scripts/windows_setup.sh b/scripts/windows_setup.sh index 9edab29be0..6008781ea9 100644 --- a/scripts/windows_setup.sh +++ b/scripts/windows_setup.sh @@ -55,10 +55,30 @@ cd vendor/nimbus-build-system/vendor/Nim ./build_all.bat cd ../../../.. +echo "4. Building libunwind" +cd vendor/nim-libbacktrace +make all V=1 +make install/usr/lib/libunwind.a V=1 +cd ../../ + echo "5. Building miniupnpc" cd vendor/nim-nat-traversal/vendor/miniupnp/miniupnpc git checkout little_chore_windows_support -mingw32-make -f Makefile.mingw CC=gcc CXX=g++ + +timeout 5m mingw32-make -f Makefile.mingw CC=gcc CXX=g++ V=1 & + +# Capture the process ID +MAKE_PID=$! + +# Wait and check exit status +wait $MAKE_PID +MAKE_EXIT=$? + +if [ $MAKE_EXIT -eq 124 ]; then + echo "Build timed out after 5 minutes. Continuing..." + # Add cleanup if needed (e.g., kill child processes) +fi + cd ../../../../.. echo "6. Building libnatpmp" @@ -67,11 +87,6 @@ cd ./vendor/nim-nat-traversal/vendor/libnatpmp-upstream mv natpmp.a libnatpmp.a cd ../../../../ -echo "7. Building libunwind" -cd vendor/nim-libbacktrace -make all -make install/usr/lib/libunwind.a -cd ../../ echo "8. Building wakunode2" make wakunode2 LOG_LEVEL=DEBUG From d0d5d0990dc2950a903cf06f7fe5b3c34055c954 Mon Sep 17 00:00:00 2001 From: DarshanBPatel Date: Mon, 17 Feb 2025 13:34:40 +0530 Subject: [PATCH 08/13] chore: windows and unix command seperation --- scripts/build_rln.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/scripts/build_rln.sh b/scripts/build_rln.sh index 01f258f849..1cf9b98790 100755 --- a/scripts/build_rln.sh +++ b/scripts/build_rln.sh @@ -45,11 +45,9 @@ else detected_OS=$(uname -s) if [[ "$detected_OS" == MINGW* || "$detected_OS" == MSYS* ]]; then - # Use sed for version extraction in Windows/Git Bash environment submodule_version=$(cargo metadata --format-version=1 --no-deps --manifest-path "${build_dir}/rln/Cargo.toml" | sed -n 's/.*"name":"rln","version":"\([^"]*\)".*/\1/p') else - # Use sed instead of jq for cross-platform compatibility - submodule_version=$(cargo metadata --format-version=1 --no-deps --manifest-path "${build_dir}/rln/Cargo.toml" | sed -n 's/.*"name":"rln","version":"\([^"]*\)".*/\1/p') + submodule_version=$(cargo metadata --format-version=1 --no-deps --manifest-path "${build_dir}/rln/Cargo.toml" | jq -r '.packages[] | select(.name == "rln") | .version') fi if [[ "v${submodule_version}" != "${rln_version}" ]]; then From decc2441cb6870bb2f7fc1f1c480444cb0a6fe44 Mon Sep 17 00:00:00 2001 From: DarshanBPatel Date: Mon, 17 Feb 2025 14:02:44 +0530 Subject: [PATCH 09/13] chore: update build_rln --- scripts/build_rln.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/build_rln.sh b/scripts/build_rln.sh index 1cf9b98790..922087064e 100755 --- a/scripts/build_rln.sh +++ b/scripts/build_rln.sh @@ -59,3 +59,10 @@ else cargo build --release -p rln --manifest-path "${build_dir}/rln/Cargo.toml" --features arkzkey cp "${build_dir}/target/release/librln.a" "${output_filename}" fi + +if [[ "${output_filename}" == *".lib"* ]]; then + # We assume is Windows OS + cp "${build_dir}/target/release/rln.lib" "${output_filename}" +else + cp "${build_dir}/target/release/librln.a" "${output_filename}" +fi From c08f780b3eba9a285169803b31069cd4b8a572d3 Mon Sep 17 00:00:00 2001 From: darshankabariya Date: Tue, 18 Feb 2025 12:07:27 +0530 Subject: [PATCH 10/13] chore: update scripts with proper requirements --- scripts/windows_setup.sh | 55 +++++++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 23 deletions(-) diff --git a/scripts/windows_setup.sh b/scripts/windows_setup.sh index 6008781ea9..46836d7260 100644 --- a/scripts/windows_setup.sh +++ b/scripts/windows_setup.sh @@ -1,5 +1,29 @@ #!/bin/bash +# Prerequisites: +# ============= +# 1. Install Git Bash terminal +# Download and install from: https://git-scm.com/download/win +# +# 2. Install MSYS2 +# a. Download the installer from: https://www.msys2.org +# b. Run the installer and follow the installation steps +# +# 3. Open MSYS2 UCRT64 terminal and run the following commands to install requirements: +# pacman -Syu # Update package database and core packages +# pacman -S --needed mingw-w64-ucrt-x86_64-toolchain # Install toolchain +# pacman -S --needed base-devel # Install development tools +# pacman -S --needed make # Install make +# pacman -S --needed cmake # Install cmake +# pacman -S --needed upx # Install upx +# pacman -S --needed mingw-w64-ucrt-x86_64-rust # Install rustc +# +# 4. Setup PATH +# export PATH="/c/msys64/mingw64/bin" # this is a default, need to change accordingly +# export PATH="/mingw64/bin" # this one is mandotory +# +# 5. on git bash terminal run this scripts + set -e # Exit immediately if a command exits with a non-zero status echo "Windows Setup Script" @@ -52,43 +76,28 @@ execute_command "mkdir -p tmp" echo "3. Building Nim" cd vendor/nimbus-build-system/vendor/Nim -./build_all.bat +execute_command "./build_all.bat" cd ../../../.. echo "4. Building libunwind" cd vendor/nim-libbacktrace -make all V=1 -make install/usr/lib/libunwind.a V=1 +execute_command "make all V=1" +execute_command "make install/usr/lib/libunwind.a V=1" cd ../../ echo "5. Building miniupnpc" cd vendor/nim-nat-traversal/vendor/miniupnp/miniupnpc git checkout little_chore_windows_support - -timeout 5m mingw32-make -f Makefile.mingw CC=gcc CXX=g++ V=1 & - -# Capture the process ID -MAKE_PID=$! - -# Wait and check exit status -wait $MAKE_PID -MAKE_EXIT=$? - -if [ $MAKE_EXIT -eq 124 ]; then - echo "Build timed out after 5 minutes. Continuing..." - # Add cleanup if needed (e.g., kill child processes) -fi - +execute_command "make -f Makefile.mingw CC=gcc CXX=g++ V=1" cd ../../../../.. echo "6. Building libnatpmp" cd ./vendor/nim-nat-traversal/vendor/libnatpmp-upstream -./build.bat -mv natpmp.a libnatpmp.a +execute_command "./build.bat" +execute_command "mv natpmp.a libnatpmp.a" cd ../../../../ - -echo "8. Building wakunode2" -make wakunode2 LOG_LEVEL=DEBUG +echo "7. Building wakunode2" +execute_command "make wakunode2 LOG_LEVEL=DEBUG" echo "Windows setup completed successfully!" From c4b0ddce466d1a5728fafa7309e3de074c4d089c Mon Sep 17 00:00:00 2001 From: darshankabariya Date: Tue, 18 Feb 2025 14:56:28 +0530 Subject: [PATCH 11/13] chore: update scripts with proper requirements --- scripts/windows_setup.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/windows_setup.sh b/scripts/windows_setup.sh index 46836d7260..bad5754305 100644 --- a/scripts/windows_setup.sh +++ b/scripts/windows_setup.sh @@ -1,7 +1,5 @@ #!/bin/bash -# Prerequisites: -# ============= # 1. Install Git Bash terminal # Download and install from: https://git-scm.com/download/win # @@ -17,6 +15,12 @@ # pacman -S --needed cmake # Install cmake # pacman -S --needed upx # Install upx # pacman -S --needed mingw-w64-ucrt-x86_64-rust # Install rustc +# pacman -S --needed mingw-w64-ucrt-x86_64-postgresql +# pacman -S --needed mingw-w64-ucrt-x86_64-gcc +# pacman -S --needed mingw-w64-ucrt-x86_64-gcc-libs +# pacman -S --needed mingw-w64-ucrt-x86_64-libwinpthread-git +# pacman -S --needed mingw-w64-ucrt-x86_64-zlib +# pacman -s --needed mingw-w64-ucrt-x86_64-openssl # # 4. Setup PATH # export PATH="/c/msys64/mingw64/bin" # this is a default, need to change accordingly From f764c95d1ed76d5e3eb5dab0e2c710908819fc04 Mon Sep 17 00:00:00 2001 From: darshankabariya Date: Wed, 19 Feb 2025 12:26:23 +0530 Subject: [PATCH 12/13] chore: update scripts with proper requirements --- scripts/windows_setup.sh | 42 ++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/scripts/windows_setup.sh b/scripts/windows_setup.sh index bad5754305..a407bc32ba 100644 --- a/scripts/windows_setup.sh +++ b/scripts/windows_setup.sh @@ -5,26 +5,30 @@ # # 2. Install MSYS2 # a. Download the installer from: https://www.msys2.org -# b. Run the installer and follow the installation steps +# b. Run the installer +# c. inside msys2 directory mutiple terminal you need to use mingw64 terminal all package and library # -# 3. Open MSYS2 UCRT64 terminal and run the following commands to install requirements: -# pacman -Syu # Update package database and core packages -# pacman -S --needed mingw-w64-ucrt-x86_64-toolchain # Install toolchain -# pacman -S --needed base-devel # Install development tools -# pacman -S --needed make # Install make -# pacman -S --needed cmake # Install cmake -# pacman -S --needed upx # Install upx -# pacman -S --needed mingw-w64-ucrt-x86_64-rust # Install rustc -# pacman -S --needed mingw-w64-ucrt-x86_64-postgresql -# pacman -S --needed mingw-w64-ucrt-x86_64-gcc -# pacman -S --needed mingw-w64-ucrt-x86_64-gcc-libs -# pacman -S --needed mingw-w64-ucrt-x86_64-libwinpthread-git -# pacman -S --needed mingw-w64-ucrt-x86_64-zlib -# pacman -s --needed mingw-w64-ucrt-x86_64-openssl +# 3. Open MSYS2 MINGW^$ terminal and run the following commands to install requirements: +# pacman -Syu --noconfirm +# pacman -S --noconfirm --needed mingw-w64-x86_64-toolchain +# pacman -S --noconfirm --needed base-devel +# pacman -S --noconfirm --needed make +# pacman -S --noconfirm --needed cmake +# pacman -S --noconfirm --needed upx +# pacman -S --noconfirm --needed mingw-w64-x86_64-rust +# pacman -S --noconfirm --needed mingw-w64-x86_64-postgresql +# pacman -S --noconfirm --needed mingw-w64-x86_64-gcc +# pacman -S --noconfirm --needed mingw-w64-x86_64-gcc-libs +# pacman -S --noconfirm --needed mingw-w64-x86_64-libwinpthread-git +# pacman -S --noconfirm --needed mingw-w64-x86_64-zlib +# pacman -S --noconfirm --needed mingw-w64-x86_64-openssl # -# 4. Setup PATH -# export PATH="/c/msys64/mingw64/bin" # this is a default, need to change accordingly -# export PATH="/mingw64/bin" # this one is mandotory +# 4. Setup PATH +# MSYS_DIR = xyz +# export PATH="{MSYS_DIR}/msys64/mingw64/bin:$PATH" +# export PATH="{MSYS_DIR}/msys64/mingw64/lib:$PATH" +# export PATH="{MSYS_DIR}/msys64/ucrt64/bin:$PATH" +# export PATH="{MSYS_DIR}/msys64/ucrt64/lib:$PATH" # # 5. on git bash terminal run this scripts @@ -102,6 +106,6 @@ execute_command "mv natpmp.a libnatpmp.a" cd ../../../../ echo "7. Building wakunode2" -execute_command "make wakunode2 LOG_LEVEL=DEBUG" +execute_command "make wakunode2 LOG_LEVEL=DEBUG V=1" echo "Windows setup completed successfully!" From d2a9894dfe80191cd3ae9033498c07571cb41561 Mon Sep 17 00:00:00 2001 From: DarshanBPatel Date: Wed, 19 Feb 2025 14:08:27 +0530 Subject: [PATCH 13/13] chore: remove unnecessory things --- scripts/build_rln.sh | 7 ------- scripts/windows_setup.sh | 2 +- waku/common/databases/db_postgres/dbconn.nim | 12 ++++++------ 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/scripts/build_rln.sh b/scripts/build_rln.sh index 922087064e..1cf9b98790 100755 --- a/scripts/build_rln.sh +++ b/scripts/build_rln.sh @@ -59,10 +59,3 @@ else cargo build --release -p rln --manifest-path "${build_dir}/rln/Cargo.toml" --features arkzkey cp "${build_dir}/target/release/librln.a" "${output_filename}" fi - -if [[ "${output_filename}" == *".lib"* ]]; then - # We assume is Windows OS - cp "${build_dir}/target/release/rln.lib" "${output_filename}" -else - cp "${build_dir}/target/release/librln.a" "${output_filename}" -fi diff --git a/scripts/windows_setup.sh b/scripts/windows_setup.sh index a407bc32ba..f978265e03 100644 --- a/scripts/windows_setup.sh +++ b/scripts/windows_setup.sh @@ -106,6 +106,6 @@ execute_command "mv natpmp.a libnatpmp.a" cd ../../../../ echo "7. Building wakunode2" -execute_command "make wakunode2 LOG_LEVEL=DEBUG V=1" +execute_command "make wakunode2 LOG_LEVEL=DEBUG V=1 -j8" echo "Windows setup completed successfully!" diff --git a/waku/common/databases/db_postgres/dbconn.nim b/waku/common/databases/db_postgres/dbconn.nim index 487a1d84ee..287ed4e8da 100644 --- a/waku/common/databases/db_postgres/dbconn.nim +++ b/waku/common/databases/db_postgres/dbconn.nim @@ -182,12 +182,12 @@ proc waitQueryToFinish( let asyncFd = cast[asyncengine.AsyncFD](pqsocket(dbConnWrapper.dbConn)) - ## asyncengine.addReader2(asyncFd, onDataAvailable).isOkOr: - ## dbConnWrapper.futBecomeFree.fail(newException(ValueError, $error)) - ## return err("failed to add event reader in waitQueryToFinish: " & $error) - ## defer: - ## asyncengine.removeReader2(asyncFd).isOkOr: - ## return err("failed to remove event reader in waitQueryToFinish: " & $error) + asyncengine.addReader2(asyncFd, onDataAvailable).isOkOr: + dbConnWrapper.futBecomeFree.fail(newException(ValueError, $error)) + return err("failed to add event reader in waitQueryToFinish: " & $error) + defer: + asyncengine.removeReader2(asyncFd).isOkOr: + return err("failed to remove event reader in waitQueryToFinish: " & $error) await futDataAvailable