CMake UWP build fails
Brought to you by:
sobukus
Found another bug when trying to add Vcpkg port.
https://en.wikipedia.org/wiki/Universal_Windows_Platform
5>D:\buildtrees\mpg123\src\4e333ee4f3-f9ae7d9a6e.clean\src\compat\compat.h(126,13): error C2373: 'INT123_strerror': redefinition; different type modifiers (compiling source file D:\buildtrees\mpg123\src\4e333ee4f3-f9ae7d9a6e.clean\src\compat\compat.c) [D:\buildtrees\mpg123\x64-uwp-dbg\src\compat\compat.vcxproj] C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\ucrt\string.h(178): message : see declaration of 'INT123_strerror' (compiling source file D:\buildtrees\mpg123\src\4e333ee4f3-f9ae7d9a6e.clean\src\compat\compat.c) [D:\buildtrees\mpg123\x64-uwp-dbg\src\compat\compat.vcxproj]
Can you investigate why this?
https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strerror-strerror-wcserror-wcserror?view=msvc-160
Shouldn't strerror be present? If it is, the whole INT123_strerror doesn't appear. About the error … I don't see the problem. There's a single specification … which is not even conflicting with anything, because INT123.
But apart from that strangeness, I guess HAVE_STRERROR should be defined and this issue would be gone.
Is
strerror
definition is correct?You have:
but documentation says:
Also it is strange that
strerror
presence is detected bycheck_symbol_exists
, notcheck_function_exists
.Well, the root cause is that this definition enters the picture at all. It's named INT123_strerror() anyway. Can do its own thing.
According to
https://cmake.org/cmake/help/latest/module/CheckFunctionExists.html?highlight=check_function_exists
one should prefer check_symbol_exists(). I dunno. Can we get some debugging on where it fails to find strerror?
I'm working on it.
This.
With that it works now?! I don't quite understand the difference, but well, who am I to complain.
I added this now to SVN. Is now all good for releasing 1.28.1?
strerror
is misdetected bycheck_symbol_exists
, but it is there.And then you have two different definitions of
strerror
- instring.h
and yours, one returnschar *
and the secondconst char *
. Boom.The CMake documentation is confusing here. Use
check_function_exists
for functions andcheck_symbol_exists
for macros (isnan
etc).Not yet. Time to create next ticket :-)
What about
? I hope that's not relevant. Also, I repeat: I don't actually define strerror. With intsym.h, only INT123_strerror is defined. No conflict with the system one. MSVC still doesn't like the definition, though. for some reason. Maybe there is still some bug in that handling.
I see that gcc also complains if I force the INT123_strerror definition. I'll fix that, after scratching my head for a while.
But you do in
compat_str.h
:Not really, as
intsym.h
intervenes:But that's seriously broken and might have been for a long while. Even with
const char *INT123_strerror(int errnum);
in the header, it still sees a conflict of types. Must be something basic that I'm blind for right now.
Hmm, where is
INT123_strerror
definition and declaration?After defining
strerror
toINT123_strerror
, each occurence ofstrerror
in the code should readINT123_strerror
. That is the idea. And I think it at some point worked that way.Last edit: Thomas Orgis 2021-06-15
Ah, simples. It's the same thing again. The
intsym.h
header was included before string.h.Current svn doesn't have that error anymore.