Building upstream clang with emsdk?

33 views
Skip to first unread message

Brion Vibber

unread,
Aug 5, 2019, 2:54:08 PM8/5/19
to emscripten Mailing List
As of a few months ago I was able to locally build upstream clang with emsdk by running:

./emsdk install upstream-clang-master-64bit

This seems to have stopped working somewhere along the line and I get "No tool or SDK found by name upstream-clang-master-64bit"

I know I can install binaries on supported platforms with "latest-upstream", but on unsupported platforms and when making patches to LLVM I need to build from source. Is there a new SDK name for upstream, or some other way to trigger the build? Thanks!

-- brion

Brion Vibber

unread,
Aug 5, 2019, 4:51:24 PM8/5/19
to emscripten Mailing List
To answer my own question, this appears to have been disabled because it's broken since LLVM changed repository layouts...?

However it's possible to build LLVM oneself, something like this:

cmake \
-DLLVM_ENABLE_PROJECTS="clang;lld" \
-G "Unix Makefiles" \
-DCMAKE_INSTALL_PREFIX=/opt/llvm \
-DLLVM_TARGETS_TO_BUILD='WebAssembly;X86' \
../llvm

(I used /opt/llvm as the target path, you may choose another.) Note I had to explicitly enable the 'lld' project to get the 'wasm-ld' linker to install.

Then do make && make install with suitable parallel jobs option in -j (-j12 on my 6-core/12-thread laptop).

Then set the LLVM_PATH in ~/.emscripten, and I also had to add it manually to PATH.

Now run the rest of the build as usual, with the new clang/llvm/wasm-ld/etc being picked up automatically.

-- brion

Alon Zakai

unread,
Aug 5, 2019, 4:52:47 PM8/5/19
to emscripte...@googlegroups.com
Yeah, I think those broke when upstream LLVM changed to a monorepo, I noticed that at some point. And it's possible we later removed those broken configs in a refactoring, I'm not sure.

If they are useful it would be nice to fix them!

- Alon


--
You received this message because you are subscribed to the Google Groups "emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-disc...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/emscripten-discuss/CAFnWYT%3DCsEbB0QCP71jsy8Th0f%2BqcpVSbkkTKxHWqAc1g%2B7XHA%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages