Hello! I have noticed a huge problem caused by Argus/Argus.h
inclusion (in /usr/src/jetson_multimedia_api/argus/include
), which redefines fundamental programming terms like Bool
, None
, KeyPress
, etc
Here’s the include tree, which leads to the problem (starts from /usr/src/jetson_multimedia_api/include/Argus/Argus.h
).
Argus/Argus.h -> Argus/Types.h -> EGL/egl.h -> EGL/eglplatform.h
→ X11/Xlib.h and <X11/Xutil.h>
So Xlib.h
and Xutil.h
has prehistoric #define
’s, like (I didn’t post all of them, there are many more):
...
#define Bool int
#define Status int
#define True 1
#define False 0
...
#define XValue 0x0001
#define YValue 0x0002
#define WidthValue 0x0004
#define HeightValue 0x0008
...
So the problem is that any time something wants to do something with Bool, Status, XValue word, everything literally breaks, because X11 redefines it and is not namespaced. For example, the Qt framework uses them, so it’s literally impossible to compile Qt with Argus by default, if the Qt include uses any of these words in their code.
.
There is also a relatively simple solution to this, if you don’t need EGL display on X11.
There are actually 2 eglplatform.h
files on Jetson by default. One is located in /usr/src/jetson_multimedia_api/include/EGL/eglplatform.h
and the other one is /usr/include/EGL/eglplatform.h
.
The one used by Argus include is in multimedia api folder, is older than the one in /usr/include
folder and it actually has a fix for this problem (using X11)
/usr/src/jetson_multimedia_api/include/EGL/eglplatform.h
file checks only if the device is __unix__
or __APPLE__
and always includes X11
#elif defined(__unix__) || defined(__APPLE__)
/* X11 (tentative) */
#include <X11/Xlib.h>
#include <X11/Xutil.h>
typedef Display *EGLNativeDisplayType;
typedef Pixmap EGLNativePixmapType;
typedef Window EGLNativeWindowType;
however the /usr/include/EGL/eglplatform.h
file has an extra defines EGL_NO_X11
and USE_X11
#elif defined(__unix__) && defined(EGL_NO_X11)
typedef void *EGLNativeDisplayType;
typedef khronos_uintptr_t EGLNativePixmapType;
typedef khronos_uintptr_t EGLNativeWindowType;
#elif defined(__unix__) || defined(USE_X11)
/* X11 (tentative) */
#include <X11/Xlib.h>
#include <X11/Xutil.h>
typedef Display *EGLNativeDisplayType;
typedef Pixmap EGLNativePixmapType;
typedef Window EGLNativeWindowType;
#elif defined(__APPLE__)
typedef int EGLNativeDisplayType;
typedef void *EGLNativePixmapType;
typedef void *EGLNativeWindowType;
So the problem is solved by replacing /usr/src/jetson_multimedia_api/include/EGL/eglplatform.h
with /usr/include/EGL/eglplatform.h
and including #define EGL_NO_X11
in your code, which includes Argus/Argus.h
I hope that someone from Nvidia will see this and include the eglplatform.h replacement in an update or find a different solution to this problem.
Thanks!