[cfe-users] Building with Clang (on Windows) - but for Linux

Csaba Raduly via cfe-users cfe-users at lists.llvm.org
Tue Aug 25 09:51:24 PDT 2020


Hi John,

On Tue, 25 Aug 2020 at 17:47, John Emmas via cfe-users
<cfe-users at lists.llvm.org> wrote:
>
> Sorry about the confusing subject line!!  I use Visual Studio 2019 on
> Windows 10 and I've just installed something called WSL (Windows
> Subsystem for Linux) which allows it to build apps for Linux.  A big
> part of this involves installing a Linux distro and I've chosen Debian
> (mostly it just installs basic utilities and a bash shell).
>
> Part of the process involved me issuing this bash command:-
>
>      sudo apt-get install openssh-server g++ gdb gdbserver
>
> After which, I could then build g++ Linux apps - even though I'm running
> everything in Windows.  I then did this:-
>
>      sudo apt-get install clang
>
> So I can now build with clang, as well as g++ - but what about
> debugging?  Should I have also installed a clang debugger?  And if so,
> what would be the apt-get command for that?  Thanks,

You can debug programs created by clang with gdb (which you already installed).

Clang has its own debugger (called lldb). It's packaged separately and
you can install it with

  sudo apt-get install lldb

(You can also debug programs created with g++ with lldb. Such is the
power of open standards)

However, I would recommend checking out Visual Studio Code, which can
do remote development (including debugging) on WSL (vscode runs on
Windows, compilers and debuggers run on WSL).

Csaba
-- 
You can get very substantial performance improvements
by not doing the right thing. - Scott Meyers, An Effective C++11/14 Sampler
So if you're looking for a completely portable, 100% standards-conformant way
to get the wrong information: this is what you want. - Scott Meyers (C++TDaWYK)


More information about the cfe-users mailing list