Clone and Build LLVM with the Experimental WebAssembly Target

Guy Bedford
InstructorGuy Bedford
Share this video with your friends

Social Share Links

Send Tweet
Published 7 years ago
Updated 5 years ago

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.

[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.

egghead
egghead
~ 7 minutes ago

Member comments are a way for members to communicate, interact, and ask questions about a lesson.

The instructor or someone from the community might respond to your question Here are a few basic guidelines to commenting on egghead.io

Be on-Topic

Comments are for discussing a lesson. If you're having a general issue with the website functionality, please contact us at support@egghead.io.

Avoid meta-discussion

  • This was great!
  • This was horrible!
  • I didn't like this because it didn't match my skill level.
  • +1 It will likely be deleted as spam.

Code Problems?

Should be accompanied by code! Codesandbox or Stackblitz provide a way to share code and discuss it in context

Details and Context

Vague question? Vague answer. Any details and context you can provide will lure more interesting answers!

Markdown supported.
Become a member to join the discussionEnroll Today