monkey2 icon indicating copy to clipboard operation
monkey2 copied to clipboard

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

Open DoctorWhoof opened this issue 5 years ago • 8 comments

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 avatar Nov 03 '19 17:11 DoctorWhoof

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.

DoctorWhoof avatar Nov 04 '19 00:11 DoctorWhoof

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

blitz-research avatar Nov 16 '19 22:11 blitz-research

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

DoctorWhoof avatar Nov 17 '19 07:11 DoctorWhoof

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

blitz-research avatar Nov 21 '19 18:11 blitz-research

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

DoctorWhoof avatar Nov 21 '19 22:11 DoctorWhoof

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.

blitz-research avatar Nov 23 '19 01:11 blitz-research

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.

seyhajin avatar Apr 15 '20 09:04 seyhajin

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!

DoctorWhoof avatar Apr 16 '20 08:04 DoctorWhoof