microsoft / vscode-cpptools

Official repository for the Microsoft C/C++ extension for VS Code.
Other
5.51k stars 1.55k forks source link

Add ARM64 support (linux) #2506

Closed bobbrow closed 4 years ago

bobbrow commented 6 years ago

2497 was opened as a result of missing ARM64 support on linux. Please upvote this issue if you need support for aarch64.

hamaney commented 4 years ago

@sean-mcmanus In our process we use EC2 ARM instances for debgging/building so memory is not an issue at the development stage.

sean-mcmanus commented 4 years ago

We've added an aarch64 vsix at https://github.com/microsoft/vscode-cpptools/releases/tag/0.30.0-insiders2 . Let us know if anyone encounters any issues with that (particularly since the language service binaries were compiled for 32-bit armhf and not aarch64). One known issue is libtinfo5 needs to be installed for clang-format to run (https://github.com/microsoft/vscode-cpptools/issues/5958).

7oud commented 4 years ago

The aarch64 vsix can not work on Jestson NX, Here are some notifications

Unable to start the C/C++ language server. IntelliSense features will be disabled. Error: Launching server using command /home/xxx/.vscode-server/extensions/ms-vscode.cpptools-0.30.0-insiders2/bin/cpptools failed.

Couldn't start client cpptools
hamaney commented 4 years ago

Notification

Couldn't start client cpptools
Unable to start the C/C++ language server. IntelliSense features will be disabled. 
Error: Launching server using command /home/ubuntu/.vscode-server-insiders/extensions/ms-vscode.cpptools-0.30.0-insiders2/bin/cpptools failed.

In OUTPUT

[Error - 2:31:15 AM] Starting client failed
Launching server using command 
/home/ubuntu/.vscode-server-insiders/extensions/ms-vscode.cpptools-0.30.0-insiders2/bin/cpptools failed

However, I pressed F5 and it seems to be debugging normally!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! awesome

sean-mcmanus commented 4 years ago

@7oud @hamaney Thanks for letting us know -- we'll continue looking into fixing our build of cpptools/cpptools-srv for the aarch64 target. Yeah, the debugger is arm64-specific already.

rmurphy-arm commented 4 years ago

Note that not all AArch64 kernels will include the compat layer necessary to run 32-bit Arm binaries - I know my usual distro doesn't enable it. Also there are some CPUs out there that have no AArch32 support at all (e.g. Cavium ThunderX), so ultimately you will want a proper native AArch64 build.

prutschman commented 4 years ago

Launching cpptools (from 0.30.0-insiders2) on aarch64 failed for me, but not for the reason I expected.

$ $HOME/.vscode-server/extensions/ms-vscode.cpptools-0.30.0-insiders2/bin/cpptools
-bash: <home>/.vscode-server/extensions/ms-vscode.cpptools-0.30.0-insiders2/bin/cpptools: No such file or directory
$ file <...>cpptools
<...> ELF 32-bit LSB executable, ARM, EABI5 version 1 (GNU/Linux), dynamically linked, interpreter /lib/ld-, for GNU/Linux 3.2.0, BuildID[sha1]=2ca2ba5e900189d2357bc950df7d3b9373690623, not stripped

It looks like something went wrong with the ld-linux path?

If I try invoking it directly with the platform ld-linux, then it of course fails for the expected reason. (And there's no 32-bit userland on this platform, so I can't just invoke the proper ld-linux)

$ /lib/ld-linux-aarch64.so.1 <...> cpptools
<...>/cpptools: error while loading shared libraries: <...>/cpptools: wrong ELF class: ELFCLASS32
sean-mcmanus commented 4 years ago

@prutschman The binary is built for armhf and not aarch64 -- are you saying you think there's a different problem? Good news is we got our aarch64 build fixed, so we should be able to publish a new vsix some time next week.

prutschman commented 4 years ago

Looking forward to the aarch64 build!

It had looked like the embedded ld.so path was truncated, but I've tested a few other binaries on my system that are aarch64 (and load fine) and file also shows the same truncated path on those. So, forget I said anything.

Specifically, I was referring to this part of the output of running file cpptools: dynamically linked, interpreter /lib/ld-, for GNU/Linux 3.2.0

cfriedt commented 4 years ago

@sean-mcmanus - in general, most Linux distros do not support both armhf and Aarch64 - it's typically one or the other - simply to avoid duplicating libraries (multi-arch). The kernel will usually be compiled to support both executable formats though.

Looking forward to when I can test this out on my Acer Chromebook R13 :-)

Is there a link to official Aarch64 builds for code? I've been using headmelted, but presumably MS will be distributing an official one, no?

sean-mcmanus commented 4 years ago

@cfriedt VS Code for ARM/ARM64 is being tracked by https://github.com/microsoft/vscode/issues/6442 and https://github.com/microsoft/vscode/issues/1031 -- I don't know what their plan is. Currently, our ARM support is only via remoting to an ARM machine from a non-ARM machine, which I suspect is not what most people requesting ARM support want. The headmelted release is currently too out-of-date since our extension requires VS Code version 1.44 or newer, and our license currently prohibits running in headmelted (not sure yet if we should try to update our license, and also our debugger will disable itself).

alexdewar commented 4 years ago

@sean-mcmanus Pleeeeease update the licence :smiley:. VS code having a permissive license means people can do their own thing that upstream might not be interested in (e.g. independently packaging it for a distro) but it's a shame that we can't then use some of these standard extensions with it.

sean-mcmanus commented 4 years ago

We encourage everyone who wants to use our extension with a local ARM64 release of VS Code to upvote https://github.com/microsoft/vscode/issues/6442 . It is currently number 24 on VS Code's list of upvotes and behind releasing for ipad and Windows store.

sean-mcmanus commented 4 years ago

We added aarch64 language service binaries with https://github.com/microsoft/vscode-cpptools/releases/tag/0.30.0-insiders3 . If you have 0.30.0-insiders2, updateChannel set to Insiders, and autoUpdate set to true, it should auto-update.

However, it has a glibc 2.28 minimum dependency, so it will only work on Ubuntu 20 or Debian 10 unless glibc is somehow updated.

Ubuntu 18 (glibc 2.27 minimum) support is planned for 0.30.0-insiders4: https://github.com/microsoft/vscode-cpptools/issues/5993 Ubuntu 16 or Debian 9 support is not currently planned, but you can upvote that at: https://github.com/microsoft/vscode-cpptools/issues/5984

prashantjain25 commented 4 years ago

The Code formatting is not working, installed ".vsix" offline.

sean-mcmanus commented 4 years ago

@prashantjain25 You're likely hitting https://github.com/microsoft/vscode-cpptools/issues/5958 . libtinfo5 needs to be installed (as a workaround).

sean-mcmanus commented 4 years ago

Ubuntu 14-18, Debian 8-9, CentOS 7 support got added with https://github.com/microsoft/vscode-cpptools/releases/tag/0.30.0-insiders4 (i.e. glibc 2.17 minimum).

alexlamfb commented 4 years ago

Successfully installed on my arm64 system with the vsix package. It works SO much better than the previous combo of plugins I was using. A+++, would buy again.

prutschman commented 4 years ago

Thank you! Up and running on nvidia linux4tegra on Jetson TX2 now!

sean-mcmanus commented 4 years ago

VS Code ARM64 support is available in the Insiders release at https://github.com/microsoft/vscode/pull/106289#issuecomment-691076575 .

sean-mcmanus commented 3 years ago

@prashantjain25 The code formatting issue is fixed with https://github.com/microsoft/vscode-cpptools/releases/tag/1.2.0-insiders2