When compiling a very simple program with Clang++, vanilla version 16 (not intel version), I get warnings that do not arise when compiling with the dpcpp compiler. I am concerned since I have no way to know if the warnings will mean that my code will be malfunctioning in some way at runtime.
This minimal code generates some warnings about interop_handler being deprecated:
#include <CL/sycl.hpp>
int main(){}
The command issued is the following, where INCLUDEDIR is used to indicate where the SYCL headers are:
clang++ -std=c++17 -I$INCLUDEDIR -c t.cpp
The warnings are:
In file included from t.cpp:1:
In file included from /ONE_API_2022.3/compiler/2022.2.0/linux/include/sycl/CL/sycl.hpp:16:
In file included from /ONE_API_2022.3/compiler/2022.2.0/linux/include/sycl/CL/sycl/backend.hpp:18:
In file included from /ONE_API_2022.3/compiler/2022.2.0/linux/include/sycl/CL/sycl/detail/backend_traits_opencl.hpp:26:
In file included from /ONE_API_2022.3/compiler/2022.2.0/linux/include/sycl/CL/sycl/queue.hpp:20:
In file included from /ONE_API_2022.3/compiler/2022.2.0/linux/include/sycl/CL/sycl/handler.hpp:14:
In file included from /ONE_API_2022.3/compiler/2022.2.0/linux/include/sycl/CL/sycl/detail/cg.hpp:27:
/ONE_API_2022.3/compiler/2022.2.0/linux/include/sycl/CL/sycl/detail/cg_types.hpp:234:32: warning: 'interop_handler' is deprecated: interop_handler class is deprecated, use interop_handle instead with host-task [-Wdeprecated-declarations]
std::function<void(cl::sycl::interop_handler)> MFunc;
^
/ONE_API_2022.3/compiler/2022.2.0/linux/include/sycl/CL/sycl/interop_handler.hpp:18:7: note: 'interop_handler' has been explicitly marked deprecated here
class __SYCL_DEPRECATED("interop_handler class is deprecated, use"
^
/ONE_API_2022.3/compiler/2022.2.0/linux/include/sycl/CL/sycl/detail/defines_elementary.hpp:45:38: note: expanded from macro '__SYCL_DEPRECATED'
#define __SYCL_DEPRECATED(message) [[deprecated(message)]]
^
In file included from t.cpp:1:
In file included from /ONE_API_2022.3/compiler/2022.2.0/linux/include/sycl/CL/sycl.hpp:16:
In file included from /ONE_API_2022.3/compiler/2022.2.0/linux/include/sycl/CL/sycl/backend.hpp:18:
In file included from /ONE_API_2022.3/compiler/2022.2.0/linux/include/sycl/CL/sycl/detail/backend_traits_opencl.hpp:26:
In file included from /ONE_API_2022.3/compiler/2022.2.0/linux/include/sycl/CL/sycl/queue.hpp:20:
In file included from /ONE_API_2022.3/compiler/2022.2.0/linux/include/sycl/CL/sycl/handler.hpp:14:
In file included from /ONE_API_2022.3/compiler/2022.2.0/linux/include/sycl/CL/sycl/detail/cg.hpp:27:
/ONE_API_2022.3/compiler/2022.2.0/linux/include/sycl/CL/sycl/detail/cg_types.hpp:237:44: warning: 'interop_handler' is deprecated: interop_handler class is deprecated, use interop_handle instead with host-task [-Wdeprecated-declarations]
InteropTask(std::function<void(cl::sycl::interop_handler)> Func)
^
/ONE_API_2022.3/compiler/2022.2.0/linux/include/sycl/CL/sycl/interop_handler.hpp:18:7: note: 'interop_handler' has been explicitly marked deprecated here
class __SYCL_DEPRECATED("interop_handler class is deprecated, use"
^
/ONE_API_2022.3/compiler/2022.2.0/linux/include/sycl/CL/sycl/detail/defines_elementary.hpp:45:38: note: expanded from macro '__SYCL_DEPRECATED'
#define __SYCL_DEPRECATED(message) [[deprecated(message)]]
^
In file included from t.cpp:1:
In file included from /ONE_API_2022.3/compiler/2022.2.0/linux/include/sycl/CL/sycl.hpp:16:
In file included from /ONE_API_2022.3/compiler/2022.2.0/linux/include/sycl/CL/sycl/backend.hpp:18:
In file included from /ONE_API_2022.3/compiler/2022.2.0/linux/include/sycl/CL/sycl/detail/backend_traits_opencl.hpp:26:
In file included from /ONE_API_2022.3/compiler/2022.2.0/linux/include/sycl/CL/sycl/queue.hpp:20:
In file included from /ONE_API_2022.3/compiler/2022.2.0/linux/include/sycl/CL/sycl/handler.hpp:14:
In file included from /ONE_API_2022.3/compiler/2022.2.0/linux/include/sycl/CL/sycl/detail/cg.hpp:27:
/ONE_API_2022.3/compiler/2022.2.0/linux/include/sycl/CL/sycl/detail/cg_types.hpp:239:23: warning: 'interop_handler' is deprecated: interop_handler class is deprecated, use interop_handle instead with host-task [-Wdeprecated-declarations]
void call(cl::sycl::interop_handler &h) { MFunc(h); }
^
/ONE_API_2022.3/compiler/2022.2.0/linux/include/sycl/CL/sycl/interop_handler.hpp:18:7: note: 'interop_handler' has been explicitly marked deprecated here
class __SYCL_DEPRECATED("interop_handler class is deprecated, use"
^
/ONE_API_2022.3/compiler/2022.2.0/linux/include/sycl/CL/sycl/detail/defines_elementary.hpp:45:38: note: expanded from macro '__SYCL_DEPRECATED'
#define __SYCL_DEPRECATED(message) [[deprecated(message)]]
^
3 warnings generated.
As said, this happens with a minimal example; with more complicated SYCL code there would be more warnings. I want to know if I should be concerned and if there is some way to solve the warnings.
When you copy /ONE_API_2022.3/compiler/2022.2.0/linux/include/ into local directory and invoke dpcpp with these includes copied includes
dpcpp -Iinclude/sycl/ -Iinclude -c t.cpp
then you'll also see a lot of deprecation warnings.
dpcpp does some magic so you don't have to specify -I manually when calling dpcpp. I guess the same magic silences deprecation warning from these automatically included files.
You cannot compile a SYCL program with clang like that.
In order to compile a SYCL program you will need:
A working SYCL compiler (i.e. openSYCL, oneAPI DPC++)
Or a library implementation of the SYCL standard to link your program against (but I don't know if such implementation exists).
You can check the available SYCL implementation here
Related
We have migrated our iOS project to Swift 3 and Xcode 8. Since then the debugger can not show any value of variables. If I try to print a variable:
p someVar
I get this error message. SchemaManager.h is a bridging header. (The actual project name has been replaced with yyy below):
warning: Swift error in module yyy.
Debug info from this module will be unavailable in the debugger.
error: in auto-import:
failed to get module 'yyy' from AST context:
/Users/xxx/Documents/yyy/yyy/Common/Model/SchemaManager.h:10:9: note: while building module 'SQLiteMacOSX' imported from /Users/xxx/Documents/yyy/yyy/Common/Model/SchemaManager.h:10:
#import <sqlite3.h>
^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.0.sdk/usr/include/sqlite3.h:35:10: note: while building module 'Darwin' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.0.sdk/usr/include/sqlite3.h:35:
#include <stdarg.h> /* Needed for the definition of va_list */
^
<module-includes>:33:9: note: in file included from <module-includes>:33:
#import "util.h"
^
error: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/util.h:107:10: error: 'utmp.h' file not found with <angled> include; use "quotes" instead
#include <utmp.h>
^
/Users/xxx/Documents/yyy/yyy/Common/Model/SchemaManager.h:10:9: note: while building module 'SQLiteMacOSX' imported from /Users/xxx/Documents/yyy/yyy/Common/Model/SchemaManager.h:10:
#import <sqlite3.h>
^
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sqlite3.h"
^
error: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.0.sdk/usr/include/sqlite3.h:35:10: error: could not build module 'Darwin'
#include <stdarg.h> /* Needed for the definition of va_list */
^
/Users/xxx/Documents/yyy/yyy/Common/Model/Bridging-Header.h:12:9: note: in file included from /Users/xxx/Documents/yyy/yyy/Common/Model/Bridging-Header.h:12:
#import "SchemaManager.h"
^
error: /Users/xxx/Documents/yyy/yyy/Common/Model/SchemaManager.h:10:9: error: could not build module 'SQLiteMacOSX'
#import <sqlite3.h>
^
error: failed to import bridging header '/Users/xxx/Documents/yyy/yyy/Common/Model/Bridging-Header.h'
The core error boils down to this:
error: 'utmp.h' file not found
I have read elsewhere that problems in bridging header can stop the debugger from showing variable values. But I am not sure how I go about fixing this particular issue.
TLDR; Clean out your bridging header and make sure you have only what you need.
I was having the same problem, but with no output after the failed to get module 'yyy' from AST context. I removed everything from my bridging header and added items back one-by-one to be sure I needed everything.
I found that adding #import <UIKit/UIKit.h> at the top was necessary (but originally missing) and found a few that I didn't need as I changed my project structure and forgot to remove some of the includes. After all that, it started working. Hopefully this helps.
I am using Xcode 7.3, and I am getting an "Ambiguous expansion of macro" warning, for a macro which was defined in Foundation, but which I have undefined and re-defined in my prefix file. I have modules enabled.
To reproduce:
Set "Enable Modules (C and Objective-C)" to Yes in build settings
Use the following prefix file:
#import <Foundation/Foundation.h>
#undef assert
#define assert(e) NSLog(#"hi") // implementation is not important
Use the following main source file:
int main() {
assert(42);
return 0;
}
Then build in Xcode.
It shows an "Ambiguous expansion of macro 'assert'" warning on the line in the source file that uses the "assert" macro. The "Expanding this definition of 'assert'" points to the definition from the system header, not my redefinition. The "Other definition of 'assert'" points to the definition in my prefix file.
This warning does not happen when modules is disabled.
This is a bug in Xcode; we'd appreciate if you could file a bug report at https://bugreport.apple.com and leave the bug # in a comment here. Your options for working around this bug in the meantime are:
You could use a different name than "assert" for this macro.
You could set the GCC_PRECOMPILE_PREFIX_HEADER build setting to NO, since PCH don’t provide a lot of benefit when you already have modules. The prefix header will still work, it just won’t be turned into a PCH.
You could turn off modules.
I am using structures and methods listed below and including sys/time.h or time.h do not change anything. What can be the problem?
struct tm theTime;
strptime((char *)nodeValue, "%a %b %d %H:%M:%S +0000 %Y", &theTime);
time_t epochTime = timegm(&theTime);
I am using XCode and compile for armv7. (Before, this was working perfectly. I don't know what's changed since before..)
I get the following errors:
Variable has incomplete type 'struct tm'
Implicit declaration of function 'strptime' is invalid in C99
Implicit declaration of function 'timegm' is invalid in C99
Enable the declarations by defining feature test macro -D_POSIX_C_SOURCE=200809L at compilation time or before including the header:
#define _POSIX_C_SOURCE 200809L
#include <time.h>
See here for more information on feature test macro _POSIX_C_SOURCE.
I have included another header path which also includes time.h and which's content is irrelevant. I fixed it and everything works again.
So, in situations like this, it is a good idea to check header paths to see if there is any other file with the same name but in another directory.
#ouah's answer is great and it is a good tip, however it is not the direct solution of my problem.
This error happens when I try to import the file "VARendererViewController.h" from the file "VAMenuScreenViewController"
duplicate symbol _gestureMinimumTranslation in:
/Users/Sam/Library/Developer/Xcode/DerivedData/Virtual_Human_Avatar-fwgdkxpnkzapxrdzkggtmbnfhjwb/Build/Intermediates/Virtual Human Avatar.build/Debug-iphonesimulator/Virtual Human Avatar.build/Objects-normal/i386/VARendererViewController.o
/Users/Sam/Library/Developer/Xcode/DerivedData/Virtual_Human_Avatar-fwgdkxpnkzapxrdzkggtmbnfhjwb/Build/Intermediates/Virtual Human Avatar.build/Debug-iphonesimulator/Virtual Human Avatar.build/Objects-normal/i386/VAMenuScreenViewController.o
ld: 1 duplicate symbol for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Could anyone provide me with some
You have two compilation units -- two source files -- that are defining the same symbol.
This may be because you defined the symbol in two separate .m files (or other compilation unit; .c, .mm, etc...) or because you defined the symbol in a header file and imported it into those two files. Alternatively, if you shove a variable declaration into a header file without the extern, then it'll cause a symbol by that name to be created in every .m file it is imported into.
Assuming gestureMinimumTranslation is a variable, then if you really want a global variable, it should be defined in only one .m file as follows:
int gestureMinimumTranslation;
Then, in the corresponding header:
extern int gestureMinimumTranslation;
And the other .m file should import the above header.
The linker is trying to join a set of objects with a common symbol. This often happens when the Compile Sources Build Phase has duplicate entries or a header file. Try removing these.
I have the following macros header file (system.h),
#define rt_metadata 8000
#define dir_metadata "db\metadata"
and resource file (system.db.metadata.rc)
#include "system.h"
SY_ALLOWDATE rt_metadata db\metadata\SY.AllowDate.xml
How do I replace the db\metadata with dir_metadata in the resource file so that it will become something like dir_metadata\SY.AllowDate.xml?
This is done by the resource compiler (BRCC32.EXE was Borland's version, and Microsoft had one as well).
Macros are done by a precompiler just before compiling; BRCC32 handled both the precompilation and compilation steps of converting an RC file into a binary RES file.
So you can get the macro converted by using the commandline resource compiler:
brcc32 yourresourcefile.rc
You can also define the macro on the commandline as well
brcc32 -dYOURMACRO=yourstring yourresourcefile.rc