visual-studio-codeterminalglibclibcsnap

version `GLIBC_2.33' not found when trying to open vscode from Terminal


When I try to open Visual Studio Code using the command line code in the Terminal, I got this error that I don't understand:

$ code
/snap/code/117/usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders: /snap/core/current/lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by /usr/lib/x86_64-linux-gnu/libstdc++.so.6)
/snap/code/117/usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders: /snap/core/current/lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.25' not found (required by /usr/lib/x86_64-linux-gnu/libstdc++.so.6)
/snap/code/117/usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders: /snap/core/current/lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found (required by /usr/lib/x86_64-linux-gnu/libstdc++.so.6)
/snap/code/117/usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders: /snap/core/current/lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by /usr/lib/x86_64-linux-gnu/libstdc++.so.6)
/snap/code/117/usr/share/code/bin/../code: /snap/core/current/lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by /usr/lib/x86_64-linux-gnu/libstdc++.so.6)
/snap/code/117/usr/share/code/bin/../code: /snap/core/current/lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.25' not found (required by /usr/lib/x86_64-linux-gnu/libstdc++.so.6)
/snap/code/117/usr/share/code/bin/../code: /snap/core/current/lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found (required by /usr/lib/x86_64-linux-gnu/libstdc++.so.6)
/snap/code/117/usr/share/code/bin/../code: /snap/core/current/lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by /usr/lib/x86_64-linux-gnu/libstdc++.so.6)

I'm using the snap package of vscode:

$ snap info code
name:      code
summary:   Code editing. Redefined.
publisher: Visual Studio Code (vscode✓)
store-url: https://snapcraft.io/code
contact:   https://twitter.com/code
license:   unset
description: |
  Visual Studio Code is a new choice of tool that combines the
  simplicity of a code editor with what developers need for the core
  edit-build-debug cycle.
commands:
  - code
  - code.url-handler
snap-id:      Ht0aUHi7ofh9Fbwh6m7jUN2pAy6kzBiu
tracking:     latest/stable
refresh-date: 5 days ago, at 07:48 CET
channels:
  latest/stable:    97dec172 2023-01-10 (117) 259MB classic
  latest/candidate: ↑                               
  latest/beta:      ↑                               
  latest/edge:      ↑                               
installed:          97dec172            (117) 259MB classic

Solution

  • Update:

    The failure was caused by LD_PRELOAD pointing to the system libstdc++.so.6.

    General advice: never set LD_PRELOAD in your ~/.bashrc. If a specific program requires you to set LD_PRELOAD, create a shell wrapper for that program in your ~/bin/, and set LD_PRELOAD in that wrapper, so only that particular program is affected.


    I got this error that I don't understand

    The error means: code binary is using two libraries: /usr/lib/x86_64-linux-gnu/libstdc++.so.6 and /snap/core/current/lib/x86_64-linux-gnu/libc.so.6 which are not compatible.

    In particular, the system libstdc++.so.6 requires newer libc.so.6 than the one found in /snap/core/....

    From the error message, libstdc++.so.6 was compiled on a system (and requires) GLIBC-2.34 or newer, and the /snap/core/.../libc.so.6 is older than GLIBC-2.25.

    You can find out the exact version of /snap/core/.../libc.so.6 by invoking it as if it was a program -- it will print its own version.


    The error indicates some kind of setup / configuration problem with snap (I have no idea what that is). It is likely that you need to install an older version of libstdc++.so.6 into /snap/core/....