Building on OS X 10.8

65 views
Skip to first unread message

martin....@gmx.net

unread,
Jun 10, 2015, 8:38:20 AM6/10/15
to emscripte...@googlegroups.com
Hi!

I've got some trouble trying to get emsdk installed on Mac OS X 10.8.5. At first the clang build it complains about

Host Clang must be able to find libstdc++4.7 or newer!
I've found a Japanese article which apparently suggests adding -DLLVM_ENABLE_LIBCXX=ON to the CMake argument list.
With that, clang got compiled but emscripten itself now fails:

…/emscripten/master/tools/optimizer/simple_ast.h:15:10: fatal error:
'unordered_set' file not found
#include <unordered_set>
^

This sounds like issue #2997 so perhaps the changes made there can be extended somewhat.
In particular, you could provide some way in which the user can supply a compiler command name in the environment, so that I could try out alternatives, e.g. the `clang++-mp-3.7` I can install using MacPorts.

Should I file bug reports for any of this?

Jukka Jylänki

unread,
Jun 10, 2015, 11:13:29 AM6/10/15
to emscripte...@googlegroups.com
If you use the default system Clang that you have there, and write a small test application that includes unordered_set, does that work, or does it fail in the same manner? (Remember to compiled with -std=c++11)

emsdk uses CMake to configure the builds of the compiler and the native optimizer, and it does not use anything special to pick the compiler on non-Windows, so you should be able to use CMake-specific means to specify the compiler to be used. See e.g. here: http://www.cmake.org/Wiki/CMake_FAQ#Method_1:_use_environment_variables . Haven't tested, but I expect that should work on non-Windows systems.

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

martin....@gmx.net

unread,
Jun 10, 2015, 8:10:33 PM6/10/15
to emscripte...@googlegroups.com
On Wednesday, June 10, 2015 at 5:13:29 PM UTC+2, jj wrote:
If you use the default system Clang that you have there, and write a small test application that includes unordered_set, does that work, or does it fail in the same manner? (Remember to compiled with -std=c++11)

It fails in the same way. It even fails if I use clang++-mp-3.7 from MacPorts, see http://stackoverflow.com/q/30757580/1468366 for details.

On the other hand, it succeeds if I also pass -stdlib=libc++ on the command line. And indeed, a plain vanilla emsdk can build both clang and emscripten if I have CXXFLAGS=-stdlib=libc++ in the environment. Apparently without any need for MacPorts at all (except perhaps for git). Perhaps you should always include that setting for OS X? Or at least document it somewhere?

chronotext

unread,
Jun 11, 2015, 7:29:26 AM6/11/15
to emscripte...@googlegroups.com
The problem described here sounds like a known XCode issue to me:

If you want to build C++11 code with a "recent" SDK (e.g. MacOSX10.10.sdk) while keeping an older deployment-target:
It is not enough to pass "-mmacosx-version-min" in the CXX_FLAGS

The solution is to pass "-stdlib" as well, e.g.
"-mmacosx-version-min=10.8 -stdlib=libc++"

HTH,
Ariel

Jukka Jylänki

unread,
Jun 18, 2015, 6:33:11 AM6/18/15
to emscripte...@googlegroups.com
Thanks, I authored this commit to assist in this issue: https://github.com/juj/emsdk/commit/bc56d6eee02b637c96a18127e4f58e5476b2a885 . Tested building on my OS X 10.10.2, and there it looked safe to keep that flag in the build at all times, so I think that should be good to do unconditionally.

--
Reply all
Reply to author
Forward
0 new messages