This Lesson is for Members

Subscribe today and get access to all lessons! Plus direct HD download for offline use, enhances transcripts, member comment forums, and iTunes "podcast" RSS feed. Level up your skills now!

Unlock This Lesson

Already subscribed? Sign In

Autoplay

    Clone and Build LLVM with the Experimental WebAssembly Target

    Guy BedfordGuy Bedford

    This lesson demonstrates a full build of LLVM roughly following the steps in GettingStarted.html (or GettingStartedVS.html for Windows), but with the experimental WebAssembly target build option. Prerequisites include cmake (which can be downloaded from cmake.org/download), Visual Studio on windows, or Xcode command line tools on mac.

    Code

    Code

    Become a Member to view code

    You must be a Member to view code

    Access all courses and lessons, track your progress, gain confidence and expertise.

    Become a Member
    and unlock code for this lesson
    Transcript

    Transcript

    00:02 Before installing LLVM, you want to just check a few prerequisites. You should check that you have GCC installed, a version of Make and a version of CMake as well.

    00:12 If you don't have GCC or Make, then it's advisable to run a Xcode-Select installed on Mac to make sure you've got the Xcode online tools. In Windows, you want to have VisualStudio installed. For CMake, you can download this from the website in the documentation of this lesson.

    00:31 I'm going to start off by cloning LLVM, and I'm going to use a mirror just so we can do this five gits. Once that's complete, we can go into this LLVM folder. Within the tools folder, we want a clone Clang. Again, I'm going to use the LLVM Mirror. With Clang installed, I'm going to back out of this tools folder. I'm going to make a folder below the LLVM folder called LLVM Build.

    01:04 Within this folder, I can now use our CMake command to setup the build. Here's the command we're going to use.

    01:11 In windows, this Unix Makefiles would be Visual Studio instead. I'm building into another folder called LLVM Wasm which is going to contain the final build outputs. We're moving all the targets. We're building for the Wasm32 Architecture as a WebAssembly target from the source in the LLVM folder.

    01:32 Once CMake completes, we can then begin the built process. This is going to take about an hour or so. I'm going to use the J8 flag so that we run Make in parallel and then a Make install.

    01:50 In Windows, I would need to inaudible VisualStudio and open the llvm.sln file to start the build from there. When the build eventually completes, we can check if we've got our C compiler available at LLVM Wasm then Clang. To free up some space, this LLVM Build folder can then be removed.

    Discuss

    Discuss