Intel® oneAPI Data Parallel C++
Support for Intel® oneAPI DPC++ Compiler, Intel® oneAPI DPC++ Library, Intel® DPC++ Compatibility Tool, and GDB*
Announcements
Welcome to the Intel Community. If you get an answer you like, please mark it as an Accepted Solution to help others. Thank you!

_DEBUG issues.

ChoonHo
Beginner
602 Views
OS

Windows 10

IDE

Visual Studio 19

Compiler

Intel(R) oneAPI DPC++ compiler

Toolkit

oneAPI Base Toolkit version 2021.1-beta09

Problem

By default, the toolkit doesn't define _DEBUG macro in debug mode. However, upon defining it, the linker will fail due to missing debug CRT symbols.

I can bypass this by using /MDd or /MTd as a command line argument. However, this would lead to erroneous SYCL runtime probably due to ABI issues with mismatching CRTs.

I can force the linker to link against sycld.lib and everything would work just fine.

I believe this is a tooling bug in debug mode.

0 Kudos
1 Solution
AbhishekD_Intel
Moderator
583 Views

Hi,


Thanks for reaching out to us.

I tried the way you have described and yes you are right by default toolkit doesn't define _DEBUG micro.

And one thing I wanted you to suggest that when you define _DEBUG as 1 we have to set /LDd, /MDd, or /MTd compiler options. Otherwise, it will be undefined.

But when I tried enabling DEBUG feature I was able to compile the project but was failing at run time and when I give the sycld.lib path at the linking stage it was executing with correct results.


I can very much able to reproduce your issue and I also feel that it's a bug. So I am forwarding this issue to the concerned team.

Thank you for posting it to us.



Warm Regards,

Abhishek


View solution in original post

4 Replies
AbhishekD_Intel
Moderator
584 Views

Hi,


Thanks for reaching out to us.

I tried the way you have described and yes you are right by default toolkit doesn't define _DEBUG micro.

And one thing I wanted you to suggest that when you define _DEBUG as 1 we have to set /LDd, /MDd, or /MTd compiler options. Otherwise, it will be undefined.

But when I tried enabling DEBUG feature I was able to compile the project but was failing at run time and when I give the sycld.lib path at the linking stage it was executing with correct results.


I can very much able to reproduce your issue and I also feel that it's a bug. So I am forwarding this issue to the concerned team.

Thank you for posting it to us.



Warm Regards,

Abhishek


View solution in original post

ChoonHo
Beginner
576 Views
ChoonHo
Beginner
520 Views

Update for beta10.

Properly links to sycld.lib when _DEBUG is defined.

However, I still have to specify to use a debug version of the runtime library /MDd or /MTd as a compiler argument.

 

Sravani_K_Intel
Moderator
494 Views

Hi,


Yes, using /MDd should set everything you need, that's the expected behavior.


Reply