libweston program segfaults on weston_compositor_load_backend

adlo adloconwy at gmail.com
Wed May 2 21:19:21 UTC 2018


I am trying to write a simple test compositor using libweston, but it
segfaults on weston_compositor_load_backend.

Here is my code:

main.c:

#include <wayland-server.h>
#include <compositor.h>
#include <compositor-drm.h>
#include <compositor-wayland.h>
#include <libweston-desktop.h>
#include <libinput.h>
#include <string.h>
#include <windowed-output-api.h>

int main (int    argc,
          char **argv)
{
	struct wl_display *display;
	struct weston_compositor *ec;
	int ret = 0;

	display = wl_display_create ();
	ec = weston_compositor_create (display, NULL);

	ec->default_pointer_grab = NULL;
	ec->vt_switching = true;

	ec->repaint_msec = 16;
	ec->idle_time = 300;

	struct weston_wayland_backend_config config = {{0, }};

	config.base.struct_version =
WESTON_WAYLAND_BACKEND_CONFIG_VERSION;
	config.base.struct_size = sizeof (struct
weston_wayland_backend_config);

	config.cursor_size = 32;
	config.display_name = 0;
	config.use_pixman = 0;
	config.sprawl = 0;
	config.fullscreen = 0;
	config.cursor_theme = NULL;


	ret = weston_compositor_load_backend (ec,
WESTON_BACKEND_WAYLAND, &config.base);

	return 0;
}

meson.build:

project('test-libweston-desktop', 'c',
	default_options: 'c_std=c11')
wayland_server = dependency('wayland-server')
wayland_client = dependency('wayland-client')
wayland_protocols = dependency('wayland-protocols')
libweston = dependency ('libweston-5')
libweston_desktop= dependency ('libweston-desktop-5')
libinput = dependency('libinput')
pixman = dependency('pixman-1')
xkbcommon = dependency('xkbcommon')
egl = dependency('egl')
libevdev = dependency('libevdev')
executable('test-libweston-desktop', 'main.c', dependencies :
[wayland_server, wayland_client, wayland_protocols, libinput,
libweston, pixman, xkbcommon, egl, libevdev, libweston_desktop])

How can I resolve my issue?

Regards

adlo


More information about the wayland-devel mailing list