Skip to content

CE Installation

luni64 edited this page Jan 31, 2022 · 1 revision

Installing CE locally requires an installation of

Installing Git

If not yet installed, download the current version of git from here: https://git-scm.com/downloads. During installation you can choose standard settings. However, on the setup page Choosing the default editor used by Git, selecting vsCode instead of the default VIM might be a good idea.

To check the installation you can open a vsCode terminal and type

git version

which should print something like:

git version 2.33.0.windows.2

If it doesn't find git, rebooting the PC might help to propagate the changed PATH variable to vsCode.

Installing Node.js

You need node.js to run the compiler explorer. If you don't have it installed already you can download it from here: https://nodejs.org/en/. Installation is straight forward. To check the installation, open a terminal in vsCode and type

npm version

which should print out something like

npm version
{
  npm: '8.1.2',
  node: '16.13.2',
  v8: '9.4.146.24-node.14',
  uv: '1.42.0',
  zlib: '1.2.11',
  brotli: '1.0.9',
  ares: '1.18.1',
  modules: '93',
  nghttp2: '1.45.1',
  napi: '8',
  llhttp: '6.0.4',
  openssl: '1.1.1l+quic',
  cldr: '39.0',
  icu: '69.1',
  tz: '2021a',
  unicode: '13.0',
  ngtcp2: '0.1.0-DEV',
  nghttp3: '0.1.0-DEV'
}

Installing the compiler explorer

Make a folder into which you want to install the Compiler Explorer (you'll need full read/write access to this folder). The following assumes you want to install CE into c:\toolchain. Of course you can choose any other folder as well.

In a vsCode terminal type

md c:\toolchain
cd c:\toolchain
git clone https://github.com/compiler-explorer/compiler-explorer.git

This will clone the CE sources into c:\toolchain\compiler-explorer\. During cloning, Git should generate logging output similar to this:

PS C:\toolchain\CE> git clone https://github.com/compiler-explorer/compiler-explorer.git
Cloning into 'compiler-explorer'...
remote: Enumerating objects: 40559, done.
remote: Counting objects: 100% (1580/1580), done.
remote: Compressing objects: 100% (776/776), done.
Receiving objects: 100% (40559/40559), 25.89 MiB | 6.49 MiB/s, done.
Receiving objects: 100% (40559/40559), 21.47 MiB | 6.13 MiB/s, done.
Resolving deltas:  13% (3651/28079)
Resolving deltas: 100% (28079/28079), done.
Updating files: 100% (1406/1406), done.

We need to set a config file before installing CE. Create a file c++.local.properties in etc/config/ and copy the text from below into it

needsMulti=false

###############################
# GCC for ARM

compilers=&gccarm
group.gccarm.compilers=g54:g10:td
defaultCompiler=td
libs=

# From Arduino/Teensyduino installation
compiler.td.exe=c:/toolchain/Arduino/arduino-1.8.15/hardware/tools/arm/bin/arm-none-eabi-gcc.exe
compiler.td.demangler=c:/toolchain/Arduino/arduino-1.8.15/hardware/tools/arm/bin/arm-none-eabi-c++filt.exe
compiler.td.arm1020.semver=5.4
compiler.td.name=Teensyduino

# GCC 5.4
compiler.g54.exe=c:/toolchain/gcc/gcc-arm-none-eabi-5_4-2016q3-20160926-win32/bin/arm-none-eabi-gcc.exe
compiler.g54.demangler=c:/toolchain/gcc/gcc-arm-none-eabi-5_4-2016q3-20160926-win32/bin/arm-none-eabi-c++filt.exe
compiler.g54.arm1020.semver=5.4
compiler.g54.name=g++ 5.4 2016 Q3

# GCC 10.3
compiler.g10.exe=c:/toolchain/gcc/gcc-arm-none-eabi-10.3-2021.07/bin/arm-none-eabi-gcc.exe
compiler.g10.demangler=c:/toolchain/gcc/gcc-arm-none-eabi-10.3-2021.07/bin/arm-none-eabi-c++filt.exe
compiler.g10.arm1020.semver=10.3
compiler.g10.name=g++ 10.3 2021.07

You only need one compiler. But, if you define more in the config file you can easily switch them later. Please adjust the path to the compiler and the demangling tool to your installation. Most likely you will use the compiler from your current Arduino installation.

Now, you can install the Compiler Explorer by executing the following commands in the vsCode terminal:

cd c:\toolchain\compiler-explorer
npm install
npm install webpack -g
npm install webpack-cli -g
npm update webpack

The steps will take some time but they will finish finally. During installation you'll see a couple of warnings which I decided to ignore for the time being.

Starting the Compiler Explorer

To start the Compiler Explorer you open a cmd window (better not do this from within vsCode) and type

npm start

This will start a local web server which hosts the Compiler-Explorer at port 10240. (At first start the Windows firewall probably asks for allowance for opening this port). Starting up CE will take some time but at the end and a lot of warnings about not found compilers you should see a message like

...
info:   Listening on http://localhost:10240/
info:   Startup duration: 18797ms
info: =======================================

To verify the installation use your web browser and open http://localhost:10240/. This should open your local Compiler Explorer GUI which should be fully functional.

Installing the Compiler Explorer vsCode-extension

This is done the same way you install any vsCode extension. Here a link to the extension

DONE