IntelLLVM: env-regression: Intel oneAPI on Windows
Intel oneAPI 2023.0.0 was released several days ago. I notice that the new compiler frontend for Windows icpx is getting picked up first by CMake instead of "icx", but then CMake doesn't work correctly with icpx on Windows. I noticed this with CMake 3.25.[0,1]. The root issue is an old assumption that only icx is present on Windows.
It would be nice if icpx would work with CMake on Windows, but a quick workaround is to just look for icx first on Windows.
A user workaround is to set env var CXX=icx
or cmake -DCMAKE_CXX_COMPILER=icx
A minimal CMakeList.txt fails to detect the C++ compiler correctly with oneAPI 2023.0.0 on Windows:
cmake_minimum_required(VERSION 3.19...3.26)
project(a LANGUAGES C CXX)
-- The C compiler identification is IntelLLVM 2023.0.0 with MSVC-like command-line
-- The CXX compiler identification is IntelLLVM 2023.0.0 with GNU-like command-line
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files (x86)/Intel/oneAPI/compiler/latest/windows/bin/icx.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - failed
-- Check for working CXX compiler: C:/Program Files (x86)/Intel/oneAPI/compiler/latest/windows/bin/icpx.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Intel/oneAPI/compiler/latest/windows/bin/icpx.exe - broken
CMake Error at C:/cmake-3.25.0/share/cmake-3.25/Modules/CMakeTestCXXCompiler.cmake:63 (message):
The C++ compiler
"C:/Program Files (x86)/Intel/oneAPI/compiler/latest/windows/bin/icpx.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/temp/buildi/CMakeFiles/CMakeScratch/TryCompile-7dpaqo
Run Build Command(s):C:/msys64/mingw64/bin/ninja.exe cmTC_7d301 && [1/2] Building CXX object CMakeFiles\cmTC_7d301.dir\testCXXCompiler.cxx.obj
FAILED: CMakeFiles/cmTC_7d301.dir/testCXXCompiler.cxx.obj
C:\PROGRA~2\Intel\oneAPI\compiler\latest\windows\bin\icpx.exe /nologo /TP /DWIN32 /D_WINDOWS /EHsc /Ob0 /Od /RTC1 -MDd -Zi -QMD -QMT CMakeFiles\cmTC_7d301.dir\testCXXCompiler.cxx.obj -QMF CMakeFiles\cmTC_7d301.dir\testCXXCompiler.cxx.obj.d /FoCMakeFiles\cmTC_7d301.dir\testCXXCompiler.cxx.obj /FdCMakeFiles\cmTC_7d301.dir\ -c C:\temp\buildi\CMakeFiles\CMakeScratch\TryCompile-7dpaqo\testCXXCompiler.cxx
icpx: error: unknown argument: '-nologo'
icpx: error: unknown argument: '-EHsc'
icpx: error: unknown argument: '-MDd'
icpx: error: unknown argument: '-Zi'
icpx: error: unknown argument: '-QMD'
icpx: error: unknown argument: '-QMT'
icpx: error: unknown argument: '-QMF'
icpx: error: no such file or directory: 'CMakeFiles\cmTC_7d301.dir\testCXXCompiler.cxx.obj'
icpx: error: no such file or directory: 'CMakeFiles\cmTC_7d301.dir\testCXXCompiler.cxx.obj.d'
ninja: build stopped: subcommand failed.
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:2 (project)
For reference:
dir "C:/Program Files (x86)/Intel/oneAPI/compiler/latest/windows/bin/*.exe"
Directory: C:\Program Files (x86)\Intel\oneAPI\compiler\latest\windows\bin
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 12/1/2022 09:03 680488 aocl-ioc64.exe
-a--- 12/1/2022 09:03 427048 dpcpp-cl.exe
-a--- 12/1/2022 09:03 427048 dpcpp.exe
-a--- 12/1/2022 09:03 416808 fpp.exe
-a--- 12/1/2022 09:03 1337896 icpx.exe
-a--- 12/1/2022 09:03 1339944 icx-cc.exe
-a--- 12/1/2022 09:03 1339944 icx-cl.exe
-a--- 12/1/2022 09:03 1339944 icx.exe
-a--- 12/1/2022 09:03 1355304 ifx.exe
-a--- 12/1/2022 09:03 680488 ioc64.exe
-a--- 12/1/2022 09:03 759336 opencl-aot.exe
-a--- 12/1/2022 09:03 417320 sycl-ls.exe
-a--- 12/1/2022 09:03 11938344 sycl-post-link.exe