SDL2 DBus error when calling SDL_Init(SDL_INIT_VIDEO);

Im getting the error below trying to build my SDL2 application (using Jetpack 4.1):

dbus[24360]: arguments to dbus_message_new_method_call() were incorrect, assertion "path != NULL" failed in file ../../../dbus/dbus-message.c line 1362.
This is normally a bug in some application using the D-Bus library.

  D-Bus not built with -rdynamic so unable to print a backtrace
Aborted (core dumped)

Here is a snippet that shows the issue:

#include <cstdio>
#include <SDL2/SDL_opengl.h>
#include <SDL2/SDL.h>

int main(int argc, char** args)
{
    printf("Hi");
    SDL_Init(SDL_INIT_VIDEO);
    SDL_CreateWindow("", 0, 0, 800, 600, 0);
    printf("Bye");
}

Compile with:

gcc -o SDL2test test.cpp `sdl2-config --cflags --libs`

Anyone seen this or have any thoughts on what might cause it?

Hi ross,
The same test code works on r28.2.1/TX2, which is on kernel 4.4, Ubuntu 16.04. Xavier r31.0.2 release is on kernel 4.9 Ubuntu 18.04. Not sure but it probably is certain configs is not enabled in kernel, or deviation between 16.04 and 18.04.

SDL2 is 3rdparty frameworks and we don’t have much experience on it. Other users may share their experience.

I use SDL 2.0.9 on the Xavier, and it works fine.
I built it from source which I downloaded myself, and then did “sudo make install” on, though.

Here’s my init code:

SDL_Init(SDL_INIT_VIDEO | SDL_INIT_EVENTS);
    init_text();
    viewer_window = SDL_CreateWindow("Viewer Window",
            SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, video_width, video_height,
            SDL_WINDOW_SHOWN);

I recommend you sudo apt remove libsdl2* to remove the Ubuntu standard versions, and then download, build, and install your own:
https://www.libsdl.org/download-2.0.php

If I remember correctly, it was a pretty easy configure-and-make process.

Confirmed SDL2-2.0.9 works ok.

The build version reports more gcc options which might have been the magic. Seems to work now so thanks.

Default (apt-get install libsdl2-dev) sdl-config:

-I/usr/include/SDL2 -D_REENTRANT
-lSDL2

Build (SDL2-2.0.9) sdl2_config

-I/usr/local/include/SDL2 -D_REENTRANT
-L/usr/local/lib -Wl,-rpath,/usr/local/lib -Wl,--enable-new-dtags -lSDL2
1 Like