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

gcc commandline defines passed case-insensitive, causing clashes with variable names #3575

Closed
martin-frbg opened this issue Apr 9, 2018 · 8 comments

Comments

@martin-frbg
Copy link

Over at the OpenBLAS project, our build instructions for Windows were recently changed to recommend msys2.org and the mingw compiler it pulls in from pacman, rather than the mingw-w64 project hosted on sourceforge. This has now led to OpenMathLib/OpenBLAS#1503, where a gcc command line containing "-DCR" (with matching "if defined(CR)" in the sources) results in the error message

<command-line>:0:4: error: expected identifier or '(' before numeric constant

researching this message led me to mingw bug 2183 from around the time of gcc-4.8.1, where similar
behaviour was demonstrated with -DUI and a lowercase "ui" used somewhere as a shorthand for "unsigned int" in a system header. Indeed the OpenBLAS build failure can be worked around by
changing "CR" to "CRX" so it looks like it is still the same problem. Needless to say, the current mingw-w64 from sourceforge (or any other compiler for that matter) do not show this misbehaviour.

@lazka
Copy link
Member

lazka commented Apr 9, 2018

link to the bug you mentioned: https://sourceforge.net/p/mingw/bugs/2183/

@martin-frbg martin-frbg changed the title Commandline defines passed case-insensitive, causing clashes with variable names gcc commandline defines passed case-insensitive, causing clashes with variable names Apr 18, 2018
@martin-frbg
Copy link
Author

A user comment in the OpenBLAS issue thread suggests that the problem can be worked around by downgrading your currently available mingw-w64 crt, headers and tools packages to your archived
mingw-w64-x86_64-crt-git-6.0.0.5100.739199f8-1-any.pkg.tar.xz
mingw-w64-x86_64-headers-git-6.0.0.5102.2f16a8c7-1-any.pkg.tar.xz
mingw-w64-x86_64-tools-git-6.0.0.5079.3b7a42fd-1-any.pkg.tar.xz
which probably points towards the tools package as the source of the problem.

@Alexpux
Copy link
Member

Alexpux commented Apr 28, 2018

@martin-frbg well need then bisect mingw-w64 commit that leads to this issue.
6.0.0.5100 is builded on 26.01.18
6.0.0.5125 is builded on 21.03.18

So need check commits between this dates.

Maybe need also check 6.0.0.5114 package builded on 28.02.18. It may decrease commits to check

@Alexpux
Copy link
Member

Alexpux commented Apr 28, 2018

Checked that 6.0.0.5114 seems to work,
so need bisect commit between 5114 (b63382) and 5125 (17826c) commits

@martin-frbg
Copy link
Author

New comment by "pingplug" in the OpenBLAS issue traces this to https://sourceforge.net/p/mingw-w64/mingw-w64/ci/0f9569488ba7e48472183765a7ae6555ed990f4a in mingw-w64-headers where a new struct containing a DWORD CR was added to winnt.h

@martin-frbg
Copy link
Author

I have created ticket 736 on the mingw-w64 issue tracker at sourceforge now

@martin-frbg
Copy link
Author

So it seems the issue actually comes from the addition of the conflicting definitions to the winnt.h of Windows10, and my initial assumption that an old bug with very similar symptoms had returned was unfounded. Sorry for the noise.

@Alexpux
Copy link
Member

Alexpux commented Jun 4, 2018

Fixed in Alexpux@3ab133b

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

No branches or pull requests

3 participants