Skip to content
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

feat: windows support #3107

Merged
merged 1 commit into from
Oct 23, 2024
Merged

feat: windows support #3107

merged 1 commit into from
Oct 23, 2024

Conversation

darshankabariya
Copy link
Contributor

@darshankabariya darshankabariya commented Oct 10, 2024

Windows support for nwaku - Initial pull request

Overview

This pull request (PR) introduces official Windows support for nwaku. Our ultimate goal is to achieve parity with Linux and macOS, allowing Windows users to build and run nwaku using familiar make targets, with minimal platform-specific steps.

Current status and objectives

  • Build wakunode2 successfully on Windows [ Done }
  • Run unit tests successfully [ Done ]
  • Avoid bypassing waku_sync binding [ Done ]
  • Automate installation of prerequisites (gcc, make, cargo, msys, path setup, library linking) [ In Progress ]
  • Build and run cwaku example [ In Progress ]
  • Implement CI/CD integration for Windows [ Not Started ]

Setup procedure

The current setup procedure is as follows:

  1. Clone the repository and checkout the windows_support branch
  2. Ensure prerequisites are installed (Make, GCC, MSYS2/MinGW)
  3. Run scripts/windows_setup.sh
  4. Execute make wakunode2 (additional targets coming soon)

Note: This procedure will be updated as we progress towards our goal of making the windows build process similar to linux and mac. Eventually, users will be able to use standard make targets without additional setup steps.

Achievements

  • Successfully building wakunode2 on Windows
  • Unit tests passing
  • waku_sync binding properly integrated

Copy link

github-actions bot commented Oct 16, 2024

You can find the image built from this PR at

quay.io/wakuorg/nwaku-pr:3107

Built from 5ad9045

Copy link
Collaborator

@Ivansete-status Ivansete-status left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks for it! 💯
I just added some minor comments that I hope you find useful :)

Comment on lines +47 to +49
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')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are the sed and jq available by default on Windows?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think msys built in contains bash and all the main *nix utilities... at least how I remember...

Copy link
Contributor Author

@darshankabariya darshankabariya Oct 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, jq, sed and all other linux utilities are come long with msys ( mingw )

build_component "vendor/nim-libbacktrace" "make install/usr/lib/libunwind.a" "libunwind"

echo "7. Building wakunode2"
execute_command "make wakunode2 V=1"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd add some more NIMFLAGS to prevent colors in chronicles

Suggested change
execute_command "make wakunode2 V=1"
execute_command 'make wakunode2 V=1 NIMFLAGS="-d:disableMarchNative -d:postgres -d:chronicles_colors:none" '

Copy link
Contributor

@gabrielmer gabrielmer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks so much! Looks amazing! 🔥

Added a couple comments to further understand :)

Makefile Outdated
detected_OS := Darwin
else ifeq ($(detected_OS),Linux)
detected_OS := Linux
else ifneq (,$(findstring MINGW,$(detected_OS)))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't the OS be Windows even if the OS doesn't contain MINGW on its name? I think in other places we use ifeq ($(OS),Windows_NT) for example

It would probably make sense to also search for the string Windows

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in windows systems, the OS variable is usually empty by default, so I use the uname command for information. Since MINGW is very common in windows, use that idea to differentiate windows and non-windows. but yeah i got your point, i will try make more simplified.

Makefile Show resolved Hide resolved
@chair28980
Copy link
Contributor

Related to waku-org/pm#239

Copy link
Contributor

@NagyZoltanPeter NagyZoltanPeter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work!
Would you mind add a section into Readme.md describing Windows build?

Comment on lines +47 to +49
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')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think msys built in contains bash and all the main *nix utilities... at least how I remember...

@darshankabariya
Copy link
Contributor Author

darshankabariya commented Oct 22, 2024

Great work! Would you mind add a section into Readme.md describing Windows build?

Sure, Thanks for suggestion

Copy link
Contributor

@SionoiS SionoiS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@darshankabariya darshankabariya merged commit ff21c01 into master Oct 23, 2024
9 of 11 checks passed
@darshankabariya darshankabariya deleted the windows_support branch October 23, 2024 06:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants