Uploaded image for project: 'Xerces-C++'
  1. Xerces-C++
  2. XERCESC-1912

Conflicting includes cpuid.h and intrin.h (both define __cpuid)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 3.1.0
    • 3.1.1, 3.2.0
    • Build
    • None
    • GCC 4.4 (mingw) with mingw-w64 environment (64-bit, cross-compiling under Debian GNU/Linux)

    Description

      GCC (since 4.3 AFAIK) contains cpuid.h which defines _get_cpuid(...) and __cpuid(level, a, b, c, d).

      intrin.h is Windows-API which defines __cpuid(int CPUInfo[4], int InfoType)

      Definitions of __cpuid are clearly not compatible.

      However when cross-compiling with GCC-mingw for Windows, configure script detects existence of both cpuid.h and intrin.h and includes both in PlatformUtils.cpp

      Following trivial patch workarounds this problem.

      diff -ur xerces-c-3.1.0/src/xercesc/util/PlatformUtils.cpp xerces-c-3.1.0.patched/src/xercesc/util/PlatformUtils.cpp
      — xerces-c-3.1.0/src/xercesc/util/PlatformUtils.cpp 2009-08-28 16:21:24.000000000 +0300
      +++ xerces-c-3.1.0.patched/src/xercesc/util/PlatformUtils.cpp 2010-02-15 11:16:33.000000000 +0200
      @@ -37,7 +37,7 @@
      #if HAVE_SYS_TIMEB_H

      1. include <sys/timeb.h>
        #endif
        -#if HAVE_CPUID_H
        +#if HAVE_CPUID_H && !XERCES_HAVE_INTRIN_H
      2. include <cpuid.h>
        #endif

      Attachments

        Activity

          People

            bsk Boris Kolpackov
            tvainika Tommi Vainikainen
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: