Uploaded image for project: 'HPCC'
  1. HPCC
  2. HPCC-17308

Build issue on windows with jdebug cycle_t reference

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 6.2.4
    • Fix Version/s: 6.4.0
    • Component/s: Build process, JLib
    • Labels:
      None
    • Environment:
      Windows 64 Library build

      Description

      Jenkins Console Log

      10:12:47 D:\jenkins2\workspace\CE-Platform-Libraries-Win64-6.2.4\CE\Windows_2k8_Servers\HPCC-Platform\system\jlib\jdebug.cpp(290): error C2375: 'get_cycles_now': redefinition; different linkage [D:\jenkins2\workspace\CE-Platform-Libraries-Win64-6.2.4\CE\Windows_2k8_Servers\build\system\jlib\jlib.vcxproj]
      10:12:47 D:\jenkins2\workspace\CE-Platform-Libraries-Win64-6.2.4\CE\Windows_2k8_Servers\HPCC-Platform\system\jlib\jdebug.cpp(450): error C2568: '=': unable to resolve function overload [D:\jenkins2\workspace\CE-Platform-Libraries-Win64-6.2.4\CE\Windows_2k8_Servers\build\system\jlib\jlib.vcxproj]
      10:12:47 D:\jenkins2\workspace\CE-Platform-Libraries-Win64-6.2.4\CE\Windows_2k8_Servers\HPCC-Platform\system\jlib\jdebug.cpp(455): error C2440: 'initializing': cannot convert from 'cycle_t (__cdecl *)(void)' to 'cycle_t' [D:\jenkins2\workspace\CE-Platform-Libraries-Win64-6.2.4\CE\Windows_2k8_Servers\build\system\jlib\jlib.vcxproj]
      10:12:47 D:\jenkins2\workspace\CE-Platform-Libraries-Win64-6.2.4\CE\Windows_2k8_Servers\HPCC-Platform\system\jlib\jdebug.cpp(462): error C2568: '=': unable to resolve function overload [D:\jenkins2\workspace\CE-Platform-Libraries-Win64-6.2.4\CE\Windows_2k8_Servers\build\system\jlib\jlib.vcxproj]
      10:12:47 D:\jenkins2\workspace\CE-Platform-Libraries-Win64-6.2.4\CE\Windows_2k8_Servers\HPCC-Platform\system\jlib\jdebug.cpp(467): error C2440: 'initializing': cannot convert from 'cycle_t (__cdecl *)(void)' to 'cycle_t' [D:\jenkins2\workspace\CE-Platform-Libraries-Win64-6.2.4\CE\Windows_2k8_Servers\build\system\jlib\jlib.vcxproj]

      Issue

      The issue is that in jdebug.hpp we have the 'get_cycles_now' function declared two different ways depending on preprocessor definitions. One possibility declares and implements the function, the other just declares it. However in jdebug.cpp we implement the function regardless of the fact it might have been implemented in the header file. This causes the microsoft compiler to throw an error about redefining the function.

      Solution

      Only define the function in the source file if it hasn't been defined in the header file.

      jdebug.hpp
      #if defined(INLINE_GET_CYCLES_NOW) && defined(HAS_GOOD_CYCLE_COUNTER)
      inline cycle_t get_cycles_now() { return getTSC(); }
      #else
      cycle_t jlib_decl get_cycles_now();  // equivalent to getTSC when available
      #endif
      
      jdebug.cpp
      #ifndef INLINE_GET_CYCLES_NOW
      #ifndef HAS_GOOD_CYCLE_COUNTER
      cycle_t jlib_decl get_cycles_now()
      {
          if (useRDTSC)
              return getTSC();
          LARGE_INTEGER temp;
          QueryPerformanceCounter(&temp);
          return temp.QuadPart;
      }
      #endif
      #endif
      

        Attachments

          Activity

            People

            • Assignee:
              ghalliday Gavin Halliday
              Reporter:
              Michael-Gardner Michael Gardner
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: