Skip to content

includes not found on MSYS2 #524

Description

@firewave

Encountered while working on #475.

#include "a.h"

./simplecpp $(pwd)/a.cpp

/s/GitHub/simplecpp-fw/a.cpp:1: missing header: Header not found: "a.h"

This causes most of integration-tests.py to fail on MinGW/MSYS.

Activity

  1. firewave commented on Aug 30, 2025

    @firewave
    CollaboratorAuthor

    CC @glankk

    The issue is that CreateFileA() fails because it gets a MSYS/Cygwin path (e.g. /s/path/a.h) and not a Windows one (e.g. S:/path/a.h).

    Simply converting this a to the proper syntax is not sufficient since the path could be internal to MSYS2 (e.g. /tmp/path/a.h) which is the case in the failing tests.

    We also need to run tests for such binaries inside a regular cmd (if possible).

  2. glankk commented on Sep 1, 2025

    @glankk
    Collaborator

    Related to this, there is currently some ambiguity in the windows and windows-adjacent code due to the SIMPLECPP_WINDOWS macro that is defined in various circumstances. I think the correct way to handle windows code is to get rid of SIMPLECPP_WINDOWS and use _WIN32 as the source of absolute truth. When targeting the cygwin/msys runtime (not mingw32/64) then the posix code should suffice, and ideally we shouldn't ever need to check __CYGWIN__ or __MINGW32__.

  3. firewave commented on Sep 1, 2025

    @firewave
    CollaboratorAuthor

    I was thinking the same. Probably need to add a Cygwin workflow as well.

  4. glankk commented on Sep 1, 2025

    @glankk
    Collaborator

    integration-tests.py passes on msys2 mingw when run with mingw-w64-*-python which uses windows paths. I think that is the correct approach to fix this issue. The _WIN32 change described above seems to fix the msys/cygwin issues, I'll make a PR with that. There's still some issues with compiler warnings and libc++ linking with clang. See my mingw-ci fork; https://github.com/glankk/simplecpp/tree/mingw-ci.

  5. firewave commented on Sep 2, 2025

    @firewave
    CollaboratorAuthor

    While at it we could also add #define WIN32_LEAN_AND_MEAN before the include.

    I guess that assertions might not work with MinGW - or maybe we need the CLANG64 build. Will do some tests later.

    And we should still have tests where non-Windows are being used. No idea if by shell or "wrong" Python interpreter.

    And maybe get #438 merged first as well.

  6. firewave commented on Sep 2, 2025

    @firewave
    CollaboratorAuthor

    It only links with libc++ when using CLANG64. I will update the workflow.

  7. firewave commented on Sep 2, 2025

    @firewave
    CollaboratorAuthor

    I updated the workflow. Please post only your source changes (I would like to keep the warnings stuff to the commit where it actually appears) as a PR.

  8. glankk commented on Sep 2, 2025

    @glankk
    Collaborator

    Done, see #531.

  9. added 7 commits that reference this issue on Sep 11, 2025
    c74e586
    9c5cdf4
    cf7c0e7
    75ce498
    28fe711
    85138ce
    9d10c97
  10. added a commit that references this issue on Sep 21, 2025
    de1d67b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions