I've been working on a Java project that uses a gui.jar file to import some classes. Everything was working fine until yesterday. Now, I can compile the .class files by the command
javac -d ./bin -sourcepath ./src -classpath ./bin/gui.jar src/simulation/TestSimulateur.javac
but when I try to execute the program with
java -classpath bin:bin/gui.jar simulation.TestSimulateur
I get the error
java: symbol lookup error: /snap/core20/current/lib/x86_64-linux-gnu/libpthread.so.0: undefined symbol: __libc_pthread_init, version GLIBC_PRIVATE make: *** [Makefile:47: carte1] Error 127
I don't know much about how snap and the libraries work so I'm not sure about the root of the problem. It's strange that the problem only appears when I run it on VSCode, while it works fine if I run it on the normal Linux terminal.
I've searched a lot but couldn't find how to solve the problem. As I've said, I'm newbie on Linux system. Between my attempts, I tried to reinstall VSCode, updating the system and updating snap packages, but none of those worked.
Though I have already answered it here
The issue with how the VSCode Snap package libraries are configured to be used.
They are setting the following environment variable GTK_PATH, which gets inherited by the VSCode Terminal.
Unsetting the environment variable in the VSCode terminal does seem to work for me.
unset GTK_PATH
As a slightly more permanent workaround, you can also unset GTK_PATH in your VS Code user settings, run "Preferences: Open User Settings (JSON)" and add this to your settings.json:
"terminal.integrated.env.linux": {
"GTK_PATH": ""
}
Update 2: 2024-03-09
It seems the VSCode Snap package(version 1.87.1) has introduced even more environment variables for GTK Toolkit.
I have to additionally unset the following environment variables for additional GTK Built Applications:
unset GIO_MODULE_DIR
For people looking at solving this issue with the VSCode Snap Package installation can use the following in their settings.json:
"terminal.integrated.env.linux": {
"GTK_PATH": null,
"GIO_MODULE_DIR": null,
},
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With