运行Visual Studio code,遇到error while loading shared libraries: libXss.so.1: cannot open shared object

运行Visual Studio Code,遇到错误如下:

[root@osboxes VSCode-linux-x64]# ./code 
./code: error while loading shared libraries: libXss.so.1: cannot open shared object file: No such file or directory
 

通过运行ldd命令,发现确实缺少了libXss.so.1

[root@osboxes VSCode-linux-x64]# ldd code
    linux-vdso.so.1 =>  (0x00007ffd50db3000)
    libnode.so => /opt/vscode/VSCode-linux-x64/./libnode.so (0x00007f5cc702b000)
    libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f5cc6dfc000)
    libgtk-3.so.0 => /lib64/libgtk-3.so.0 (0x00007f5cc64f2000)
    libgdk-3.so.0 => /lib64/libgdk-3.so.0 (0x00007f5cc623a000)
    libpangocairo-1.0.so.0 => /lib64/libpangocairo-1.0.so.0 (0x00007f5cc602c000)
    libpango-1.0.so.0 => /lib64/libpango-1.0.so.0 (0x00007f5cc5de1000)
    libatk-1.0.so.0 => /lib64/libatk-1.0.so.0 (0x00007f5cc5bbb000)
    libcairo.so.2 => /lib64/libcairo.so.2 (0x00007f5cc5892000)
    libgdk_pixbuf-2.0.so.0 => /lib64/libgdk_pixbuf-2.0.so.0 (0x00007f5cc566a000)
    libgio-2.0.so.0 => /lib64/libgio-2.0.so.0 (0x00007f5cc52d6000)
    libgobject-2.0.so.0 => /lib64/libgobject-2.0.so.0 (0x00007f5cc5085000)
    libdbus-1.so.3 => /lib64/libdbus-1.so.3 (0x00007f5cc4e3d000)
    libX11-xcb.so.1 => /lib64/libX11-xcb.so.1 (0x00007f5cc4c3b000)
    libxcb.so.1 => /lib64/libxcb.so.1 (0x00007f5cc4a12000)
    libXi.so.6 => /lib64/libXi.so.6 (0x00007f5cc4802000)
    libXcursor.so.1 => /lib64/libXcursor.so.1 (0x00007f5cc45f7000)
    libXdamage.so.1 => /lib64/libXdamage.so.1 (0x00007f5cc43f3000)
    libXrandr.so.2 => /lib64/libXrandr.so.2 (0x00007f5cc41e8000)
    libXcomposite.so.1 => /lib64/libXcomposite.so.1 (0x00007f5cc3fe5000)
    libXext.so.6 => /lib64/libXext.so.6 (0x00007f5cc3dd2000)
    libXfixes.so.3 => /lib64/libXfixes.so.3 (0x00007f5cc3bcc000)
    libXrender.so.1 => /lib64/libXrender.so.1 (0x00007f5cc39c1000)
    libX11.so.6 => /lib64/libX11.so.6 (0x00007f5cc3682000)
    libXtst.so.6 => /lib64/libXtst.so.6 (0x00007f5cc347c000)
    libXss.so.1 => not found
    libgconf-2.so.4 => /lib64/libgconf-2.so.4 (0x00007f5cc324a000)
    libgmodule-2.0.so.0 => /lib64/libgmodule-2.0.so.0 (0x00007f5cc3046000)
    libglib-2.0.so.0 => /lib64/libglib-2.0.so.0 (0x00007f5cc2d34000)
    libnss3.so => /lib64/libnss3.so (0x00007f5cc2a09000)
    libnssutil3.so => /lib64/libnssutil3.so (0x00007f5cc27dc000)
    libsmime3.so => /lib64/libsmime3.so (0x00007f5cc25b5000)
    libnspr4.so => /lib64/libnspr4.so (0x00007f5cc2376000)
    libffmpeg.so => /opt/vscode/VSCode-linux-x64/./libffmpeg.so (0x00007f5cc2193000)
    libasound.so.2 => /lib64/libasound.so.2 (0x00007f5cc1e95000)
    libcups.so.2 => /lib64/libcups.so.2 (0x00007f5cc1c2b000)
    librt.so.1 => /lib64/librt.so.1 (0x00007f5cc1a23000)
    libdl.so.2 => /lib64/libdl.so.2 (0x00007f5cc181f000)
    libfontconfig.so.1 => /lib64/libfontconfig.so.1 (0x00007f5cc15e1000)
    libexpat.so.1 => /lib64/libexpat.so.1 (0x00007f5cc13b7000)
    libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007f5cc10af000)
    libm.so.6 => /lib64/libm.so.6 (0x00007f5cc0dac000)
    libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f5cc0b96000)
    libc.so.6 => /lib64/libc.so.6 (0x00007f5cc07d3000)
    /lib64/ld-linux-x86-64.so.2 (0x000056303a078000)
    libcairo-gobject.so.2 => /lib64/libcairo-gobject.so.2 (0x00007f5cc05c9000)
    libatk-bridge-2.0.so.0 => /lib64/libatk-bridge-2.0.so.0 (0x00007f5cc039a000)
    libepoxy.so.0 => /lib64/libepoxy.so.0 (0x00007f5cc00a5000)
    libpangoft2-1.0.so.0 => /lib64/libpangoft2-1.0.so.0 (0x00007f5cbfe8e000)
    libXinerama.so.1 => /lib64/libXinerama.so.1 (0x00007f5cbfc8b000)
    libthai.so.0 => /lib64/libthai.so.0 (0x00007f5cbfa7e000)
    libgthread-2.0.so.0 => /lib64/libgthread-2.0.so.0 (0x00007f5cbf87c000)
    libharfbuzz.so.0 => /lib64/libharfbuzz.so.0 (0x00007f5cbf619000)
    libfreetype.so.6 => /lib64/libfreetype.so.6 (0x00007f5cbf372000)
    libpixman-1.so.0 => /lib64/libpixman-1.so.0 (0x00007f5cbf0c9000)
    libEGL.so.1 => /lib64/libEGL.so.1 (0x00007f5cbee9b000)
    libpng15.so.15 => /lib64/libpng15.so.15 (0x00007f5cbec70000)
    libxcb-shm.so.0 => /lib64/libxcb-shm.so.0 (0x00007f5cbea6c000)
    libxcb-render.so.0 => /lib64/libxcb-render.so.0 (0x00007f5cbe85e000)
    libz.so.1 => /lib64/libz.so.1 (0x00007f5cbe647000)
    libGL.so.1 => /lib64/libGL.so.1 (0x00007f5cbe3d5000)
    libffi.so.6 => /lib64/libffi.so.6 (0x00007f5cbe1cc000)
    libpcre.so.1 => /lib64/libpcre.so.1 (0x00007f5cbdf6a000)
    libselinux.so.1 => /lib64/libselinux.so.1 (0x00007f5cbdd43000)
    libresolv.so.2 => /lib64/libresolv.so.2 (0x00007f5cbdb29000)
    libmount.so.1 => /lib64/libmount.so.1 (0x00007f5cbd8e7000)
    libXau.so.6 => /lib64/libXau.so.6 (0x00007f5cbd6e3000)
    libdbus-glib-1.so.2 => /lib64/libdbus-glib-1.so.2 (0x00007f5cbd4ba000)
    libplc4.so => /lib64/libplc4.so (0x00007f5cbd2b5000)
    libplds4.so => /lib64/libplds4.so (0x00007f5cbd0b1000)
    libgssapi_krb5.so.2 => /lib64/libgssapi_krb5.so.2 (0x00007f5cbce63000)
    libkrb5.so.3 => /lib64/libkrb5.so.3 (0x00007f5cbcb7b000)
    libk5crypto.so.3 => /lib64/libk5crypto.so.3 (0x00007f5cbc947000)
    libcom_err.so.2 => /lib64/libcom_err.so.2 (0x00007f5cbc743000)
    libssl.so.10 => /lib64/libssl.so.10 (0x00007f5cbc4d1000)
    libcrypto.so.10 => /lib64/libcrypto.so.10 (0x00007f5cbc06f000)
    libavahi-common.so.3 => /lib64/libavahi-common.so.3 (0x00007f5cbbe62000)
    libavahi-client.so.3 => /lib64/libavahi-client.so.3 (0x00007f5cbbc51000)
    libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00007f5cbba19000)
    libatspi.so.0 => /lib64/libatspi.so.0 (0x00007f5cbb7e9000)
    libgraphite2.so.3 => /lib64/libgraphite2.so.3 (0x00007f5cbb5bb000)
    libxcb-dri2.so.0 => /lib64/libxcb-dri2.so.0 (0x00007f5cbb3b6000)
    libxcb-xfixes.so.0 => /lib64/libxcb-xfixes.so.0 (0x00007f5cbb1ae000)
    libxcb-dri3.so.0 => /lib64/libxcb-dri3.so.0 (0x00007f5cbafaa000)
    libxcb-present.so.0 => /lib64/libxcb-present.so.0 (0x00007f5cbada7000)
    libxcb-sync.so.1 => /lib64/libxcb-sync.so.1 (0x00007f5cbaba0000)
    libxshmfence.so.1 => /lib64/libxshmfence.so.1 (0x00007f5cba99c000)
    libgbm.so.1 => /lib64/libgbm.so.1 (0x00007f5cba790000)
    libdrm.so.2 => /lib64/libdrm.so.2 (0x00007f5cba581000)
    libglapi.so.0 => /lib64/libglapi.so.0 (0x00007f5cba351000)
    libxcb-glx.so.0 => /lib64/libxcb-glx.so.0 (0x00007f5cba136000)
    libXxf86vm.so.1 => /lib64/libXxf86vm.so.1 (0x00007f5cb9f30000)
    libblkid.so.1 => /lib64/libblkid.so.1 (0x00007f5cb9cf0000)
    libuuid.so.1 => /lib64/libuuid.so.1 (0x00007f5cb9aeb000)
    libkrb5support.so.0 => /lib64/libkrb5support.so.0 (0x00007f5cb98dc000)
    libkeyutils.so.1 => /lib64/libkeyutils.so.1 (0x00007f5cb96d8000)
    libfreebl3.so => /lib64/libfreebl3.so (0x00007f5cb94d4000)
 

解决方案:

使用yum,安装libXScrnSaver

yum install libXScrnSaver

安装完成之后,再运行code,Visual Studio的UI启动成功。

 

如果缺少其他的lib,处理方法类似。

你可能感兴趣的:(杂谈,C,C++)