kripken / box2d.js

Port of Box2D to JavaScript using Emscripten
1.34k stars 195 forks source link

make problem on macosx #39

Open no-zzz-un opened 11 years ago

no-zzz-un commented 11 years ago

On MaxOSX, I get the following when trying to emmake make this project. Does anyone else encounter this?

cpp -x c++ -DEM_NO_LIBCPP -IBox2D_v2.2.1 root.h > box2d.clean.h
i686-apple-darwin11-llvm-gcc-4.2: c: No such file or directory
i686-apple-darwin11-llvm-gcc-4.2: c++: No such file or directory
i686-apple-darwin11-llvm-gcc-4.2: warning: '-x -x' after last input file has no effect
i686-apple-darwin11-llvm-gcc-4.2: no input files
make: *** [box2d.clean.h] Error 1
bunnyhero commented 11 years ago

I had to make these changes to get it to build on Mac OS X:

https://github.com/bunnyhero/box2d.js/commit/0ef6eacc07996a7b8f1f4aabb05fb308fcbc8612#Makefile

no-zzz-un commented 11 years ago

thanks, but unfortunately this just leads to another problem:

cpp -xc++ -DEM_NO_LIBCPP -IBox2D_v2.2.1 root.h > box2d.clean.h
# CppHeaderParser doesn't like Xcode's cpp output: this fixes it.
sed -i -e 's/__signed/signed/g;s/__const/const/g' box2d.clean.h
python 1/tools/bindings_generator.py box2d_bindings box2d.clean.h -- '{ "ignored": "b2Shape::m_type,b2BroadPhase::RayCast,b2BroadPhase::UpdatePairs,b2BroadPhase::Query,b2DynamicTree::RayCast,b2DynamicTree::Query,b2ChainShape::m_nextVertex,b2ChainShape::m_hasNextVertex,b2EdgeShape::m_hasVertex3,b2EdgeShape::m_vertex2,b2EdgeShape::m_vertex3,b2Mat22,b2Mat33" }' > bindings.out
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: can't open file '1/tools/bindings_generator.py': [Errno 2] No such file or directory
make: *** [box2d_bindings.cpp] Error 2
bunnyhero commented 11 years ago

Oh yeah, I forgot. You also have to add a line like this:

EMSCRIPTEN=/Users/bunnyhero/dev/github/emscripten

except substituting the path to your emscripten directory.

You can either add that line to the Makefile, or (as I did), put it in a file named Makefile.local in the same directory as the Makefile (it will get included).

no-zzz-un commented 11 years ago

thanks, this seems to have fixed everything!

timotheecour commented 10 years ago

This doesn't work for me: cpp points to apple's version of clang that uses a different version of llvm.

should I use {/path/to/correct/clang -E} instead of {cpp} ? that compiles but with lots of warnings (eg: has C-linkage specified, but returns user-defined type), and the resulting html doesn't work properly.

jarbot commented 10 years ago

This fix is not working for me either. I tried installing the 3.2 and 3.3 version of LLVM.

I followed these instructions manually as well as with brew: https://github.com/kripken/emscripten/wiki/Getting-started-on-Mac-OS-X

I'm on osx 10.9.3. Here's the errors I'm currently seeing (with LLVM 3.2): https://gist.github.com/jarbot/0af2ace168d3b12030e0

I switched over to an Ubuntu 14 VM with similar results: https://gist.github.com/jarbot/20377f66318b21b3e549

jarbot commented 10 years ago

I was finally able to get a emscripten build working on box2d on Ubuntu 14 by following these instructions https://github.com/kripken/emscripten/wiki/LLVM-Backend#getting-fastcomp for setting up LLVM and clang. I followed the exact same steps for Mac os 10.9 and still see these errors: https://gist.github.com/jarbot/0af2ace168d3b12030e0