XCB Error: 148 - Qt Application Display Issues

I am trying to run a Qt application on another computer (it works fine on mine, where I developed it). When I run this application through the terminal, I get this error -

QXcbConnection: XCB error: 148 (unknown), sequence: 175, resource ID: 0, main code: 140 (Unknown), code: 20

My program starts and everything looks fine, but when I run it, I see strange behavior when interacting with the display (some drawing commands are not executed, which is crucial for my application).

I tried to find this error, and so far I can not find a solution. Do you have any suggestions?

Using ubuntu 16.04, with an Nvidia 1050 GTX gpu

+5
source share
1 answer

You have created a graphical application. Your application is functionally dependent on your xorg.conf (X server configuration file). The X server is your display windows that are based on your graphics hardware.

When you tried to run the same application on another computer, it wants to read the same configuration as on your old computer. Because each computer has an xconf.org file located in / etc / x 11 / xconf.org. On a new computer, the computer can read information from xconf.org, but it cannot read all the information. That is why it partially works.

Your graphics card improves your X server. Thus, the configuration continues to add your xconf.org based on the installation of the graphics driver. But on a computer without a video card, there is also xconf.org for displaying it.

The following is the FSM connection for connecting the X server (state machine). In your case, _xcb_out happens because it displays something. But the correct _xcb_in (XCB Input) or _xcb_ext (XCB extension) is incorrect.

I canโ€™t say exactly what causes this error. But FSM is an advanced machine based on different contexts. They search for channels of configuration files to complete the XCB connection setup. In your case, the XCB connection has an error, so the XCB setup cannot happen.

enter image description here

On each display of the X-server, you must first complete the connection with the X-server, after which further processing takes place.

Take a look at the code below from Wikipedia: https://en.wikipedia.org/wiki/XCB

#include <xcb/xcb.h> #include <stdio.h> #include <stdlib.h> int main(void) { xcb_connection_t *c; /* connection character */ xcb_screen_t *s; xcb_window_t w; xcb_gcontext_t g; xcb_generic_event_t *e; uint32_t mask; uint32_t values[2]; int done = 0; xcb_rectangle_t r = { 20, 20, 60, 60 }; /* open connection with the server */ c = xcb_connect(NULL,NULL); if (xcb_connection_has_error(c)) { printf("Cannot open display\n"); exit(1); /* you returned from here, no further processing */ } /* get the first screen */ s = xcb_setup_roots_iterator( xcb_get_setup(c) ).data; /* create black graphics context */ g = xcb_generate_id(c); w = s->root; mask = XCB_GC_FOREGROUND | XCB_GC_GRAPHICS_EXPOSURES; values[0] = s->black_pixel; values[1] = 0; xcb_create_gc(c, g, w, mask, values); /* create window */ w = xcb_generate_id(c); mask = XCB_CW_BACK_PIXEL | XCB_CW_EVENT_MASK; values[0] = s->white_pixel; values[1] = XCB_EVENT_MASK_EXPOSURE | XCB_EVENT_MASK_KEY_PRESS; xcb_create_window(c, s->root_depth, w, s->root, 10, 10, 100, 100, 1, XCB_WINDOW_CLASS_INPUT_OUTPUT, s->root_visual, mask, values); /* map (show) the window */ xcb_map_window(c, w); xcb_flush(c); /* event loop */ while (!done && (e = xcb_wait_for_event(c))) { switch (e->response_type & ~0x80) { case XCB_EXPOSE: /* draw or redraw the window */ xcb_poly_fill_rectangle(c, w, g, 1, &r); xcb_flush(c); break; case XCB_KEY_PRESS: /* exit on key press */ done = 1; break; } free(e); } /* close connection to server */ xcb_disconnect(c); return 0; } 

Here is a link you can explore more: https://xcb.freedesktop.org/tutorial/

So what is the solution here? QT uses dynamic linking when compiling by default. If you use static linking, then the executable package contains all the libraries you need to run, and therefore, anywhere you want to run, you can run. So, on your old machine, compile static links. It creates something like tar. You must install this tar on your computer. It should work.

QT, by default, uses dynamic linking: Does Qt create a default creator to statically or dynamically link its libraries?

How can you change QT to static linking: How to make Qt and Qtcreator link libraries statically rather than dynamically?

+3
source

Source: https://habr.com/ru/post/1269893/


All Articles