Skip to content
Snippets Groups Projects
  1. Oct 17, 2020
  2. Oct 14, 2020
    • Yonggang Luo's avatar
      configure: Fixes ncursesw detection under msys2/mingw by convert them to meson · 5285e593
      Yonggang Luo authored
      
      The mingw pkg-config are showing following absolute path and contains : as the separator,
      
      -D_XOPEN_SOURCE=600 -D_POSIX_C_SOURCE=199506L -IC:/CI-Tools/msys64/mingw64/include/ncursesw:-I/usr/include/ncursesw:
      -DNCURSES_WIDECHAR -D_XOPEN_SOURCE=600 -D_POSIX_C_SOURCE=199506L -IC -pipe -lncursesw -lgnurx -ltre -lintl -liconv
      -DNCURSES_WIDECHAR -D_XOPEN_SOURCE=600 -D_POSIX_C_SOURCE=199506L -IC -lncursesw
      -DNCURSES_WIDECHAR -D_XOPEN_SOURCE=600 -D_POSIX_C_SOURCE=199506L -IC -lcursesw
      -DNCURSES_WIDECHAR /CI-Tools/msys64/mingw64/include/ncursesw -pipe -lncursesw -lgnurx -ltre -lintl -liconv
      -DNCURSES_WIDECHAR /CI-Tools/msys64/mingw64/include/ncursesw -lncursesw
      -DNCURSES_WIDECHAR /CI-Tools/msys64/mingw64/include/ncursesw -lcursesw
      -DNCURSES_WIDECHAR -I/usr/include/ncursesw -pipe -lncursesw -lgnurx -ltre -lintl -liconv
      -DNCURSES_WIDECHAR -I/usr/include/ncursesw -lncursesw
      -DNCURSES_WIDECHAR -I/usr/include/ncursesw -lcursesw
      
      Signed-off-by: default avatarYonggang Luo <luoyonggang@gmail.com>
      Reviewed-by: default avatarGerd Hoffmann <kraxel@redhat.com>
      Message-id: 20201012234348.1427-6-luoyonggang@gmail.com
      Signed-off-by: default avatarGerd Hoffmann <kraxel@redhat.com>
      5285e593
    • Yonggang Luo's avatar
      win32: Simplify gmtime_r detection not depends on if _POSIX_C_SOURCE are defined on msys2/mingw · 7c3afc85
      Yonggang Luo authored
      
      We remove the CONFIG_LOCALTIME_R detection option in configure, and move the check
      existence of gmtime_r from configure into C header and source directly by using macro
      `_POSIX_THREAD_SAFE_FUNCTIONS`.
      Before this patch, the configure script are always assume the compiler doesn't define
      _POSIX_C_SOURCE macro at all, but that's not true, because thirdparty library such
      as ncursesw may define -D_POSIX_C_SOURCE in it's pkg-config file. And that C Flags will
      added -D_POSIX_C_SOURCE into each QEMU_CFLAGS. And that's causing the following compiling error:
      n file included from C:/work/xemu/qemu/include/qemu/osdep.h:119,
                       from ../softmmu/main.c:25:
      C:/work/xemu/qemu/include/sysemu/os-win32.h:53:12: error: redundant redeclaration of 'gmtime_r' [-Werror=redundant-decls]
         53 | struct tm *gmtime_r(const time_t *timep, struct tm *result);
            |            ^~~~~~~~
      In file included from C:/work/xemu/qemu/include/qemu/osdep.h:94,
                       from ../softmmu/main.c:25:
      C:/CI-Tools/msys64/mingw64/x86_64-w64-mingw32/include/time.h:284:36: note: previous definition of 'gmtime_r' was here
        284 | __forceinline struct tm *__CRTDECL gmtime_r(const time_t *_Time, struct tm *_Tm) {
            |                                    ^~~~~~~~
      In file included from C:/work/xemu/qemu/include/qemu/osdep.h:119,
                       from ../softmmu/main.c:25:
      C:/work/xemu/qemu/include/sysemu/os-win32.h:55:12: error: redundant redeclaration of 'localtime_r' [-Werror=redundant-decls]
         55 | struct tm *localtime_r(const time_t *timep, struct tm *result);
            |            ^~~~~~~~~~~
      In file included from C:/work/xemu/qemu/include/qemu/osdep.h:94,
                       from ../softmmu/main.c:25:
      C:/CI-Tools/msys64/mingw64/x86_64-w64-mingw32/include/time.h:281:36: note: previous definition of 'localtime_r' was here
        281 | __forceinline struct tm *__CRTDECL localtime_r(const time_t *_Time, struct tm *_Tm) {
            |                                    ^~~~~~~~~~~
      Compiling C object libcommon.fa.p/hw_gpio_zaurus.c.obj
      In file included from C:/work/xemu/qemu/include/qemu/osdep.h:119,
                       from ../hw/i2c/smbus_slave.c:16:
      C:/work/xemu/qemu/include/sysemu/os-win32.h:53:12: error: redundant redeclaration of 'gmtime_r' [-Werror=redundant-decls]
         53 | struct tm *gmtime_r(const time_t *timep, struct tm *result);
            |            ^~~~~~~~
      In file included from C:/work/xemu/qemu/include/qemu/osdep.h:94,
                       from ../hw/i2c/smbus_slave.c:16:
      C:/CI-Tools/msys64/mingw64/x86_64-w64-mingw32/include/time.h:284:36: note: previous definition of 'gmtime_r' was here
        284 | __forceinline struct tm *__CRTDECL gmtime_r(const time_t *_Time, struct tm *_Tm) {
            |                                    ^~~~~~~~
      In file included from C:/work/xemu/qemu/include/qemu/osdep.h:119,
                       from ../hw/i2c/smbus_slave.c:16:
      C:/work/xemu/qemu/include/sysemu/os-win32.h:55:12: error: redundant redeclaration of 'localtime_r' [-Werror=redundant-decls]
         55 | struct tm *localtime_r(const time_t *timep, struct tm *result);
            |            ^~~~~~~~~~~
      In file included from C:/work/xemu/qemu/include/qemu/osdep.h:94,
                       from ../hw/i2c/smbus_slave.c:16:
      C:/CI-Tools/msys64/mingw64/x86_64-w64-mingw32/include/time.h:281:36: note: previous definition of 'localtime_r' was here
        281 | __forceinline struct tm *__CRTDECL localtime_r(const time_t *_Time, struct tm *_Tm) {
            |                                    ^~~~~~~~~~~
      Compiling C object libcommon.fa.p/hw_dma_xilinx_axidma.c.obj
      
      After this patch, whenever ncursesw or other thirdparty libraries tried to define or not
      define  _POSIX_C_SOURCE, the source will building properly. Because now, we don't make any
      assumption if _POSIX_C_SOURCE are defined. We solely relied on if the macro `_POSIX_THREAD_SAFE_FUNCTIONS`
      are defined in msys2/mingw header.
      
      The _POSIX_THREAD_SAFE_FUNCTIONS are defined in mingw header like this:
      
      ```
      #if defined(_POSIX_C_SOURCE) && !defined(_POSIX_THREAD_SAFE_FUNCTIONS)
      #define _POSIX_THREAD_SAFE_FUNCTIONS 200112L
      #endif
      
      #ifdef _POSIX_THREAD_SAFE_FUNCTIONS
      __forceinline struct tm *__CRTDECL localtime_r(const time_t *_Time, struct tm *_Tm) {
        return localtime_s(_Tm, _Time) ? NULL : _Tm;
      }
      __forceinline struct tm *__CRTDECL gmtime_r(const time_t *_Time, struct tm *_Tm) {
        return gmtime_s(_Tm, _Time) ? NULL : _Tm;
      }
      __forceinline char *__CRTDECL ctime_r(const time_t *_Time, char *_Str) {
        return ctime_s(_Str, 0x7fffffff, _Time) ? NULL : _Str;
      }
      __forceinline char *__CRTDECL asctime_r(const struct tm *_Tm, char * _Str) {
        return asctime_s(_Str, 0x7fffffff, _Tm) ? NULL : _Str;
      }
      #endif
      ```
      
      Signed-off-by: default avatarYonggang Luo <luoyonggang@gmail.com>
      Reviewed-by: default avatarDaniel P. Berrangé <berrange@redhat.com>
      Message-id: 20201012234348.1427-5-luoyonggang@gmail.com
      Signed-off-by: default avatarGerd Hoffmann <kraxel@redhat.com>
      7c3afc85
    • Yonggang Luo's avatar
      curses: Fixes compiler error that complain don't have langinfo.h on msys2/mingw · 80d3ab61
      Yonggang Luo authored
      
      msys2/mingw lacks the POSIX-required langinfo.h.
      
      gcc test.c -DNCURSES_WIDECHAR -I/mingw64/include/ncursesw -pipe -lncursesw -lgnurx -ltre -lintl -liconv
      test.c:4:10: fatal error: langinfo.h: No such file or directory
          4 | #include <langinfo.h>
            |          ^~~~~~~~~~~~
      compilation terminated.
      
      So we using g_get_codeset instead of nl_langinfo(CODESET)
      
      Signed-off-by: default avatarYonggang Luo <luoyonggang@gmail.com>
      Reviewed-by: default avatarGerd Hoffmann <kraxel@redhat.com>
      Reviewed-by: default avatarDaniel P. Berrangé <berrange@redhat.com>
      Reviewed-by: default avatarPhilippe Mathieu-Daudé <philmd@redhat.com>
      Message-id: 20201012234348.1427-3-luoyonggang@gmail.com
      Signed-off-by: default avatarGerd Hoffmann <kraxel@redhat.com>
      80d3ab61
  3. Oct 13, 2020
  4. Oct 09, 2020
  5. Oct 06, 2020
  6. Oct 04, 2020
  7. Oct 03, 2020
  8. Oct 02, 2020
  9. Sep 30, 2020
  10. Sep 29, 2020
  11. Sep 17, 2020
  12. Sep 16, 2020
Loading