Skip to content

Improve MinGW compatibility#136

Open
ccuser44 wants to merge 6 commits intop2r3:mainfrom
ccuser44:patch-3
Open

Improve MinGW compatibility#136
ccuser44 wants to merge 6 commits intop2r3:mainfrom
ccuser44:patch-3

Conversation

@ccuser44
Copy link
Copy Markdown

This makes bareiron be able to be compiled for Windows by using WSA alternatives for connection data and having a custom implementation for get_program_time for Windows/NT platforms.
Also this was a pain to make and debug lol

Proof:
image

Copy link
Copy Markdown

@Haider982 Haider982 left a comment

Choose a reason for hiding this comment

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

You should add a few comments to help those who stumble into here not delete it.

@ccuser44
Copy link
Copy Markdown
Author

You should add a few comments to help those who stumble into here not delete it.

Delete what?

@netceil
Copy link
Copy Markdown

netceil commented Sep 22, 2025

The program works on windows though already? I've compiled it from source just now, all you need is the Git Bash (to run the build.sh script) and the gcc compiler (i use w64devkit, it has everything you need bundled in a neat lil package :)

@ccuser44
Copy link
Copy Markdown
Author

gcc compiler (i use w64devkit, it has everything you need bundled in a neat lil package :)

I used Mingw and it refused to compile without these changes

@netceil
Copy link
Copy Markdown

netceil commented Sep 22, 2025

I used Mingw and it refused to compile without these changes

Then change the issue title to be more adequate, say "Fix bareiron not building on mingw", or "Add mingw support"

@ccuser44
Copy link
Copy Markdown
Author

ccuser44 commented Sep 23, 2025

I used Mingw and it refused to compile without these changes

Then change the issue title to be more adequate, say "Fix bareiron not building on mingw", or "Add mingw support"

Mingw is the standard way to use GCC for Windows, see the GCC website.

I think the current title suffices. Expecially as this also brings MSVC support a lot closer.

@netceil
Copy link
Copy Markdown

netceil commented Sep 23, 2025

Mingw is the standard way to use GCC for Windows, see the GCC website.

(i use w64devkit, it has everything you need bundled in a neat lil package :)

w64devkit's GCC suite is MinGW. The project compiles without any changes from your PR, so none are needed.

IMG_20250923_115554.jpg

@ccuser44
Copy link
Copy Markdown
Author

Mingw is the standard way to use GCC for Windows, see the GCC website.

(i use w64devkit, it has everything you need bundled in a neat lil package :)

w64devkit's GCC suite is MinGW. The project compiles without any changes from your PR, so none are needed.

It seems to be using GCC with some extra stuff bundled in because standard Mingw with some additional packages wont compile.

Besides I don't think the pull request name is that important.

@ccuser44
Copy link
Copy Markdown
Author

Mingw-w64 is an advancement of the original mingw.org project, which was created to support the GCC compiler on Windows systems. It was forked in 2007 in order to provide 64-bit support and newer APIs. It has since then gained wide use and distribution.

Mingw-w64≠Mingw

@netceil
Copy link
Copy Markdown

netceil commented Sep 23, 2025

Mingw-w64 is an advancement of the original mingw.org project, which was created to support the GCC compiler on Windows systems. It was forked in 2007 in order to provide 64-bit support and newer APIs. It has since then gained wide use and distribution.

Then use MinGW-w64 and not some obsolete distribution 😂

Copy link
Copy Markdown
Owner

@p2r3 p2r3 left a comment

Choose a reason for hiding this comment

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

Indentation seems to be misaligned. This project uses 2-space indentation, I think you're using tabs?

@p2r3 p2r3 changed the title Fix bareiron not building for Windows Improve MinGW compatibility Sep 23, 2025
@ccuser44
Copy link
Copy Markdown
Author

Indentation seems to be misaligned. This project uses 2-space indentation, I think you're using tabs?

That's just the Github IDE

Albeit in general I think tabs are superior to spaces.
But yeah I will fix that.

@ccuser44
Copy link
Copy Markdown
Author

Mingw-w64 is an advancement of the original mingw.org project, which was created to support the GCC compiler on Windows systems. It was forked in 2007 in order to provide 64-bit support and newer APIs. It has since then gained wide use and distribution.

Then use MinGW-w64 and not some obsolete distribution 😂

I used the official Mingw distribution that GCC reccommends

@p2r3
Copy link
Copy Markdown
Owner

p2r3 commented Sep 23, 2025

Indentation seems to be misaligned. This project uses 2-space indentation, I think you're using tabs?

That's just the Github IDE

Albeit in general I think tabs are superior to spaces.
But yeah I will fix that.

As the contribution guidelines state, follow the existing code style, even if you disagree with it.

@ccuser44 ccuser44 requested review from Haider982 and p2r3 October 25, 2025 16:06
@ccuser44
Copy link
Copy Markdown
Author

Indentation seems to be misaligned. This project uses 2-space indentation, I think you're using tabs?

Fixed.

@BHare1985
Copy link
Copy Markdown
Contributor

FWIW I had no issues compiling on windows using the exact instructions in the README, and I also had no issues with the MinGW bundled with CLion.

I am curious what kind of compiler errors you had with your MinGW version?

That all being said I think using the proper windows error handling is probably best even if it does muddy up the code. Not a huge deal but it is recommended to use the WIN32 SOCKET_ERROR enum over just relying on -1 so intent is clear but it's not a hill I'd die on and POSIX relies on the -1

Finally, the indentation still isn't 100% perfect from what I see

@ccuser44
Copy link
Copy Markdown
Author

FWIW I had no issues compiling on windows using the exact instructions in the README, and I also had no issues with the MinGW bundled with CLion.

Try the official MinGW, the programs suggested in the comments are either Cygwin or mingw-w64 variants.

Finally, the indentation still isn't 100% perfect from what I see

I didn't find indentation issues in the code but feel free to point out if you find any ;)

I am curious what kind of compiler errors you had with your MinGW version?

I don't remember the exact error but I recall the fix was to use a discontinued package for MinGW which was no longer available and thus could not be fixed.

@ccuser44
Copy link
Copy Markdown
Author

Also to mention that this pull makes possible MSVC build support easier expecially by introducing the Windows specific clock function

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.

5 participants