Menu

#316 CMake UWP build fails

1.28.x
closed-fixed
nobody
None
5
2021-07-12
2021-06-15
No

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]
1 Attachments

Discussion

  • Thomas Orgis

    Thomas Orgis - 2021-06-15

    Can you investigate why this?

    -- Looking for strerror
    -- Looking for strerror - not found
    

    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.

     
  • Evgeni Poberezhnikov

    Is strerror definition is correct?

    You have:

    const char *strerror(int);
    

    but documentation says:

    char *strerror(int);
    

    Also it is strange that strerror presence is detected by check_symbol_exists, not check_function_exists.

     
  • Thomas Orgis

    Thomas Orgis - 2021-06-15

    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?

     
  • Evgeni Poberezhnikov

    I'm working on it.

     
  • Evgeni Poberezhnikov

    Also it is strange that strerror presence is detected by check_symbol_exists, not check_function_exists.

    This.

     
  • Thomas Orgis

    Thomas Orgis - 2021-06-15

    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?

     
  • Evgeni Poberezhnikov

    With that it works now?! I don't quite understand the difference, but well, who am I to complain.

    strerror is misdetected by check_symbol_exists, but it is there.

    And then you have two different definitions of strerror - in string.h and yours, one returns char * and the second const char *. Boom.

    The CMake documentation is confusing here. Use check_function_exists for functions and check_symbol_exists for macros (isnan etc).

     
  • Evgeni Poberezhnikov

    I added this now to SVN. Is now all good for releasing 1.28.1?

    Not yet. Time to create next ticket :-)

     
  • Thomas Orgis

    Thomas Orgis - 2021-06-15

    What about

    check_function_exists() can't detect anything in the 32-bit
    versions of the Win32 API, because of a mismatch in calling conventions.

    ? 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.

     
  • Evgeni Poberezhnikov

    ? I hope that's not relevant. Also, I repeat: I don't actually define strerror.

    But you do in compat_str.h:

    #ifndef HAVE_STRERROR
    const char *strerror(int errnum);
    #endif
    
     
  • Thomas Orgis

    Thomas Orgis - 2021-06-15

    Not really, as intsym.h intervenes:

    #ifndef HAVE_STRERROR
    #define strerror INT123_strerror
    #endif
    

    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.

     
  • Evgeni Poberezhnikov

    Hmm, where is INT123_strerror definition and declaration?

     
  • Thomas Orgis

    Thomas Orgis - 2021-06-15

    After defining strerror to INT123_strerror, each occurence of strerror in the code should read INT123_strerror. That is the idea. And I think it at some point worked that way.

     

    Last edit: Thomas Orgis 2021-06-15
  • Thomas Orgis

    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.

     
  • Thomas Orgis

    Thomas Orgis - 2021-07-12
    • status: open --> closed-fixed
     

Log in to post a comment.