Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Bullet module so that Monkey2 can be built on macOS Catalina #491

Open
DoctorWhoof opened this issue Nov 3, 2019 · 8 comments
Open

Comments

@DoctorWhoof
Copy link

DoctorWhoof commented Nov 3, 2019

Hi,
Monkey 2 was failing to build in macOS Catalina due to an error compiling the Bullet module.

I tried a "naive" Bullet update by simply replacing the existing Bullet source code with the latest one from Github. While that compiled the module successfully, now building Mojo3D fails, certainly due to changes made in this version of Bullet.

I can still use the Itch.IO precompiled Monkey 2, but that's almost a year old now.
Thanks!

@DoctorWhoof
Copy link
Author

DoctorWhoof commented Nov 4, 2019

Correction: The Itch.io version also doesn't work whenever Mojo3D is used (same error related to Bullet Physics) in Catalina. Examples that don't use Mojo3D run Ok.

@blitz-research
Copy link
Owner

Hi, I just updated to Catalina and the develop branch is building fine with xcode 10.2.1, what errors are you getting?

@DoctorWhoof
Copy link
Author

Just tried again, this is what I get when it tried to build the Bullet module.
(Xcode 11.2.1, macOS 10.15.1, Monkey 2 Develop branch)

***** Making module 'bullet' (macos release x64 gcc mx) *****

Parsing...
Semanting...
Translating...
Compiling...
Build error: System command failed:

g++ -c -std=c++14 -mmacosx-version-min=10.9 -Wno-deprecated-declarations -Wno-tautological-pointer-compare -Wno-undefined-bool-conversion -Wno-int-to-void-pointer-cast -Wno-inconsistent-missing-override -Wno-logical-op-parentheses -Wno-parentheses-equality -O3 -DNDEBUG -I"/Applications/Leo/monkey2/modules/" -I"/Applications/Leo/monkey2/modules/monkey/native" -I"/Applications/Leo/monkey2/modules/bullet/bullet3-2.85.1/src/" -I"/Applications/Leo/monkey2/modules/zlib/zlib-1.2.11/" -DNDEBUG=1 -DBB_THREADS=1 -MMD -MF"/Applications/Leo/monkey2/modules/bullet/bullet.buildv1.1.15/macos_release_mx/build/bullet20389a14.cpp.deps" -o "/Applications/Leo/monkey2/modules/bullet/bullet.buildv1.1.15/macos_release_mx/build/bullet20389a14.cpp.o" "/Applications/Leo/monkey2/modules/bullet/bullet.buildv1.1.15/macos_release_mx/src/bullet_bullet.cpp"

