About Talks Articles

Playing with ChakraCore on Linux

2 min read

ChakraCore, the JavaScript engine that powers the new Edge browser, has been open-sourced by Microsoft. While currently it only runs on Windows, support for other operating systems is in the roadmap. It is fun to follow the progress of the Linux version of ChakraCore.

Obviously, nothing works on Linux yet since the porting is still in its early stage. For a start, ChakraCore Windows is built using Visual Studio. For other platforms, the build process needs to use CMake.

On top of that, Windows-specific API needs to be abstracted. The ChakraCore team decides to bring the important bits and pieces from CoreCLR, another open-source .NET core runtime from Microsoft. CoreCLR already contains the so-called PAL, Platform Adaptation Layer, that deals with file handling, memory management, thread, etc. It does make sense to leverage PAL since it already works quite well for multi-OS support in CoreCLR.


How to play with ChakraCore Linux? The easiest is using a virtual machine so that you can do it if your host machine is OS X. In fact, even on Linux host, it is quite beneficial to isolate the setup from your main working environment. I use Vagrant since this is the fastest to prepare. Since ChakraCore Linux requires Clang version 3.5, the easiest is to base your system on Ubuntu 15.10 (Wily Werewolf):

vagrant init ubuntu/wily64
vagrant up && vagrant ssh

You need a couple of good packages:

sudo apt-get -y update
sudo apt-get install -y build-essential git cmake clang

Switch from GCC to Clang:

export CC="$(which clang)"
export CXX="$(which clang)"

Now the party begins. Clone the repository of ChakraCore, switch to the Linux branch, and have fun!

git clone
cd ChakraCore
git branch linux origin/linux
git checkout linux
cmake . && make
Related posts:

♡ this article? Explore more articles and follow me Twitter.

Share this on Twitter Facebook

comments powered by Disqus