microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
163.38k stars 28.94k forks source link

integrated-terminal (x86_64-unknown-linux-gnu) #62532

Closed ArtHome12 closed 5 years ago

ArtHome12 commented 5 years ago

Issue Type: Bug

The behavior of the OS terminal and integrated VSCode differs. In the OS terminal:

    art@artPC:~/git/ClanLib$ help
    GNU bash, версия 4.4.19(1)-release (x86_64-pc-linux-gnu)

In the VSCode integrated:

    sh-4.4$ help
    GNU bash, версия 4.4.19(1)-release (x86_64-unknown-linux-gnu)

The difference is -unknown- and -pc-. Result of whoami is the same on both terminals. This is not a minor problem, it manifests itself further and breaks the compilation of complex projects under VSCode when with CLI is Ok.

In the OS terminal:

art@artPC:/$ ls /usr/bin/../lib/gcc/
avr  i686-linux-gnu  x86_64-linux-gnu

In the VSCode integrated:


sh-4.4$ ls /usr/bin/../lib/gcc/
x86_64-unknown-linux-gnu

There is only one object (really 3) and it has different name - x86_64-unknown-linux-gnu instead correct x86_64-linux-gnu.

VS Code version: Code 1.28.2 (7f3ce96ff4729c91352ae6def877e59c561f4850, 2018-10-17T00:20:56.183Z) OS version: Linux x64 4.15.0-38-generic

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i7-4710MQ CPU @ 2.50GHz (8 x 2652)| |GPU Status|2d_canvas: enabled
checker_imaging: disabled_off
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
native_gpu_memory_buffers: disabled_software
rasterization: disabled_software
video_decode: unavailable_software
video_encode: unavailable_software
webgl: enabled
webgl2: enabled| |Load (avg)|1, 1, 1| |Memory (System)|7.71GB (0.65GB free)| |Process Argv|--extensions-dir=/home/artem/.var/app/com.visualstudio.code/data/vscode/extensions --reuse-window| |Screen Reader|no| |VM|0%|
Extensions (6) Extension|Author (truncated)|Version ---|---|--- git-project-manager|fel|1.7.1 autoconf|mae|0.0.7 vscode-clang|mit|0.2.3 vscode-language-pack-ru|MS-|1.28.2 cpptools|ms-|0.20.1 vscode-arduino|vsc|0.2.22
kieferrm commented 5 years ago

If what you show above is the authentic output then based on the your prompt it seems that your OSS terminal is differently configured from your VS Code terminal. I'd suspect that this is also the cause for your different host/target configurations for gcc.

ArtHome12 commented 5 years ago

Yes, it is the authentic output, with russian locale "версия" :) I have changed only the name of the computer and login.

However, I did not make any manual settings. Maybe important - I installed VSCode before clang.

jerch commented 5 years ago

@ArtHome12 Looks like the RPATH is wrong in the vscode terminal, which will break compile&run from that terminal for projects with shared libs. Whats your linux distro? Maybe it sets RPATH in some init script that is not called in vscode's terminal? Also note your different prompt, you either run a totally different shell (sh vs. bash?) which lacks some env vars or the shell is missing some init script (like said above).

ArtHome12 commented 5 years ago

@jerch Linux Mint x64 4.15.0-38-generic. The variable RPATH is not set. From VSCode without any changes:

Result of `env` - [ ] sh-4.4$ env - [ ] PULSE_CLIENTCONFIG=/run/user/1000/pulse/config - [ ] AT_SPI_BUS_ADDRESS=unix:path=/run/user/1000/at-spi-bus - [ ] LC_MEASUREMENT=km_KH - [ ] XDG_CONFIG_HOME=/home/artem/.var/app/com.visualstudio.code/config - [ ] LC_PAPER=km_KH - [ ] LC_MONETARY=km_KH - [ ] PULSE_SERVER=unix:/run/user/1000/pulse/native - [ ] GST_PLUGIN_SYSTEM_PATH=/app/lib/gstreamer-1.0:/usr/lib/extensions/gstreamer-1.0:/usr/lib/x86_64-linux-gnu/gstreamer-1.0 - [ ] _=/usr/bin/env - [ ] LANG=en_US.UTF-8 - [ ] GDM_LANG=ru - [ ] DISPLAY=:99.0 - [ ] GTK_OVERLAY_SCROLLING=1 - [ ] XDG_VTNR=7 - [ ] GIO_LAUNCHED_DESKTOP_FILE_PID=11632 - [ ] SSH_AUTH_SOCK=/run/user/1000/keyring/ssh - [ ] MANDATORY_PATH=/usr/share/gconf/cinnamon.mandatory.path - [ ] APPLICATION_INSIGHTS_NO_DIAGNOSTIC_CHANNEL=true - [ ] LC_NAME=km_KH - [ ] XDG_SESSION_ID=c1 - [ ] XDG_GREETER_DATA_DIR=/var/lib/lightdm-data/artem - [ ] USER=artem - [ ] DESKTOP_SESSION=cinnamon - [ ] DEFAULTS_PATH=/usr/share/gconf/cinnamon.default.path - [ ] QT_QPA_PLATFORMTHEME=qt5ct - [ ] PWD=/home/artem/git/ClanLib - [ ] HOME=/home/artem - [ ] SSH_AGENT_PID=1185 - [ ] TERM_PROGRAM=vscode - [ ] TERM_PROGRAM_VERSION=1.28.2 - [ ] QT_ACCESSIBILITY=1 - [ ] XDG_SESSION_TYPE=x11 - [ ] XDG_DATA_DIRS=/app/share:/usr/share:/usr/share/runtime/share:/run/host/share - [ ] GI_TYPELIB_PATH=/app/lib/girepository-1.0 - [ ] XDG_SESSION_DESKTOP=cinnamon - [ ] LC_ADDRESS=km_KH - [ ] GJS_DEBUG_OUTPUT=stderr - [ ] LC_NUMERIC=km_KH - [ ] DESKTOP_STARTUP_ID=cinnamon-1526-artem-GT70-2PC-/usr/bin/flatpak-1_TIME12552930 - [ ] FLATPAK_SANDBOX_DIR=/home/artem/.var/app/com.visualstudio.code/sandbox - [ ] GTK_MODULES=gail:atk-bridge - [ ] TERM=xterm-256color - [ ] SHELL=/bin/sh - [ ] XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0 - [ ] XDG_CURRENT_DESKTOP=X-Cinnamon - [ ] GPG_AGENT_INFO=/run/user/1000/gnupg/S.gpg-agent:0:1 - [ ] GIO_LAUNCHED_DESKTOP_FILE=/var/lib/flatpak/exports/share/applications/com.visualstudio.code.desktop - [ ] SHLVL=2 - [ ] XDG_SEAT=seat0 - [ ] LANGUAGE=ru - [ ] LC_TELEPHONE=km_KH - [ ] GDMSESSION=cinnamon - [ ] GNOME_DESKTOP_SESSION_ID=this-is-deprecated - [ ] XDG_CACHE_HOME=/home/artem/.var/app/com.visualstudio.code/cache - [ ] LOGNAME=artem - [ ] DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus - [ ] XDG_RUNTIME_DIR=/run/user/1000 - [ ] XAUTHORITY=/run/user/1000/Xauthority - [ ] XDG_DATA_HOME=/home/artem/.var/app/com.visualstudio.code/data - [ ] XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session0 - [ ] XDG_CONFIG_DIRS=/app/etc/xdg:/etc/xdg - [ ] PATH=/app/bin:/usr/bin:/home/artem/.var/app/com.visualstudio.code/data/node_modules/bin - [ ] LC_IDENTIFICATION=km_KH - [ ] CINNAMON_VERSION=3.8.9 - [ ] NPM_CONFIG_GLOBALCONFIG=/app/etc/npmrc - [ ] GJS_DEBUG_TOPICS=JS ERROR;JS LOG - [ ] SESSION_MANAGER=local/artem-GT70-2PC:@/tmp/.ICE-unix/1120,unix/artem-GT70-2PC:/tmp/.ICE-unix/1120
jerch commented 5 years ago

RPATH is not meant to be set directly as env var (discouraged for many many years), it acts behind the scenes (see https://wiki.debian.org/RpathIssue). I still think your system simply launches the wrong shell for vscode, maybe it cannot resolve bash due a custom install path (multiple bash versions installed)?

What are the shown results of these two commands:

for the system terminal emulator and vscode's emulator? Please also post the output of env. Does running bash -li in the integrated terminal change anything?

ArtHome12 commented 5 years ago

Thank you for help. Below result of the commands

OS terminal - [ ] art@artPC:~$ echo $0 - [ ] bash - [ ] art@artPC:~$ make -v - [ ] GNU Make 4.1 - [ ] Эта программа собрана для x86_64-pc-linux-gnu - [ ] Copyright (C) 1988-2014 Free Software Foundation, Inc. - [ ] Лицензия GPLv3+: GNU GPL версии 3 или новее - [x] Это свободное программное обеспечение: вы можете свободно изменять его и - [ ] распространять. НЕТ НИКАКИХ ГАРАНТИЙ вне пределов, допустимых законом.
VSCode terminal - [ ] sh-4.4$ echo $0 - [ ] /bin/sh - [ ] sh-4.4$ make -v - [ ] GNU Make 4.2.1 - [ ] Эта программа собрана для x86_64-unknown-linux-gnu - [ ] Copyright (C) 1988-2016 Free Software Foundation, Inc. - [ ] Лицензия GPLv3+: GNU GPL версии 3 или новее - [ ] Это свободное программное обеспечение: вы можете свободно изменять его и - [ ] распространять. НЕТ НИКАКИХ ГАРАНТИЙ вне пределов, допустимых законом.
jerch commented 5 years ago

here we go: /bin/sh vs. bash. Maybe your system has a custom path to the bash executable, you can explicitly set it in the terminal settings. Still weird that your /bin/sh shell cannot resolve the arch triplet correctly, at least on my Ubuntu machine this works as expected (also Debian based).

Edit: Oh well, you have different build sets installed, see "GNU Make 4.1" vs. "GNU Make 4.2.1". For some reason /bin/sh defaults to the other one. To fix that you have to consult your distro's help (in Ubuntu you can switch buildsets with the update-alternatives command).

ArtHome12 commented 5 years ago

I figured out the problem. There are two ways to install VS Code:

  1. Download from https://code.visualstudio.com/ and install with GDebi (default in my environment). It gives a warning that it is better to use the program manager. But I say no and receive a correct version of VS Code and in the start menu I see /usr/share/code/code --unity-launch %F.
  2. If I use the program manager, I get all the weird problems described above. It runs VSCode with /usr/bin/flatpak run --branch=stable --arch=x86_64 --command=code --file-forwarding com.visualstudio.code --reuse-window @@ %F @@

Both versions of VSCode work without interfering with each other. :)

So this problem does not apply to VS Code and I will close the thread in a few days. Please advise where to report this problem (latest linux mint + program manager + flatpack).