Under Ubuntu 18.04 Deepin QQ 9.1.8 imperfect solution NVIDIA environment of mid-year report libGL error

This article first appeared in the blog Park ( https://www.cnblogs.com/ArrowKeys/p/12152602.html ), prohibited reproduced.

background

Native environment: NVIDIA GTX 1660Ti, Ubuntu 18.04, CUDA 10.2 (graphics driver version 440.33.01)

According to the author wszqkzqk program installed the latest deepin QQ (9.1.8), install the CUDA 10.2 (comes 440.33.01 graphics driver) and switch to NVIDIA mode login system. At this time, found QQ can not start properly.

After some verification, the basic phenomenon is determined as follows:

  • Bootable normal QQ 8.9.4 and QQ 9.1.8 on Intel core display mode.

  • May start in the normal QQ 8.9.4 NVIDIA significant independence can not initiate QQ 9.1.8.
    In order to observe the error condition, the command line used /opt/deepinwine/apps/Deepin-QQ/run.shto start the print error as follows:

    libGL error: No matching fbConfigs or visuals found
    libGL error: failed to load driver: swrast
    X Error of failed request: GLXBadContext
    Major opcode of failed request: 152 (GLX)
    Minor opcode of failed request: 6 (X_GLXIsDirect)
    Serial number of failed request: 204
    Current serial number in output stream: 203

explore

Error report clearly points to the wrong use of libGL.so. Combining different performance in both graphics mode, the problem should not be used to guess versions libGL.so now in the use of NVIDIA graphics cards, which may have their own two cards applicable libGL.so. (By the way Tucao one, before 960M card is no problem ......)

Deepin QQ call a 32-bit library, so try to soft links /usr/lib/i386-linux-gnu/libGL.so.1pointing to various libGL library file system, but did not solve the problem.

Stumbled

Use the following command due to the author each time point libGL.so.1 changes:

mv libGL.so.1 libGL.so.1.backup
ln -s xxx libGL.so.1

When an amendment, because the wrong hands, mv only been on the run QQ again, but accidentally started successfully. As for QQ is directly overlooked by the library or load priority order of lower priority load another library, the author has not proven, but the discovery I found a relatively hack the program to start the QQ.

Not perfect but can

In order to avoid interfering with other programs running, apparently not directly delete libGL.so.1. Convenience, nor are manually mv QQ again before each run, and then change back and so successfully started. Directly think of the program is to write a startup script, every first mv mv restart QQ again, but in libGL.so.1 directory where sudo operations need to obtain permission, it would be another trouble. So you want to skip this file except when loading and no suitable environment variables available. Finally, the program is available hijacking process (i.e., so the load dlopen()functions), such as QQ, and failed to load only when loading libGL.so.1.

Write mydlopen.c follows (refer to StackOverflow is an issue , the code is modified somewhat on the format):

#define _GNU_SOURCE
#include <dlfcn.h>
#include <string.h>

void *dlopen (char const *Fnm, int Flg)
{
    void *(*real_dlopen) (char const *, int);
    *(void**)(&real_dlopen) = dlsym(RTLD_NEXT, "dlopen");
    if (strcmp("libGL.so.1", Fnm) == 0) {
        return NULL;
    } else {
        return real_dlopen(Fnm, Flg);   
    }
}

Use the command gcc mydlopen.c -fPIC -ldl -shared -m32 -o mydlopen32.soto compile a 32-bit dynamic link library (gcc need support multilib, can apt-get install gcc-7-multilibsupport the installation).

Finally, env LD_PRELOAD=/path/to/mydlopen32.so /opt/deepinwine/apps/Deepin-QQ/run.shrun QQ. (Application menu command in the start QQ /usr/share/applications/deepin.com.qq.im.desktopmodify file)

Guess you like

Origin www.cnblogs.com/ArrowKeys/p/12152602.html
Recommended