How to use LLVM/Clang version 7 to build WASM binaries

125 views
Skip to first unread message

Osman Zakir

unread,
Nov 20, 2018, 5:23:43 PM11/20/18
to emscripten-discuss
I want to know how I can use LLVM/Clang version 7 with Emscripten.  Is it possible?  

Along with that I'd like help on the other questions I've asked (sorry for opening more than one thread).  

My code is here: https://github.com/DragonOsman/currency_converter .  The code I want to compile to WebAssembly is of course currency_converter.cpp (it's using Boost.ASIO's asynchronous networking functions).  I used the official port of ASIO that's been added to the Emscripten Ports GitHub page.  I think someone should verify the version used somehow, but for now it's probably okay.

Sam Clegg

unread,
Nov 20, 2018, 5:29:51 PM11/20/18
to emscripte...@googlegroups.com
On Tue, Nov 20, 2018 at 2:23 PM Osman Zakir <osman...@gmail.com> wrote:
>
> I want to know how I can use LLVM/Clang version 7 with Emscripten. Is it possible?

If you want to use upstream llvm/clang with emscripten you probably
want to be using llvm HEAD which is currently on 8.0.0. This is
because there are still changes being made to the ABI and
emscripten/binaryen expects the latest version.

If you don't want to build from source you can grab a version of the
emsdk that contains the upstream backend.
e.g emsdk install sdk-upstream-1892-64bit.

>
> Along with that I'd like help on the other questions I've asked (sorry for opening more than one thread).
>
> My code is here: https://github.com/DragonOsman/currency_converter . The code I want to compile to WebAssembly is of course currency_converter.cpp (it's using Boost.ASIO's asynchronous networking functions). I used the official port of ASIO that's been added to the Emscripten Ports GitHub page. I think someone should verify the version used somehow, but for now it's probably okay.
>
> --
> 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.
> For more options, visit https://groups.google.com/d/optout.

Osman Zakir

unread,
Nov 20, 2018, 5:43:40 PM11/20/18
to emscripten-discuss
Thanks for the reply. I'll try the upstream emsdk.  

Osman Zakir

unread,
Nov 20, 2018, 5:46:14 PM11/20/18
to emscripten-discuss
The command for installing the upstream emsdk version gave me this error:
Error: No tool or SDK found by name 'sdk-upstream-1892-64bit'.

 

Osman Zakir

unread,
Nov 21, 2018, 6:14:26 AM11/21/18
to emscripten-discuss
What I want is the latest stable release.  I don't want the release candidates.  But yeah, please also help with the error I got when trying to install the upstream version.  

Osman Zakir

unread,
Nov 21, 2018, 6:16:11 AM11/21/18
to emscripten-discuss
Oh and, also, I installed LLVM version 7.0.0 which is why I wanted to know how to use it with Emscripten.  I read that it's possible to use the LLVM that doesn't have any of Emscripten-specific modifications, and that WebAssembly is intended to be a first-class target for LLVM.  That's why I asked.  

Sam Clegg

unread,
Nov 27, 2018, 5:25:47 PM11/27/18
to emscripte...@googlegroups.com
On Wed, Nov 21, 2018 at 3:16 AM Osman Zakir <osman...@gmail.com> wrote:
>
> Oh and, also, I installed LLVM version 7.0.0 which is why I wanted to know how to use it with Emscripten. I read that it's possible to use the LLVM that doesn't have any of Emscripten-specific modifications, and that WebAssembly is intended to be a first-class target for LLVM. That's why I asked.
>

There is indeed upstream support in LLVM for WebAssembly today. With
version 7.0.0 however it is not included by default (you need to
compile with `LLVM_EXPERIMENTAL_TARGETS_TO_BUILD=WebAssembly`).

Once version llvm version 8.0.0 is released it will have WebAssembly
as one of the default targets (see
https://reviews.llvm.org/D52850).

If you have such as version of LLVM on your system then emscripten
will use this LLVM_ROOT in your config file to point to this version.
Reply all
Reply to author
Forward
0 new messages