erincatto / box2d

Box2D is a 2D physics engine for games
https://box2d.org
MIT License
8.36k stars 1.54k forks source link

Can't compile unit test on Apple M1 #701

Closed catap closed 2 years ago

catap commented 3 years ago

When I try to compile box2d on apple m1, I have tonns of errors like this:

/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_box2d/box2d/work/Box2D-2.4.1/unit-test/math_test.cpp:43:3: error: unrecognized instruction mnemonic, did you mean: bit, cnt, hint, ins, not?
                DOCTEST_REQUIRE_EQ(transform.p.x, sweep.c0.x);
                ^
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_box2d/box2d/work/Box2D-2.4.1/unit-test/doctest.h:2127:33: note: expanded from macro 'DOCTEST_REQUIRE_EQ'
#define DOCTEST_REQUIRE_EQ(...) DOCTEST_BINARY_ASSERT(DT_REQUIRE_EQ, eq, __VA_ARGS__)
                                ^
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_box2d/box2d/work/Box2D-2.4.1/unit-test/doctest.h:2102:9: note: expanded from macro 'DOCTEST_BINARY_ASSERT'
        DOCTEST_ASSERT_LOG_AND_REACT(_DOCTEST_RB);                                                 \
        ^
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_box2d/box2d/work/Box2D-2.4.1/unit-test/doctest.h:1727:9: note: expanded from macro 'DOCTEST_ASSERT_LOG_AND_REACT'
        DOCTEST_BREAK_INTO_DEBUGGER();                                                             \
        ^
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_box2d/box2d/work/Box2D-2.4.1/unit-test/doctest.h:351:47: note: expanded from macro 'DOCTEST_BREAK_INTO_DEBUGGER'
#define DOCTEST_BREAK_INTO_DEBUGGER() __asm__("int $3\n" : :)
                                              ^
<inline asm>:1:2: note: instantiated into assembly here
        int $3
        ^

This is clear that embedded unit-test aren't compatible with M1.

erincatto commented 2 years ago

I updated doctest. Please let me know if you still have problems. Unfortunately github actions don't support M1 CI yet.