Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
158 Views

_DEBUG issues.

Jump to solution
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

Accepted Solutions
Highlighted
Moderator
139 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

0 Kudos
4 Replies
Highlighted
Moderator
140 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

0 Kudos
Highlighted
Beginner
132 Views

Thanks.

0 Kudos
Highlighted
Beginner
76 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.

 

0 Kudos
Highlighted
50 Views

Hi,


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


0 Kudos