devilutionX icon indicating copy to clipboard operation
devilutionX copied to clipboard

Build Error on Mac M1 (missiles_test.dir)

Open mattcodez opened this issue 2 years ago • 1 comments

Operating System

Mac

DevilutionX version

1.5.0 (latest release)

Describe

Trying to build from source on a Mac M1 using the provided Mac instructions. Got very close to finished but some errors showed up at the very end.

[ 96%] Built target lighting_test
/Users/m/local/devilutionX/test/missiles_test.cpp:16:7: error: no member named 'unordered_map' in namespace 'std'
        std::unordered_map<int, unsigned> observed {};
        ~~~~~^
/Users/m/local/devilutionX/test/missiles_test.cpp:16:24: error: expected '(' for function-style cast or type construction
        std::unordered_map<int, unsigned> observed {};
                           ~~~^
/Users/m/local/devilutionX/test/missiles_test.cpp:20:3: error: use of undeclared identifier 'observed'
                observed[missile._miAnimFrame]++;
                ^
/Users/m/local/devilutionX/test/missiles_test.cpp:23:14: error: use of undeclared identifier 'observed'
        EXPECT_THAT(observed, UnorderedElementsAre(Pair(leftFrame, AllOf(Gt(30), Lt(70))), Pair(rightFrame, AllOf(Gt(30), Lt(70))))) << "Arrows should rotate either direction roughly 50% of the time";
                    ^
/Users/m/local/devilutionX/test/missiles_test.cpp:28:7: error: no member named 'unordered_map' in namespace 'std'
        std::unordered_map<int, unsigned> observed {};
        ~~~~~^
/Users/m/local/devilutionX/test/missiles_test.cpp:28:24: error: expected '(' for function-style cast or type construction
        std::unordered_map<int, unsigned> observed {};
                           ~~~^
/Users/m/local/devilutionX/test/missiles_test.cpp:32:3: error: use of undeclared identifier 'observed'
                observed[missile._mimfnum]++;
                ^
/Users/m/local/devilutionX/test/missiles_test.cpp:35:14: error: use of undeclared identifier 'observed'
        EXPECT_THAT(observed, UnorderedElementsAre(Pair(leftDir, AllOf(Gt(30), Lt(70))), Pair(rightDir, AllOf(Gt(30), Lt(70))))) << "Animated missiles should rotate either direction roughly 50% of the time";
                    ^
[ 96%] Building CXX object test/CMakeFiles/scrollrt_test.dir/scrollrt_test.cpp.o
8 errors generated.
make[2]: *** [test/CMakeFiles/missiles_test.dir/missiles_test.cpp.o] Error 1
make[1]: *** [test/CMakeFiles/missiles_test.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 96%] Linking CXX executable ../random_test
[ 96%] Linking CXX executable ../path_test
[ 96%] Linking CXX executable ../pack_test
[ 96%] Linking CXX executable ../quests_test
[ 97%] Linking CXX executable ../rectangle_test
[ 98%] Linking CXX executable ../player_test
[ 98%] Built target rectangle_test
[ 98%] Built target quests_test
[ 98%] Built target random_test
[ 98%] Built target path_test
[ 98%] Linking CXX executable ../scrollrt_test
[ 98%] Built target pack_test
[ 98%] Built target player_test
[ 98%] Built target scrollrt_test
make: *** [all] Error 2

To Reproduce

Mac OS 12.6.5

  • Cloned repository (HEAD at 52653f6c3)
  • brew bundle install
  • cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release
  • cmake --build build -j $(sysctl -n hw.physicalcpu)

Error occurred on last command above

Expected Behavior

Build success

Additional context

No response

mattcodez avatar Jun 18 '23 04:06 mattcodez

I guess the header for unordered_map isn't explicitly included in that test and Clang is expecting it.

Considering that you are building for release I'm guessing you don't actually care about tests so you could just disable them by adding -DBUILD_TESTING=OFF to the first cmake instruction.

AJenbo avatar Jun 18 '23 04:06 AJenbo