You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[14/66] Building C object CMakeFiles/hwloc-gather-cpuid.dir/utils/hwloc/hwloc-gather-cpuid.c.obj
In file included from utils/hwloc/hwloc-gather-cpuid.c:15:
contrib/windows-cmake/../../include/private/cpuid-x86.h:57:3: warning: implicit declaration of function '__cpuidex' is invalid in C99 [-Wimplicit-function-declaration]
__cpuidex(regs, *eax, *ecx);
^
1 warning generated.
[50/66] Building C object CMakeFiles/libhwloc.dir/hwloc/topology-x86.c.obj
FAILED: CMakeFiles/libhwloc.dir/hwloc/topology-x86.c.obj
C:\msys64\mingw64\bin\clang.exe -D_CRT_SECURE_NO_WARNINGS -Icontrib/windows-cmake/../../include -Icontrib/windows-cmake/../../hwloc -Ibuild/include -O3 -DNDEBUG -MD -MT CMakeFiles/libhwloc.dir/hwloc/topology-x86.c.obj -MF CMakeFiles\libhwloc.dir\hwloc\topology-x86.c.obj.d -o CMakeFiles/libhwloc.dir/hwloc/topology-x86.c.obj -c hwloc/topology-x86.c
In file included from hwloc/topology-x86.c:25:
contrib/windows-cmake/../../include/private/cpuid-x86.h:57:3: warning: implicit declaration of function '__cpuidex' is invalid in C99 [-Wimplicit-function-declaration]
__cpuidex(regs, *eax, *ecx);
^
hwloc/topology-x86.c:1704:3: error: use of undeclared identifier 'DIR'
DIR *dir;
^
hwloc/topology-x86.c:1704:8: error: use of undeclared identifier 'dir'; did you mean 'div'?
DIR *dir;
^~~
div
C:/msys64/mingw64/x86_64-w64-mingw32/include/stdlib.h:446:17: note: 'div' declared here
div_t __cdecl div(int _Numerator,int _Denominator);
^
hwloc/topology-x86.c:1709:3: error: use of undeclared identifier 'dir'
dir = opendir(src_cpuiddump_path);
^
hwloc/topology-x86.c:1709:9: warning: implicit declaration of function 'opendir' is invalid in C99 [-Wimplicit-function-declaration]
dir = opendir(src_cpuiddump_path);
^
hwloc/topology-x86.c:1710:8: error: use of undeclared identifier 'dir'; did you mean 'div'?
if (!dir)
^~~
div
C:/msys64/mingw64/x86_64-w64-mingw32/include/stdlib.h:446:17: note: 'div' declared here
div_t __cdecl div(int _Numerator,int _Denominator);
^
hwloc/topology-x86.c:1710:8: warning: address of function 'div' will always evaluate to 'true' [-Wpointer-bool-conversion]
if (!dir)
~^~~
hwloc/topology-x86.c:1710:8: note: prefix with the address-of operator to silence this warning
if (!dir)
^
&
hwloc/topology-x86.c:1734:20: warning: implicit declaration of function 'readdir' is invalid in C99 [-Wimplicit-function-declaration]
while ((dirent = readdir(dir)) != NULL) {
^
hwloc/topology-x86.c:1734:28: error: use of undeclared identifier 'dir'
while ((dirent = readdir(dir)) != NULL) {
^
hwloc/topology-x86.c:1735:24: error: incomplete definition of type 'struct dirent'
if (!strncmp(dirent->d_name, "pu", 2)) {
~~~~~~^
hwloc/topology-x86.c:1703:10: note: forward declaration of 'struct dirent'
struct dirent *dirent;
^
hwloc/topology-x86.c:1737:41: error: incomplete definition of type 'struct dirent'
unsigned long idx = strtoul(dirent->d_name+2, &end, 10);
~~~~~~^
hwloc/topology-x86.c:1703:10: note: forward declaration of 'struct dirent'
struct dirent *dirent;
^
hwloc/topology-x86.c:1742:9: error: incomplete definition of type 'struct dirent'
dirent->d_name, src_cpuiddump_path);
~~~~~~^
hwloc/topology-x86.c:1703:10: note: forward declaration of 'struct dirent'
struct dirent *dirent;
^
hwloc/topology-x86.c:1745:3: warning: implicit declaration of function 'closedir' is invalid in C99 [-Wimplicit-function-declaration]
closedir(dir);
^
hwloc/topology-x86.c:1745:12: error: use of undeclared identifier 'dir'; did you mean 'div'?
closedir(dir);
^~~
div
C:/msys64/mingw64/x86_64-w64-mingw32/include/stdlib.h:446:17: note: 'div' declared here
div_t __cdecl div(int _Numerator,int _Denominator);
^
hwloc/topology-x86.c:1763:12: error: use of undeclared identifier 'dir'; did you mean 'div'?
closedir(dir);
^~~
div
C:/msys64/mingw64/x86_64-w64-mingw32/include/stdlib.h:446:17: note: 'div' declared here
div_t __cdecl div(int _Numerator,int _Denominator);
^
5 warnings and 10 errors generated.
[53/66] Building C object CMakeFiles/libhwloc.dir/hwloc/topology-windows.c.obj
hwloc/topology-windows.c:1420:29: warning: incompatible pointer types passing 'unsigned int *' to parameter of type 'LPDWORD' (aka 'unsigned long *') [-Wincompatible-pointer-types]
GetComputerName(hostname, &hostname_size);
^~~~~~~~~~~~~~
C:/msys64/mingw64/x86_64-w64-mingw32/include/winbase.h:2677:71: note: passing argument to parameter 'nSize' here
WINBASEAPI WINBOOL WINAPI GetComputerNameA (LPSTR lpBuffer, LPDWORD nSize);
Intel LLVM oneAPI
Intel oneAPI LLVM "icx" replaces the legacy "icl". Error at executable link like:
Hello. The CMake support inherits its config from the MSVC solution, hence it assumes the compiler is MSVC instead of detecting things. That's why HWLOC_HAVE_MSVC_CPUIDEX is defined in contrib/windows/private_config.h and things fail here. You may try to #undef that line to see if the non-MSVC cpuid code works, and then we'll need some CMake stuff to enable disable it depending on the compiler.
bgoglin
changed the title
CMake: MSYS2/MinGW GCC,Clang (and Intel LLVM oneAPI) build error
CMake: non-MSVC builds fail because MSVC CPUIDEX is used instead of x86 asm
Nov 2, 2021
WIndows CMake: work with non-MSVC compilers too
This was tested with GCC, Clang, and Intel oneAPI on Windows.
Fixes#492
Adds numerous tests as in Autotools-based builds.
This is also the foundation for using CMake on any platform instead of autotools.
Avoids the constant full rebuilding by using configure_file() instead of explicit file()
It does build with MSVC on same system.
I think this is a known issue, but just for tracking purposes:
What version of hwloc are you using?
2.6/current git default
Which operating system and hardware are you running on?
Windows 11
Details of the problem
With GCC or Clang or Intel oneAPI "icx", errors as in next section result from:
GCC / Clang
Error for GCC and Clang are nearly identical:
Intel LLVM oneAPI
Intel oneAPI LLVM "icx" replaces the legacy "icl". Error at executable link like:
The text was updated successfully, but these errors were encountered: