Closed anjohnson closed 3 years ago
See https://sourceforge.net/p/mingw-w64/bugs/404/
This seems to be an issue with the defines that select which Windows version a source is compiled for. @MarkRivers: is iocStats using something too new, or is the setting of the Windows version pointing "too old"?
I have only built for 32-bit mingw so far, so I have not run into this problem.
I think the problem may be related to this in osdCpuUtilization.c
#ifdef _WIN64
pval->noOfCpus = GetMaximumProcessorCount(ALL_PROCESSOR_GROUPS);
#else
pval->noOfCpus = strtol(getenv("NUMBER_OF_PROCESSORS"),NULL,10);
#endif
Is this correct, is the difference in fetching these really a 32/64 bit issue?
ALL_PROCESSOR_GROUPS is not defined anywhere in the mingw include files on Fedora 15.
It looks difficult to really do this correctly. Since the article Ralph referenced says that getenv("NUMBER_OF_PROCESSORS") does work on 64 and 32 bit Windows we could just change the code to:
pval->noOfCpus = strtol(getenv("NUMBER_OF_PROCESSORS"),NULL,10);
i.e. no same code for either architecture. It will only return the #processors in this thread's group, and so won't be accurate for very large number of processors, but it's probably OK for our purposes.
For whatever it is worth, I just attempted to use the latest mingw under linux to cross compile epics base-3.16.1 and deviocstats-3.1.15 and all I had to do was add 1 define in 2 files.
change
to
in os/WIN32/osdMemusage.c os/WIN32/CpuUtilization.c
and add the psapi library to resolve the references , which I cheated and corrected in CONFIG.linux-x86.windows-x64-mingw
the softioc seems to run without throwing any errors.
Running a cross-build of the windows-x64-mingw target on RHEL-7 against Base-3.14.12.6 I get the following build failure: