Intel® oneAPI Data Parallel C++
Support for Intel® oneAPI DPC++ Compiler, Intel® oneAPI DPC++ Library, Intel® DPC++ Compatibility Tool, and GDB*
543 Discussions

Using Intel Compiler 2022 as a toolset in cmake not working

Kiefer_Kuah
Employee
1,699 Views

Tried to build oneDNN with Intel Compiler 2022.1.0.138 using these documentation

oneDNN build documentation

Configuring CMake* and Microsoft Visual Studio* 2019 for Use with Intel Compilers

 

An error occurred when running cmake

 

cmake -G "Visual Studio 17 2022" -A x64 -T "Intel(R) oneAPI DPC++ Compiler" ..
-- CMAKE_BUILD_TYPE is unset, defaulting to Release
-- Selecting Windows SDK version 10.0.22000.0 to target Windows 10.0.25099.
CMake Error at CMakeLists.txt:81 (project):
Failed to run MSBuild command:

C:/Program Files/Microsoft Visual Studio/2022/Community/MSBuild/Current/Bin/amd64/MSBuild.exe

to get the value of VCTargetsPath:

MSBuild version 17.3.1+2badb37d1 for .NET Framework
Build started 9/2/2022 10:51:43 AM.
Project "C:\Users\mtc\source\repos\onednn\build\CMakeFiles\3.23.1\VCTargetsPath.vcxproj" on node 1 (default targets).
C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppBuild.targets(460,5): error MSB8020: The build tools for Intel(R) oneAPI DPC++ Compiler (Platform Toolset = 'Intel(R) oneAPI DPC++ Compiler') cannot be found. To build using the Intel(R) oneAPI DPC++ Compiler build tools, please install Intel(R) oneAPI DPC++ Compiler build tools. Alternatively, you may upgrade to the current Visual Studio tools by selecting the Project menu or right-click the solution, and then selecting "Retarget solution". [C:\Users\mtc\source\repos\onednn\build\CMakeFiles\3.23.1\VCTargetsPath.vcxproj]
Done Building Project "C:\Users\mtc\source\repos\onednn\build\CMakeFiles\3.23.1\VCTargetsPath.vcxproj" (default targets) -- FAILED.

Build FAILED.

"C:\Users\mtc\source\repos\onednn\build\CMakeFiles\3.23.1\VCTargetsPath.vcxproj" (default target) (1) ->
(PrepareForBuild target) ->
C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppBuild.targets(460,5): error MSB8020: The build tools for Intel(R) oneAPI DPC++ Compiler (Platform Toolset = 'Intel(R) oneAPI DPC++ Compiler') cannot be found. To build using the Intel(R) oneAPI DPC++ Compiler build tools, please install Intel(R) oneAPI DPC++ Compiler build tools. Alternatively, you may upgrade to the current Visual Studio tools by selecting the Project menu or right-click the solution, and then selecting "Retarget solution". [C:\Users\mtc\source\repos\onednn\build\CMakeFiles\3.23.1\VCTargetsPath.vcxproj]

0 Warning(s)
1 Error(s)

Time Elapsed 00:00:00.15


Exit code: 1

 

Visual Studio 2022 17.3.3

Intel(R) oneAPI DPC++/C++ Compiler for applications running on Intel(R) 64, Version 2022.1.0 Build 20220316

0 Kudos
1 Solution
SantoshY_Intel
Moderator
1,552 Views

Hi,

 

Apologies for the miscommunication. The command provided in the previous response indeed uses the MSVC compilers but not Intel compilers.

 

>>"Can you provide a way to use cmake with generator -G "Visual Studio 17 2022" instead of Ninja?"

The only CMake generator that supports oneAPI DPC++ Compiler on Windows is Ninja. 

If you want to use Intel oneAPI DPC++ compiler, then please follow the steps mentioned in the below link:

https://oneapi-src.github.io/oneDNN/dev_guide_build.html#id1

 

To use the Intel NextGen Compiler, could you please use the below command:

cmake -G "Visual Studio 17 2022" -T "Intel C++ Compiler 2022" ..

 

If this resolves your issue, make sure to accept this as a solution. This would help others with similar issues. Thank you! 

 

Best Regards,

Santosh

 

View solution in original post

0 Kudos
7 Replies
SantoshY_Intel
Moderator
1,646 Views

Hi,

 

Thank you for posting in Intel Communities.

 

Could you please use the below cmake command and let us know if it helps?

 

mkdir build && cd build
cmake -DCMAKE_CXX_COMPILER=dpcpp -GNinja ..

 

 

We tried at our end and we were able to build the application successfully as shown in the screenshot attached.

SantoshY_Intel_0-1662375584758.png

 

 

Thanks & Regards,

Santosh

 

0 Kudos
Kiefer_Kuah
Employee
1,629 Views

Thanks but it doesn't work. Can you provide a way to use cmake with generator -G "Visual Studio 17 2022" instead of Ninja?

cmake .. -G Ninja -DDNNL_CPU_RUNTIME=DPCPP
-- CMAKE_BUILD_TYPE is unset, defaulting to Release
CMake Error: CMake was unable to find a build program corresponding to "Ninja".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage

 

0 Kudos
SantoshY_Intel
Moderator
1,591 Views

Hi,

 

Could you please use the below exact command and let us know if it resolves your issue?

 

cmake .. -G "Visual Studio 17 2022" -DCMAKE_CXX_COMPILER=dpcpp -DCMAKE_BUILD_TYPE="Debug"

 

We tried at our end and it is working as expected. Please find the below screenshot.

Screenshot 2022-09-12 122307.png

 

Thanks,

Santosh

 

 

 

0 Kudos
Kiefer_Kuah
Employee
1,570 Views

We tried the command line you recommended and got the same output as you showed in your screenshot. However, how do you know that cmake has configured the project to use Intel Compiler? The screenshot you shared did not contain any reference to Intel Compiler? Thanks. 

0 Kudos
SantoshY_Intel
Moderator
1,553 Views

Hi,

 

Apologies for the miscommunication. The command provided in the previous response indeed uses the MSVC compilers but not Intel compilers.

 

>>"Can you provide a way to use cmake with generator -G "Visual Studio 17 2022" instead of Ninja?"

The only CMake generator that supports oneAPI DPC++ Compiler on Windows is Ninja. 

If you want to use Intel oneAPI DPC++ compiler, then please follow the steps mentioned in the below link:

https://oneapi-src.github.io/oneDNN/dev_guide_build.html#id1

 

To use the Intel NextGen Compiler, could you please use the below command:

cmake -G "Visual Studio 17 2022" -T "Intel C++ Compiler 2022" ..

 

If this resolves your issue, make sure to accept this as a solution. This would help others with similar issues. Thank you! 

 

Best Regards,

Santosh

 

0 Kudos
Kiefer_Kuah
Employee
1,487 Views

Can you update the links below which do not have documentation on "Intel C++ Compiler 2022". They only have documentation on previous Intel compilers? Thanks

oneDNN build documentation

Configuring CMake* and Microsoft Visual Studio* 2019 for Use with Intel Compilers

 

Is it possible to add Visual Studio as a cmake generator for oneAPI DPC++ compiler, like "Intel C++ Compiler 2022"? Visual Studio is not only a widely used compiler, but an IDE, debugger, profiler, etc. It's an indispensable tool. The project we're trying to add oneDNN and DPC++ code uses Visual Studio solution generated from cmake.

0 Kudos
SantoshY_Intel
Moderator
1,461 Views

Hi,


Thanks for accepting our solution.


Thank you for your feedback. We have provided your feedback to the relevant team. 


If you need any additional information, please post a new question as this thread will no longer be monitored by Intel. 


Thanks & Regards,

Santosh




0 Kudos
Reply