- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
EDIT: Apparently if we specify LANGUAGES CXX in project, cmake doesn't check for C compiler. So that issue is solved but it is still not taking dpcpp as a valid CXX compiler and throwing the error:
Building CXX object CMakeFiles/cmTC_7c364.dir/testCXXCompiler.cxx.obj
"C:/Program Files (x86)/Intel/oneAPI/compiler/latest/windows/bin/dpcpp.exe" /nologo -TP -Wno-sycl-strict /MDd /Zi /Ob0 /Od /RTC1 /FoCMakeFiles/cmTC_7c364.dir/testCXXCompiler.cxx.obj /FdCMakeFiles/cmTC_7c364.dir/ -c C:/Users/intel/Downloads/cudacode/dpct_repos/libSGM_OneAPI/build/CMakeFiles/CMakeTmp/testCXXCompiler.cxx
dpcpp: error: no such file or directory: 'C:/Program Files/Git/nologo'
dpcpp: error: no such file or directory: 'C:/Program Files/Git/MDd'
dpcpp: error: no such file or directory: 'C:/Program Files/Git/Zi'
dpcpp: error: no such file or directory: 'C:/Program Files/Git/Ob0'
dpcpp: error: no such file or directory: 'C:/Program Files/Git/Od'
dpcpp: error: no such file or directory: 'C:/Program Files/Git/RTC1'
dpcpp: error: no such file or directory: 'C:/Program Files/Git/FoCMakeFiles/cmTC_7c364.dir/testCXXCompiler.cxx.obj'
dpcpp: error: no such file or directory: 'C:/Program Files/Git/FdCMakeFiles/cmTC_7c364.dir/'
make.exe[1]: *** [CMakeFiles/cmTC_7c364.dir/testCXXCompiler.cxx.obj] Error 1
make.exe[1]: Leaving directory `C:/Users/intel/Downloads/cudacode/dpct_repos/libSGM_OneAPI/build/CMakeFiles/CMakeTmp'
make.exe: *** [cmTC_7c364/fast] Error 2
And I can't use clang++ as compiler as mentioned below.
--------------------------------------
tl;dr: how do I invoke cmake so that I can use dpcpp as c++ compiler on windows 10 (to generate Makefile)?
I am trying to build a library+test app (with gtest) however my issue is with CMAKE on windows 10.
It appears that with beta08, dpcpp interface has become more like MSVC compiler (switches starting with / instead of -).
If I use command
cmake -G "Unix Makefiles" -D CMAKE_CXX_COMPILER=dpcpp ..
It finds gcc as c compiler and complains that clang & msvc can't be mixed.
CMake Error at C:/Program Files/CMake/share/cmake-3.16/Modules/Platform/Windows-Clang.cmake:104 (message):
The current configuration mixes Clang and MSVC or some other CL compatible
compiler tool. This is not supported. Use either clang or MSVC as both C
and C++ compilers.
if I give command:
cmake -G "Unix Makefiles" -D CMAKE_C_COMPILER=cl -D CMAKE_CXX_COMPILER=clang++ ..
It finds MSVC 19.23.28106.4 as C compiler and fails to compiler test c program with errors like;
Building C object CMakeFiles/cmTC_bafff.dir/testCCompiler.c.obj
"C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.23.28105/bin/Hostx64/x64/cl.exe" /nologo /DWIN32 /D_WINDOWS /W3 /MDd /Zi /Ob0 /Od /RTC1 /FoCMakeFiles/cmTC_bafff.dir/testCCompiler.c.obj /FdCMakeFiles/cmTC_bafff.dir/ /FS -c C:/Users/intel/Downloads/cudacode/dpct_repos/libSGM_OneAPI/build/CMakeFiles/CMakeTmp/testCCompiler.c
Microsoft (R) C/C++ Optimizing Compiler Version 19.23.28106.4 for x64
Copyright (C) Microsoft Corporation. All rights reserved.
cl : Command line warning D9024 : unrecognized source file type 'C:/Program Files/Git/nologo', object file assumed
cl : Command line warning D9027 : source file 'C:/Program Files/Git/nologo' ignored
cl : Command line warning D9024 : unrecognized source file type 'C:/Program Files/Git/DWIN32', object file assumed
cl : Command line warning D9027 : source file 'C:/Program Files/Git/DWIN32' ignored
cl : Command line warning D9024 : unrecognized source file type 'C:/Program Files/Git/D_WINDOWS', object file assumed
cl : Command line warning D9027 : source file 'C:/Program Files/Git/D_WINDOWS' ignored
cl : Command line warning D9024 : unrecognized source file type 'C:/Program Files/Git/W3', object file assumed
cl : Command line warning D9027 : source file 'C:/Program Files/Git/W3' ignored
cl : Command line warning D9024 : unrecognized source file type 'C:/Program Files/Git/MDd', object file assumed
cl : Command line warning D9027 : source file 'C:/Program Files/Git/MDd' ignored
If I add following to CMakeLists.txt file
set(CMAKE_CXX_COMPILER "dpcpp")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-sycl-strict")
and give command
cmake -G "Unix Makefiles" ..
It again finds gcc and complains that Clang and MSVC can not be mixed (as in first case above)
If I use command (without adding dpcpp to CMakeLists.txt file)
cmake -G "Unix Makefiles" -D CMAKE_C_COMPILER=clang -D CMAKE_CXX_COMPILER=clang++ ..
It generates build files correctly but when I run make, it compiles my main source but gives following error (the source file is using dpct::device_vector so it includes dpct/dpstd_utils.hpp) for test case files:
[ 43%] Linking CXX static library sgm.lib
[ 43%] Built target sgm
Scanning dependencies of target gtest
[ 46%] Building CXX object test/googletest/googlemock/gtest/CMakeFiles/gtest.dir/src/gtest-all.cc.obj
[ 50%] Linking CXX static library gtestd.lib
[ 50%] Built target gtest
Scanning dependencies of target sgm-test
[ 53%] Building CXX object test/CMakeFiles/sgm-test.dir/census_transform_test.dp.cpp.obj
In file included from C:/Users/intel/Downloads/cudacode/dpct_repos/libSGM_OneAPI/test/census_transform_test.dp.cpp:3:
In file included from C:\Program Files (x86)\Intel\oneAPI\dpcpp-ct\latest\env\..\include\dpct/dpstd_utils.hpp:26:
In file included from C:\Program Files (x86)\Intel\oneAPI\compiler\latest\windows\include\dpstd/execution:49:
In file included from C:\Program Files (x86)\Intel\oneAPI\compiler\latest\windows\include\oneapi/dpl/pstl/glue_execution_defs.h:59:
In file included from C:\Program Files (x86)\Intel\oneAPI\compiler\latest\windows\include\oneapi/dpl/pstl/hetero/algorithm_impl_hetero.h:21:
In file included from C:\Program Files (x86)\Intel\oneAPI\compiler\latest\windows\include\oneapi/dpl/pstl/hetero/../parallel_backend.h:22:
In file included from C:\Program Files (x86)\Intel\oneAPI\compiler\latest\windows\include\oneapi/dpl/pstl/hetero/dpcpp/parallel_backend_sycl.h:27:
In file included from C:\Program Files (x86)\Intel\oneAPI\compiler\latest\windows\include\oneapi/dpl/pstl/hetero/dpcpp/../../iterator_impl.h:23:
In file included from C:\Program Files (x86)\Intel\oneAPI\compiler\latest\windows\include\oneapi/dpl/pstl/utils.h:31:
C:\Program Files (x86)\Intel\oneAPI\compiler\latest\windows\include\oneapi/dpl/pstl/hetero/dpcpp/sycl_iterator.h:178:59: error:
no template named 'mode_tag_t' in namespace 'cl::sycl'
sycl::mode_tag_t<Mode> tag)
~~~~~~^
C:\Program Files (x86)\Intel\oneAPI\compiler\latest\windows\include\oneapi/dpl/pstl/hetero/dpcpp/sycl_iterator.h:185:60: error:
no template named 'mode_tag_t' in namespace 'cl::sycl'
begin(sycl::buffer<T, /*dim=*/1, Allocator> buf, sycl::mode_tag_t<Mode> tag, sycl::property::noinit)
~~~~~~^
C:\Program Files (x86)\Intel\oneAPI\compiler\latest\windows\include\oneapi/dpl/pstl/hetero/dpcpp/sycl_iterator.h:185:98: error:
no type named 'noinit' in namespace 'cl::sycl::property'
begin(sycl::buffer<T, /*dim=*/1, Allocator> buf, sycl::mode_tag_t<Mode> tag, sycl::property::noinit)
~~~~~~~~~~~~~~~~^
C:\Program Files (x86)\Intel\oneAPI\compiler\latest\windows\include\oneapi/dpl/pstl/hetero/dpcpp/sycl_iterator.h:192:70: error:
no type named 'noinit' in namespace 'cl::sycl::property'
begin(sycl::buffer<T, /*dim=*/1, Allocator> buf, sycl::property::noinit)
~~~~~~~~~~~~~~~~^
C:\Program Files (x86)\Intel\oneAPI\compiler\latest\windows\include\oneapi/dpl/pstl/hetero/dpcpp/sycl_iterator.h:199:100: error:
no template named 'mode_tag_t' in namespace 'cl::sycl'
__internal::sycl_iterator<Mode, T, Allocator> end(sycl::buffer<T, /*dim=*/1, Allocator> buf, sycl::mode_tag_t<Mode> tag)
~~~~~~^
C:\Program Files (x86)\Intel\oneAPI\compiler\latest\windows\include\oneapi/dpl/pstl/hetero/dpcpp/sycl_iterator.h:206:58: error:
no template named 'mode_tag_t' in namespace 'cl::sycl'
end(sycl::buffer<T, /*dim=*/1, Allocator> buf, sycl::mode_tag_t<Mode> tag, sycl::property::noinit)
~~~~~~^
C:\Program Files (x86)\Intel\oneAPI\compiler\latest\windows\include\oneapi/dpl/pstl/hetero/dpcpp/sycl_iterator.h:206:96: error:
no type named 'noinit' in namespace 'cl::sycl::property'
end(sycl::buffer<T, /*dim=*/1, Allocator> buf, sycl::mode_tag_t<Mode> tag, sycl::property::noinit)
~~~~~~~~~~~~~~~~^
C:\Program Files (x86)\Intel\oneAPI\compiler\latest\windows\include\oneapi/dpl/pstl/hetero/dpcpp/sycl_iterator.h:213:94: error:
no type named 'noinit' in namespace 'cl::sycl::property'
sycl::property::noinit)
~~~~~~~~~~~~~~~~^
8 errors generated.
make[2]: *** [test/CMakeFiles/sgm-test.dir/census_transform_test.dp.cpp.obj] Error 1
make[1]: *** [test/CMakeFiles/sgm-test.dir/all] Error 2
make: *** [all] Error 2
I have tried to compile this file (census_transform_test.dp.cpp) as stand alone file with clang++ and I get same errors but not when i use dpcpp.
So my question is, how do I invoke cmake so that I can use dpcpp as c++ compiler on windows 10?
I want to generate make files and not visual studio solution.
I converted all the files from repo libSGM and now trying to build it along with tests so that I can validate the dpct generated cpp code. I can share the converted code if required.
Regards,
Gagan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Clang/clang++ cannot be used to compile source files containing dpct headers (even if you try to provide dpct headers with -I). DPC++ compiler driver is required to compile dpct codes.
To correctly generate Unix makefiles using CMake on Windows, follow these steps:
- Open "Intel oneAPI command prompt for Microsoft Visual Studio 2019". This step will place DPC++ and other compilers in path. (by sourcing the setvars.bat file)
- Make sure that you have the directory containing make.exe in your environment PATH.
- Change current directory to your application directory containing CMakeLists.txt.
mkdir build && cd build
cmake -G "Unix Makefiles" -D CMAKE_C_COMPILER=dpcpp-cl -D CMAKE_CXX_COMPILER=dpcpp-cl ..
You should be able to see the output as follows:
To generate VS-2019 project files/Solution files (.VCXproj/.sln) using Cmake, the command would be:
cmake -T"Intel(R) oneAPI DPC++ Compiler" ..
Let me know if you face any issues.
Regards,
Rahul
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Clang/clang++ cannot be used to compile source files containing dpct headers (even if you try to provide dpct headers with -I). DPC++ compiler driver is required to compile dpct codes.
To correctly generate Unix makefiles using CMake on Windows, follow these steps:
- Open "Intel oneAPI command prompt for Microsoft Visual Studio 2019". This step will place DPC++ and other compilers in path. (by sourcing the setvars.bat file)
- Make sure that you have the directory containing make.exe in your environment PATH.
- Change current directory to your application directory containing CMakeLists.txt.
mkdir build && cd build
cmake -G "Unix Makefiles" -D CMAKE_C_COMPILER=dpcpp-cl -D CMAKE_CXX_COMPILER=dpcpp-cl ..
You should be able to see the output as follows:
To generate VS-2019 project files/Solution files (.VCXproj/.sln) using Cmake, the command would be:
cmake -T"Intel(R) oneAPI DPC++ Compiler" ..
Let me know if you face any issues.
Regards,
Rahul
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Rahul,
Both methods are failing on windows 10.
Errors for Unix Makefiles option:
C:\Users\intel\Downloads\cudacode\dpct_repos\libSGM_OneAPI\build>cmake -G "Unix Makefiles" -D CMAKE_C_COMPILER=dpcpp-cl -D CMAKE_CXX_COMPILER=dpcpp-cl ..
-- The CXX compiler identification is Clang 11.0.0 with MSVC-like command-line
-- Check for working CXX compiler: C:/Program Files (x86)/Intel/oneAPI/compiler/latest/windows/bin/dpcpp-cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Intel/oneAPI/compiler/latest/windows/bin/dpcpp-cl.exe -- broken
CMake Error at C:/Program Files/CMake/share/cmake-3.16/Modules/CMakeTestCXXCompiler.cmake:53 (message):
The C++ compiler
"C:/Program Files (x86)/Intel/oneAPI/compiler/latest/windows/bin/dpcpp-cl.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/Users/intel/Downloads/cudacode/dpct_repos/libSGM_OneAPI/build/CMakeFiles/CMakeTmp
Run Build Command(s):C:/PROGRA~2/GnuWin32/bin/make.exe cmTC_b81e4/fast && C:/PROGRA~2/GnuWin32/bin/make.exe -f CMakeFiles/cmTC_b81e4.dir/build.make CMakeFiles/cmTC_b81e4.dir/build
make.exe[1]: Entering directory `C:/Users/intel/Downloads/cudacode/dpct_repos/libSGM_OneAPI/build/CMakeFiles/CMakeTmp'
Building CXX object CMakeFiles/cmTC_b81e4.dir/testCXXCompiler.cxx.obj
"C:/Program Files (x86)/Intel/oneAPI/compiler/latest/windows/bin/dpcpp-cl.exe" /nologo -TP /DWIN32 /D_WINDOWS /W3 /GR /EHsc /MDd /Zi /Ob0 /Od /RTC1 /FoCMakeFiles/cmTC_b81e4.dir/testCXXCompiler.cxx.obj /FdCMakeFiles/cmTC_b81e4.dir/ -c C:/Users/intel/Downloads/cudacode/dpct_repos/libSGM_OneAPI/build/CMakeFiles/CMakeTmp/testCXXCompiler.cxx
dpcpp: error: no such file or directory: 'C:/Program Files/Git/nologo'
dpcpp: error: no such file or directory: 'C:/Program Files/Git/DWIN32'
dpcpp: error: no such file or directory: 'C:/Program Files/Git/D_WINDOWS'
dpcpp: error: no such file or directory: 'C:/Program Files/Git/W3'
dpcpp: error: no such file or directory: 'C:/Program Files/Git/GR'
dpcpp: error: no such file or directory: 'C:/Program Files/Git/EHsc'
dpcpp: error: no such file or directory: 'C:/Program Files/Git/MDd'
dpcpp: error: no such file or directory: 'C:/Program Files/Git/Zi'
dpcpp: error: no such file or directory: 'C:/Program Files/Git/Ob0'
dpcpp: error: no such file or directory: 'C:/Program Files/Git/Od'
dpcpp: error: no such file or directory: 'C:/Program Files/Git/RTC1'
dpcpp: error: no such file or directory: 'C:/Program Files/Git/FoCMakeFiles/cmTC_b81e4.dir/testCXXCompiler.cxx.obj'
dpcpp: error: no such file or directory: 'C:/Program Files/Git/FdCMakeFiles/cmTC_b81e4.dir/'
make.exe[1]: *** [CMakeFiles/cmTC_b81e4.dir/testCXXCompiler.cxx.obj] Error 1
make.exe[1]: Leaving directory `C:/Users/intel/Downloads/cudacode/dpct_repos/libSGM_OneAPI/build/CMakeFiles/CMakeTmp'
make.exe: *** [cmTC_b81e4/fast] Error 2
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:26 (project)
-- Configuring incomplete, errors occurred!
See also "C:/Users/intel/Downloads/cudacode/dpct_repos/libSGM_OneAPI/build/CMakeFiles/CMakeOutput.log".
See also "C:/Users/intel/Downloads/cudacode/dpct_repos/libSGM_OneAPI/build/CMakeFiles/CMakeError.log".
And for Inntel DPC++ Compiler option:
C:\Users\intel\Downloads\cudacode\dpct_repos\libSGM_OneAPI\build>cmake -T"Intel(R) oneAPI DPC++ Compiler" ..
-- Building for: Visual Studio 16 2019
-- Selecting Windows SDK version 10.0.18362.0 to target Windows 10.0.18363.
-- The CXX compiler identification is Clang 11.0.0 with MSVC-like command-line
CMake Error at CMakeLists.txt:26 (project):
No CMAKE_CXX_COMPILER could be found.
-- Configuring incomplete, errors occurred!
See also "C:/Users/intel/Downloads/cudacode/dpct_repos/libSGM_OneAPI/build/CMakeFiles/CMakeOutput.log".
I'm not sure what am I missing.
Regards,
Gagan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Could you attach your CMakeLists.txt file if possible?
I have tried to generate Unix Makefiles on sepia-filter official sample with CMake version 3.17. It seems to work for me with the steps that I had given earlier.
Let me know if you are able to generate Unix Makefiles for this application with the steps that I had provided earlier.
Thanks,
Rahul
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Just a quick reminder to attach your CMakeLists.txt file.
Thanks,
Rahul
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sorry for the delay.
CMakeFiles.are attached.
It is building fine on linux but not on windows.
Regards,
Gagan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I don't see any issue with your CMakelists file.
Could you also try building the Github sample which I had sent earlier on Windows and see if that works?
Alternatively, you may try upgrading your CMake to the latest version and see if it helps.
Thanks,
Rahul
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Any updates on this? Did the CMakeLists file from the official sample work for you?
Thanks,
Rahul
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Rahul,
Sorry for the delay. I tried it on linux and it worked fine
Now I have updated CMAKE on windows to CMAKE version 3.18.2 and it is working as expecting and generating Makefiles properly for my project libSGM_OneAPI.
Though cmake _T"..." option is still not working on windows. But its okay. I'm not stuck anymore.
Just for reference, error I get is - "No CMAKE_CXX_COMPILER could be found"
Thanks for your support.
Regards,
Gagan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Gagan,
Good to know that it worked.
There could be an integration issue with your VS-19, leading to errors with "cmake -T" while generating VS project files. Running the installation in repair mode could help.
Also, let me know if I can close this thread from my end.
Thanks,
Rahul
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Intel will no longer monitor this thread. However, this thread will remain open for community discussion.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The 2022.0.1 release of the compiler provides the following support for CMake:
set(IntelDPCPP_DIR /opt/intel/oneapi/compiler/latest/linux/IntelDPCPP)
find_package(IntelDPCPP REQUIRED)
Its usage is documented in:
/opt/intel/oneapi/compiler/2022.0.1/linux/IntelDPCPP/ReadMe.txt .
It will enable the dpcpp compiler via the icx[/icpx] compilers and appropriate compiler flags to enable DPCPP compiler through icx[/icpx] binaries .
The flags appear to be "--dpcpp -fsycl". icx and icpx are the same binary and probably use argv[0] to figure out the correct compiler driver to call (along with --dpcpp ).
The dpcpp compiler will reliably fail the C++ tests.
Note that "icx --dpcpp -help -v" and "dpcpp -help -v" generate identical output (but not much different from "icx -help -v".
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page