vscode: GTK+ module libcanberra-gtk-module.so cannot be loaded

Hello guys,

I’m using OpenCV in VSCode (Ubuntu Software installation) and everything worked fine, until I updated my libraries (sudo apt-get update/upgrade/full-upgrade) I guess. But now VSCode or rather OpenCV can’t find the GTK library.

I’ve tested this succesfully: GTK_PATH=/usr/lib/x86_64-linux-gnu/gtk-2.0 ./test --> works

But when I specify the version gtk-3.0: GTK_PATH=/usr/lib/x86_64-linux-gnu/gtk-3.0 ./test --> fails

Normally the loaded version without using GTK_PATH is gtk-3.0 and then it shows me this error: image

I verified that the in /usr/lib/x86_64-linux-gnu/gtk-3.0/modules is:

image

Would appreciate to solve this warning and to understand why the .so cannot be loaded.

Thanks in advance

UPDATE: the example code can be executed without warnings in the normal gnome terminal, but VSCode seems to habe problems to find the specific libraries, so it’s definitely VSCode.

About this issue

  • Original URL
  • State: open
  • Created a year ago
  • Reactions: 3
  • Comments: 19 (7 by maintainers)

Most upvoted comments

@AmeyaVS are you seeing the error with same steps from #179274 (comment) ? Can you share the output of the following steps,

The failure still exists, also I am unable to configure GitHub Account credentials on my VSCode as Firefox fails to launch from VSCode due to the same reasons.

1. Launch VSCode

2. Delete any terminal related settings to unset `GTK_PATH`

I don’t have it unset in any VSCode settings. This is a new installation.

3. Open integrated terminal

4. Run `printenv`

Here’s the grepped GTK/VSCODE Environment variables captured on my system in the integrated terminal:

XDG_CONFIG_DIRS_VSCODE_SNAP_ORIG=
GDK_BACKEND_VSCODE_SNAP_ORIG=
GIO_MODULE_DIR_VSCODE_SNAP_ORIG=
GTK_EXE_PREFIX=/snap/code/133/usr
VSCODE_GIT_ASKPASS_NODE=/var/lib/snapd/snap/code/133/usr/share/code/code
VSCODE_GIT_ASKPASS_EXTRA_ARGS=--ms-enable-electron-run-as-node
GSETTINGS_SCHEMA_DIR_VSCODE_SNAP_ORIG=
GTK_IM_MODULE_FILE_VSCODE_SNAP_ORIG=
GTK_PATH=/snap/code/133/usr/lib/x86_64-linux-gnu/gtk-3.0
GTK_PATH_VSCODE_SNAP_ORIG=
VSCODE_GIT_IPC_HANDLE=/run/user/1000/vscode-git-419a178ba9.sock
GTK_EXE_PREFIX_VSCODE_SNAP_ORIG=
XDG_DATA_DIRS_VSCODE_SNAP_ORIG=/home/ameyavs/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share/:/usr/share/:/var/lib/snapd/desktop
VSCODE_GIT_ASKPASS_MAIN=/var/lib/snapd/snap/code/133/usr/share/code/resources/app/extensions/git/dist/askpass-main.js
GTK_IM_MODULE_FILE=/home/ameyavs/snap/code/common/.cache/immodules/immodules.cache
LOCPATH_VSCODE_SNAP_ORIG=

I don’t have any of the GTK* Evironment Variables in my default system terminal. It seems the issue is not resolved.

With the verification steps above, I get a single message Gtk-Message: <timestamp>: Failed to load module "canberra-gtk-module", but that’s it.

I will keep this issue open to address the problem with snap packages.