Skip to content

set of windows (mingw64) build fixes #3090

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

w0lek
Copy link
Contributor

@w0lek w0lek commented May 27, 2025

There are a couple compilation fixes for mingw64 build

Description

Two kind of changes:

  1. removed unused function
char* getline(char*& _lineptr, FILE* _stream)

This function has compilation issue and is not actually used and looks obsolete.
If removing is not an option, i will think how to correct code without removing it.

  1. #define _USE_MATH_DEFINES for _WIN32 platform to ensure (non-standard) value of M_PI is brought in from math.h

Related Issue

#3076

Motivation and Context

Allows to build application on windows platform using mingw64

How Has This Been Tested?

It was tested as a part of hotfixes for a several releases in Aurora package (windows build)

Types of changes

  • Compilation errors
  • Bug fix (change which fixes an issue)
  • New feature (change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My change requires a change to the documentation
  • I have updated the documentation accordingly
  • I have added tests to cover my changes
  • All new and existing tests passed

@w0lek w0lek requested review from amin1377 and soheilshahrouz May 27, 2025 18:31
@github-actions github-actions bot added VPR VPR FPGA Placement & Routing Tool lang-cpp C/C++ code libvtrutil external_libs labels May 27, 2025
Copy link
Contributor

@AmirhosseinPoolad AmirhosseinPoolad left a comment

Choose a reason for hiding this comment

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

Thanks for the PR @w0lek. regarding the getline function, even if it wasn't unused I fully support removing it. Seems like a relic from the old C days.

Other than that I had a suggestion on a way to avoid ifdefs for windows compatibility.

Comment on lines +42 to +44
#ifdef _WIN32
#define _USE_MATH_DEFINES // ensure (non-standard) value of M_PI is brought in from math.h
#endif
Copy link
Contributor

@AmirhosseinPoolad AmirhosseinPoolad May 28, 2025

Choose a reason for hiding this comment

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

libezgl doesn't actually belong to this repository and is a subtree here. The actual repo for it is here:
https://github.com/verilog-to-routing/ezgl

However, we're going to sync up the two repositories really soon so I think it's okay to do the change here. @AlexandreSinger thoughts?

Also if ezgl is compiled with C++20, see below on a way to avoid doing ifdefs.

EDIT: Just checked and it's C++14.

Copy link
Contributor

Choose a reason for hiding this comment

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

If this PR can come in before we change this to a sub-module it should be fine (we can include it with the other changes that need to be brought in); if not, @w0lek would need to raise a PR on the EZGL repo (which we will immediately accept).

I think EZGL is kept on C++14 to ensure that it builds on the school computers for the coarse it is used in (but thats just a guess). C++20 is still technically experimental and some of the features confuse students, so we keep them on C++14 if I recall correctly. I see no issue with this fix for now.

Comment on lines +7 to +9
#ifdef _WIN32
#define _USE_MATH_DEFINES // ensure (non-standard) value of M_PI is brought in from math.h
#endif
Copy link
Contributor

Choose a reason for hiding this comment

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

C++20 has added std::numbers::pi (double) and std::numbers::pi_v which should fix this problem and would be cleaner. I'm not sure if ezgl is compiled with C++20 but it can definitely be used here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
external_libs lang-cpp C/C++ code libvtrutil VPR VPR FPGA Placement & Routing Tool
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants