openmp offloading feature throws error "Intel Compiler compatibility mode was disabled" - openmp

I try to make use of the openmp offloading feature. Unfortunatley I get some strange error messages when I try to compile. (Windows 10)
Here are the command line options I use:
/Yu"stdafx.h" /GS /fsycl /Qiopenmp /W3/fsycl-targets=spir64_gen-unknown-unknown-sycldevice /Zi /O2 /Qopenmp-targets:spir64/Qipo /Zc:forScope /MD /std:c++17 /Fa"x64\Release" /EHsc /nologo /Fo"x64\Release" //fprofile-instr-use "x64\Release" /Fp"x64\Release\AlgoGPU.pch"
I remove the /I and /D
This is what I get during compilation:
error: Enables or disables Intel Compiler compatibility mode was enabled in PCH file but is currently disabled
error: PCH file was compiled for the target 'x86_64-pc-windows-msvc19.28.29914' but the current translation unit is being compiled for target 'spir64_gen-unknown-unknown-sycldevice'
2 errors generated.
C:\Program Files(x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Platforms\x64\PlatformToolsets\Intel C++ Compiler 2021\Toolset.targets(199,5): error MSB6006: "icx.exe" exited with code 1.
Does anyone know what I'm doing wrong?

I tried the below command line option with oneAPI DPC++/ icx compilers
-fsycl -fsycl-targets=spir64_gen-unknown-unknown-sycldevice /std:c++17 /O2 /Zc:forScope /MD /Qiopenmp /Qopenmp-targets=spir64

Related

Assembly Programs Not Compiling in x86 Build Visual Studio

so I'm trying to learn MASM, and I've looked online but I can't get it to compile in an x86 Build. I have a simple .asm file that just has
end
then a c file with main.
When I set VS with a x64 Build it compiles successfully with ml64; however, when I use x86 I get:
1>C:\Program Files (x86)\Microsoft Visual
Studio\2017\Community\Common7\IDE\VC\VCTargets\BuildCustomizations\masm.targets(50,5):
error MSB3721: The command "ml.exe /c /nologo /Zi /Fo"Debug\test.obj"
/W3 /errorReport:prompt /Tatest.asm" exited with code 1.

Error: Installation of opencv (CUDA support) in windows :cmake compile error windows10 VS2015 cl.exe --broken LNK1104 cannot open program.obj

I’ve been trying to install OPENCV 2.4.13.6 into a GPU-equipped Windows10 machine (CUDA9.0, VS2015, cmake3.10.0 have already been installed).
Though trying to install the opencv 2.4 by referring to https://jamesbowley.co.uk/build-compile-opencv-3-4-in-windows-with-cuda-9-0-and-intel-mkl-tbb/, I got following error.
Error message:
The CXX compiler identification is MSVC 19.0.24215.1
The C compiler identification is MSVC 19.0.24215.1
Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe
Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe -- broken
CMake Error at share/cmake-3.10/Modules/CMakeTestCXXCompiler.cmake:45 (message):
The C++ compiler
"C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/opencv/opencv-2.4.13.6/built/CMakeFiles/CMakeTmp
Run Build Command:"C:/Program Files (x86)/MSBuild/14.0/bin/MSBuild.exe" "cmTC_678c6.vcxproj" "/p:Configuration=Debug" "/p:VisualStudioVersion=14.0"
Microsoft (R) Build Engine version 14.0.25420.1
Copyright (C) Microsoft Corporation. All rights reserved.
Build started 2018/10/28 21:46:10.
Project "C:\opencv\opencv-2.4.13.6\built\CMakeFiles\CMakeTmp\cmTC_678c6.vcxproj" on node 1 (default targets).
PrepareForBuild:
Creating directory "cmTC_678c6.dir\Debug\".
Creating directory "C:\opencv\opencv-2.4.13.6\built\CMakeFiles\CMakeTmp\Debug\".
Creating directory "cmTC_678c6.dir\Debug\cmTC_678c6.tlog\".
InitializeBuildStatus:
Creating "cmTC_678c6.dir\Debug\cmTC_678c6.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
ClCompile:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64\CL.exe /c /Zi /W3 /WX- /Od /Ob0 /D WIN32 /D _WINDOWS /D "CMAKE_INTDIR=\"Debug\"" /D _MBCS /Gm- /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /GR /Fo"cmTC_678c6.dir\Debug\\" /Fd"cmTC_678c6.dir\Debug\vc140.pdb" /Gd /TP /errorReport:queue "C:\opencv\opencv-2.4.13.6\built\CMakeFiles\CMakeTmp\testCXXCompiler.cxx"
Microsoft (R) C/C++ Optimizing Compiler Version 19.00.24215.1 for x64
Copyright (C) Microsoft Corporation. All rights reserved.
cl /c /Zi /W3 /WX- /Od /Ob0 /D WIN32 /D _WINDOWS /D "CMAKE_INTDIR=\"Debug\"" /D _MBCS /Gm- /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /GR /Fo"cmTC_678c6.dir\Debug\\" /Fd"cmTC_678c6.dir\Debug\vc140.pdb" /Gd /TP /errorReport:queue "C:\opencv\opencv-2.4.13.6\built\CMakeFiles\CMakeTmp\testCXXCompiler.cxx"
testCXXCompiler.cxx
Link:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64\link.exe /ERRORREPORT:QUEUE /OUT:"C:\opencv\opencv-2.4.13.6\built\CMakeFiles\CMakeTmp\Debug\cmTC_678c6.exe" /INCREMENTAL /NOLOGO kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /manifest:embed /DEBUG /PDB:"C:/opencv/opencv-2.4.13.6/built/CMakeFiles/CMakeTmp/Debug/cmTC_678c6.pdb" /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"C:/opencv/opencv-2.4.13.6/built/CMakeFiles/CMakeTmp/Debug/cmTC_678c6.lib" /MACHINE:X64 /machine:x64 C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\lib cmTC_678c6.dir\Debug\testCXXCompiler.obj
LINK : fatal error LNK1104: cannot open file 'C:\Program.obj' [C:\opencv\opencv-2.4.13.6\built\CMakeFiles\CMakeTmp\cmTC_678c6.vcxproj]
Done Building Project "C:\opencv\opencv-2.4.13.6\built\CMakeFiles\CMakeTmp\cmTC_678c6.vcxproj" (default targets) -- FAILED.
Build FAILED.
"C:\opencv\opencv-2.4.13.6\built\CMakeFiles\CMakeTmp\cmTC_678c6.vcxproj" (default target) (1) ->
(Link target) ->
LINK : fatal error LNK1104: cannot open file 'C:\Program.obj' [C:\opencv\opencv-2.4.13.6\built\CMakeFiles\CMakeTmp\cmTC_678c6.vcxproj]
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:00.42
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:64 (project)
Configuring incomplete, errors occurred!
See also "C:/opencv/opencv-2.4.13.6/built/CMakeFiles/CMakeOutput.log".
See also "C:/opencv/opencv-2.4.13.6/built/CMakeFiles/CMakeError.log".
Though I've been trying to fix this error referring to below URLs for a week, those solution on the URLs did not work with me.
CMake configuring fails. "cl.exe is not able to compile a simple test program"
Why does fatal error "LNK1104: cannot open file 'C:\Program.obj'" occur when I compile a C++ project in Visual Studio?
I would sincerely appreciate for your kind instruction to solve this issue.

How to ensure that the /EDITANDCONTINUE directive is not ignored

I get this message when I try to edit and continue in VSC15:
'file.cpp' in 'LIB.DLL' was not linked with Edit and Continue enabled.
Ensure that /INCREMENTAL linking is enabled, and the /EDITANDCONTINUE directive is not ignored.
I've already ensured that /INCREMENTAL is enabled but can't figure out the second part.
Compiler command line:
/Yu"stdfx.h" /GS /analyze- /W3 /Gy /Zc:wchar_t /ZI /Gm- /Od /Fd".\Debug\vc140.pdb" /Zc:inline /fp:fast /D "x86" /D "WIN32" /D "_WINDOWS" /D "DEBUG" /D "_UNICODE" /D "UNICODE" /D "_WINDLL" /errorReport:none /WX- /Zc:forScope /RTC1 /GR /Gd /Oy- /MTd /Fa".\Debug\" /EHsc /Fo".\Debug\" /Fp".\Debug\LIB.pch"
Linker command line:
/OUT:".\Debug\LIB.dll" /MANIFEST:NO /NXCOMPAT /PDB:".\Debug\LIB.pdb" /DYNAMICBASE /DEF:"EXPORT.DEF" /IMPLIB:".\Debug\LIB.lib" /DLL /MACHINE:X86 /NODEFAULTLIB:"libc.lib" /OPT:REF /SAFESEH /INCREMENTAL /PGD:".\Debug\LIB.pgd" /SUBSYSTEM:WINDOWS /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /ManifestFile:".\Debug\LIB.dll.intermediate.manifest" /MAP /OPT:ICF
Looking at the command lines:
Compiler command line: Edit and Continue isn't really compatible with /Gm-, it requires "Enable Minimal Rebuild" (/Gm).
Linker command line: /OPT:REF, /SAFESEH, /OPT:ICF are all incompatible with Edit and Continue and should cause LNK4075.
If you try a clean build of LIB.dll, you should see warnings such as:
1>LINK : warning LNK4075: ignoring '/INCREMENTAL' due to '/OPT:REF' specification
1>ConsoleApplication1.obj : warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/OPT:ICF' specification
Try turning off SAFESEH on the advanced page of the linker settings.
/SAFESEH:NO
The complete official answer for vs2015 case is here https://blogs.msdn.microsoft.com/vcblog/2016/07/01/c-edit-and-continue-in-visual-studio-2015-update-3/ Also it may be helpful to read this one https://blogs.msdn.microsoft.com/vcblog/2013/10/29/the-visual-c-linker-best-practices-developer-iteration/
As for my case I haven't seen any uncompatible flags in linking command line, and it turned out that
/LTCG
is turned on by default, so I had to turn it of manually with additional linker option in every project of my solution
/LTCG:OFF
I had the same problem, did all steps described above but no luck.
I use VS2017.
Helped next: you have to specify /ZI for each specific *.cpp file in your project:
right click on the *.cpp file in the Solution Explorer
Properties > C/C++ > General > Debug Information Format = Program Database for Edit And Continue (/ZI)

CMake fails to configure

Why isn't CMake working?
CMake build message:
The C compiler identification is MSVC 16.0.30319.1
Check for working C compiler using: Visual Studio 10 2010
Check for working C compiler using: Visual Studio 10 2010 -- broken
CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.4/Modules/CMakeTestCCompiler.cmake:61 (message):
The C compiler "C:/Program Files (x86)/Microsoft Visual Studio
10.0/VC/bin/cl.exe" is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/Users/theWindows7User/Desktop/glfw-3.1.2/CMakeFiles/CMakeTmp
Run Build
Command:"C:/Windows/Microsoft.NET/Framework/v4.0.30319/MSBuild.exe"
"cmTC_318a4.vcxproj" "/p:Configuration=Debug" "/p:VisualStudioVersion=10.0"
Microsoft (R) Build Engine version 4.0.30319.34209
[Microsoft .NET Framework, version 4.0.30319.34209]
Copyright (C) Microsoft Corporation. All rights reserved.
Build started 01-Jan-2016, Friday 6:35:52 AM.
Project
"C:\Users\theWindows7User\Desktop\glfw-3.1.2\CMakeFiles\CMakeTmp\cmTC_318a4.vcxproj"
on node 1 (default targets).
PrepareForBuild:
Creating directory "cmTC_318a4.dir\Debug\".
Creating directory "C:\Users\theWindows7User\Desktop\glfw-3.1.2\CMakeFiles\CMakeTmp\Debug\".
InitializeBuildStatus:
Creating "cmTC_318a4.dir\Debug\cmTC_318a4.unsuccessfulbuild" because "AlwaysCreate" was specified.
ClCompile:
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\CL.exe /c /Zi /W3 /WX- /Od /Ob0 /Oy- /D WIN32 /D _WINDOWS /D _DEBUG /D "CMAKE_INTDIR=\"Debug\"" /D _MBCS /Gm- /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Fo"cmTC_318a4.dir\Debug\\" /Fd"cmTC_318a4.dir\Debug\vc100.pdb" /Gd /TC /analyze- /errorReport:queue testCCompiler.c
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.30319.01 for 80x86
Copyright (C) Microsoft Corporation. All rights reserved.
cl /c /Zi /W3 /WX- /Od /Ob0 /Oy- /D WIN32 /D _WINDOWS /D _DEBUG /D "CMAKE_INTDIR=\"Debug\"" /D _MBCS /Gm- /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Fo"cmTC_318a4.dir\Debug\\" /Fd"cmTC_318a4.dir\Debug\vc100.pdb" /Gd /TC /analyze- /errorReport:queue testCCompiler.c
testCCompiler.c
ManifestResourceCompile:
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\rc.exe /nologo /fo"cmTC_318a4.dir\Debug\cmTC_318a4.exe.embed.manifest.res" cmTC_318a4.dir\Debug\cmTC_318a4_manifest.rc
Link:
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\link.exe /ERRORREPORT:QUEUE /OUT:"C:\Users\theWindows7User\Desktop\glfw-3.1.2\CMakeFiles\CMakeTmp\Debug\cmTC_318a4.exe" /INCREMENTAL /NOLOGO kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /ManifestFile:"cmTC_318a4.dir\Debug\cmTC_318a4.exe.intermediate.manifest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG /PDB:"C:/Users/theWindows7User/Desktop/glfw-3.1.2/CMakeFiles/CMakeTmp/Debug/cmTC_318a4.pdb" /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"C:/Users/theWindows7User/Desktop/glfw-3.1.2/CMakeFiles/CMakeTmp/Debug/cmTC_318a4.lib" /MACHINE:X86 cmTC_318a4.dir\Debug\cmTC_318a4.exe.embed.manifest.res
cmTC_318a4.dir\Debug\testCCompiler.obj /machine:X86 /debug
LINK : fatal error LNK1123: failure during conversion to COFF: file invalid
or corrupt
[C:\Users\theWindows7User\Desktop\glfw-3.1.2\CMakeFiles\CMakeTmp\cmTC_318a4.vcxproj]
Done Building Project
"C:\Users\theWindows7User\Desktop\glfw-3.1.2\CMakeFiles\CMakeTmp\cmTC_318a4.vcxproj"
(default targets) -- FAILED.
Build FAILED.
"C:\Users\theWindows7User\Desktop\glfw-3.1.2\CMakeFiles\CMakeTmp\cmTC_318a4.vcxproj"
(default target) (1) ->
(Link target) ->
LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt [C:\Users\theWindows7User\Desktop\glfw-3.1.2\CMakeFiles\CMakeTmp\cmTC_318a4.vcxproj]
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:00.43
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:1 (project)
Configuring incomplete, errors occurred!
See also "C:/Users/theWindows7User/Desktop/glfw-3.1.2/CMakeFiles/CMakeOutput.log".
See also "C:/Users/theWindows7User/Desktop/glfw-3.1.2/CMakeFiles/CMakeError.log".
LINK : fatal error LNK1123: failure during conversion to COFF: file invalid
It's a classic Visual Studio issue. You have to install the service pack to fix it. See here: https://msdn.microsoft.com/en-us/library/7dz62kfh%28v=vs.110%29.aspx

wxWidgets (static lib) will not link under VC++ 2010

I cannot get a wxWidgets program that uses the wxWidgets static libraries to compile and link properly under VC++ 2010. Under VC++ 2008, it's fine. (WxWidgets still ships with vc++ 2008 project files.)
I compiled and ran the "minimal" sample program that comes with wxWidgets. It is a GUI hello world. No problem. I used VC++ 2010 to convert the .vsproj to .vsxproj and attempt to compile and link under VC++ 2010. Problem.
Be assured that I changed absolutely nothing other than to run the VC++ 2010 conversion to create minimal.vsxproj.
I got many linker warnings and errors, all having to do with STL wchar_t strings in the wxWidgets libs. Here is what I think is happening. I believe there must be #ifdefs in the wxWidgets code that select __declspec(import) or not, based on preprocessor symbols. When VC++ 2010 converted the project, it must have changed the symbols to something that fools wxWidgets. If so, the bug could be in either place, either wxWidgets is making invalid assumptions about pre-processor definitions, or the VC++ 2010 conversion messed them up.
The command lines for compiling the lone .cpp file in the project differ more than I would expect them to.
2008 command line
/Od /I ".....\lib\vc_lib\mswud" /I ".....\include" /I "." /I
".....\samples" /D "WIN32" /D "_DEBUG" /D
"_CRT_SECURE_NO_DEPRECATE=1" /D "_CRT_NON_CONFORMING_SWPRINTFS=1" /D
"_SCL_SECURE_NO_WARNINGS=1" /D "WXMSW" /D "_UNICODE" /D "_WINDOWS"
/D "NOPCH" /D "UNICODE" /FD /EHsc /RTC1 /MDd /Fo"vc_mswud\minimal\"
/Fd"vc_mswud\minimal.pdb" /W4 /nologo /c /Zi /TP /errorReport:prompt
/MP
2010 command line
/I".....\lib\vc_lib\mswud" /I".....\include" /I"."
/I".....\samples" /Zi /nologo /W4 /WX- /Od /Oy- /D "WIN32" /D
"_DEBUG" /D "_CRT_SECURE_NO_DEPRECATE=1" /D
"_CRT_NON_CONFORMING_SWPRINTFS=1" /D "_SCL_SECURE_NO_WARNINGS=1" /D
"WXMSW" /D "_UNICODE" /D "_WINDOWS" /D "NOPCH" /Gm- /EHsc /RTC1
/MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /GR
/Fp"vc_mswud\minimal\minimal.pch" /Fa"vc_mswud\minimal\"
/Fo"vc_mswud\minimal\" /Fd"vc_mswud\minimal.pdb" /Gd /analyze-
/errorReport:queue
Example 2010 warning and error
1>wxbase29ud.lib(ipcbase.obj) : warning LNK4049: locally defined symbol ??1?$basic_string#_WU?$char_traits#_W#std##V?$allocator#_W#2##std##QAE#XZ (public: __thiscall std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> >::~basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> >(void)) imported
1>wxbase29ud.lib(mimecmn.obj) : error LNK2001: unresolved external symbol "__declspec(dllimport) public: class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > & __thiscall std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> >::assign(class std::_String_const_iterator<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> >,class std::_String_const_iterator<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> >)" (__imp_?assign#?$basic_string#_WU?$char_traits#_W#std##V?$allocator#_W#2##std##QAEAAV12#V?$_String_const_iterator#_WU?$char_traits#_W#std##V?$allocator#_W#2##2#0#Z)
You absolutely must build wxWidgets and the application using it with the same version of the compiler, different MSVC versions use different, incompatible versions of the CRT and so there is no chance at all that you can use VC10 to build an application and link it with wxWidgets built with VC9.
As for building wx itself with VC10, there are indeed sometimes some problems when importing VC9 projects, the custom build rules can somehow be mangled. If this happens to you (although AFAIK nobody reported it for wx 2.9.4 project files yet), just copy the custom build rules for setup.h manually or simply execute them yourself manually.
FWIW we hope to have "native" VC10 and VC11 projects in 3.0 release (coming soon).

Resources