In file included from /Applications/Leo/monkey2/modules/bullet/bullet.buildv1.1.15/macos_release_mx/src/bullet_bullet.cpp:2:
In file included from /Applications/Leo/monkey2/modules/bullet/bullet.buildv1.1.15/macos_release_mx/include/bullet_bullet.h:6:
In file included from /Applications/Leo/monkey2/modules/bullet/bullet_glue.h:5:
In file included from /Applications/Leo/monkey2/modules/bullet/bullet3-2.85.1/src/btBulletDynamicsCommon.h:20:
In file included from /Applications/Leo/monkey2/modules/bullet/bullet3-2.85.1/src/btBulletCollisionCommon.h:22:
In file included from /Applications/Leo/monkey2/modules/bullet/bullet3-2.85.1/src/BulletCollision/CollisionDispatch/btCollisionWorld.h:80:
/Applications/Leo/monkey2/modules/bullet/bullet3-2.85.1/src/LinearMath/btVector3.h:340:7: error: argument value 10880 is outside the valid range [0, 255] [-Wargument-outside-range]
y = bt_splat_ps(y, 0x80);
^~~~~~~~~~~~~~~~~~~~
/Applications/Leo/monkey2/modules/bullet/bullet3-2.85.1/src/LinearMath/btVector3.h:46:32: note: expanded from macro 'bt_splat_ps'
#define bt_splat_ps( _a, _i ) bt_pshufd_ps((_a), BT_SHUFFLE(_i,_i,_i,_i) )
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Applications/Leo/monkey2/modules/bullet/bullet3-2.85.1/src/LinearMath/btVector3.h:44:35: note: expanded from macro 'bt_pshufd_ps'
#define bt_pshufd_ps( _a, _mask ) _mm_shuffle_ps((_a), (_a), (_mask) )
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/11.0.0/include/xmmintrin.h:2608:11: note: expanded from macro '_mm_shuffle_ps'
(__m128)__builtin_ia32_shufps((__v4sf)(__m128)(a), (__v4sf)(__m128)(b),
^
In file included from /Applications/Leo/monkey2/modules/bullet/bullet.buildv1.1.15/macos_release_mx/src/bullet_bullet.cpp:2:
In file included from /Applications/Leo/monkey2/modules/bullet/bullet.buildv1.1.15/macos_release_mx/include/bullet_bullet.h:6:
In file included from /Applications/Leo/monkey2/modules/bullet/bullet_glue.h:5:
In file included from /Applications/Leo/monkey2/modules/bullet/bullet3-2.85.1/src/btBulletDynamicsCommon.h:20:
In file included from /Applications/Leo/monkey2/modules/bullet/bullet3-2.85.1/src/btBulletCollisionCommon.h:22:
In file included from /Applications/Leo/monkey2/modules/bullet/bullet3-2.85.1/src/BulletCollision/CollisionDispatch/btCollisionWorld.h:81:
In file included from /Applications/Leo/monkey2/modules/bullet/bullet3-2.85.1/src/LinearMath/btTransform.h:21:
/Applications/Leo/monkey2/modules/bullet/bullet3-2.85.1/src/LinearMath/btMatrix3x3.h:882:17: error: argument value 10880 is outside the valid range [0, 255] [-Wargument-outside-range]
__m128 vk = bt_splat_ps(_mm_load_ss((float *)&k), 0x80);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Applications/Leo/monkey2/modules/bullet/bullet3-2.85.1/src/LinearMath/btVector3.h:46:32: note: expanded from macro 'bt_splat_ps'
#define bt_splat_ps( _a, _i ) bt_pshufd_ps((_a), BT_SHUFFLE(_i,_i,_i,_i) )
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Applications/Leo/monkey2/modules/bullet/bullet3-2.85.1/src/LinearMath/btVector3.h:44:35: note: expanded from macro 'bt_pshufd_ps'
#define bt_pshufd_ps( _a, _mask ) _mm_shuffle_ps((_a), (_a), (_mask) )
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/11.0.0/include/xmmintrin.h:2608:11: note: expanded from macro '_mm_shuffle_ps'
(__m128)__builtin_ia32_shufps((__v4sf)(__m128)(a), (__v4sf)(__m128)(b),
^
2 errors generated.

***** Fatal mx2cc error *****

Internal mx2cc build error

@blitz-research
Copy link
Owner

Where'd you get xcode 11 from?!? I did check for updates after upgrading macos but everything was apparently up to date,

@DoctorWhoof
Copy link
Author

I believe I got it from the app store, right after I made a clean, fresh Catalina install (no upgrade).

@blitz-research
Copy link
Owner

Ok, got it now just had to manually install it. I'm a bit surprised macos thought everything was up to date though.

Anyway, at first glance this appears to be a bug in bullet but I'll take a closer look at it.

@seyhajin
Copy link
Contributor

Quick fix:

in btVector3.h file (/modules/bullet/bullet3-2.85.1/src/LinearMath) :

replace (line 42) :
#define BT_SHUFFLE(x,y,z,w) ((w)<<6 | (z)<<4 | (y)<<2 | (x))

with new code :
#define BT_SHUFFLE(x, y, z, w) (((w) << 6 | (z) << 4 | (y) << 2 | (x)) & 0xff)

To make sure it will not exceed 255.

@DoctorWhoof
Copy link
Author

Works! I can compile on MacOS again. Not creating a HiDPI window is still glitchy, but I always use that flag so I'm Ok. Thanks!

seyhajin added a commit to wonkey-coders/monkey2 that referenced this issue Nov 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants