Building Boost with emscripten

July, 2018

Someone (sorry, I don't remember who) suggested WebAssembly as a way to easily let people use my software. Ok, let's try building Bertini_real, my algebraic curve and surface decomposer, into Web Assembly (WA). I am using a Mac at OS 10.13.

The first step for me is to install the tools to build for WA. The compiler is called emscripten, and it was downloaded and installed easily.

Next, we build Boost. First, of course, download the source code from the usual place: I used 1.67 and 1.68.b1 so far.

Bootstrap, to put together the build system. ./ Fine.

The next part, the actual compilation, doesn't go so well for me, despite people saying it should.

./b2 toolset=emscripten cxxflags=-std=c++14

It dies, giving a long error, most of which is not relevant:

where the relevant part is

Error: ambiguity found when searching for best transformation
Trying to produce type 'SEARCHED_LIB' from: 
Generators that succeeded:
 -  searched-lib-generator
 -  emscripten.searched-lib-generator
First generator produced: 
 -  { }
Second generator produced: 
 -  { }

I emailed the Boost users mailing list, and the immediate (and sadly short) reply was "set the default architecture", assuming I knew how to do this... No amount of googling provided the solution to set this.

I re-mailed the list, and the suggested solution was to add a few flags to the call to b2. i had, however, already tried both of these flags and they had had no effect -- doing it again (sanely) didn't produce different behaviour. Eventually, Steven Watanabe pointed out that it a was a bug, and then another person said it was unsupported. Finally, I got a response that Boost.Context doesn't have an assembler.

I will have to play around with building only the parts I really need, and give up on a full build for now. I do hope I follow up on this someday, but feel like I have to move on for now. If you succeed at building all of Boost using emscripten on a Mac, or are successful at all, really, at any part of Boost, please let me know! Heck, if you read this at all in any context, email me and I'll send you a 3d printed mathematical surface from my gallery.

Page last updated: 7/30/18
© 2013 - 2018 danielle brake contact me
Published using the Vector theme by Will Woodgate