TheOpenSpaceProgram / new-ospgl

A space exploration game in OpenGL. Devblog: https://tatjam.github.io/index.html
MIT License
42 stars 6 forks source link

Add dockerfile for building the app #60

Closed bakerbrandond closed 1 year ago

bakerbrandond commented 1 year ago

I'm on linux, using linuxbrew I installed gcc@10 per the README, I am still unable to build the application

# same CC was used for prior cmake . (ran twice as documented)
❯ CC=/home/linuxbrew/.linuxbrew/bin/gcc-10 cmake --build .
[  0%] Built target fmt
[  5%] Built target glfw
[  6%] Built target minilua
[  7%] Built target buildvm
[ 21%] Built target liblua-static
[ 23%] Built target BulletSoftBody
[ 42%] Built target BulletCollision
[ 50%] Built target BulletDynamics
[ 53%] Built target LinearMath
Consolidate compiler generated dependencies of target OSPGL
[ 54%] Building CXX object CMakeFiles/OSPGL.dir/src/lua/LuaCore.cpp.o
In file included from /home/bbaker/new-ospgl/src/lua/LuaLib.h:2,
                 from /home/bbaker/new-ospgl/src/lua/LuaCore.h:2,
                 from /home/bbaker/new-ospgl/src/lua/LuaCore.cpp:1:
/home/bbaker/new-ospgl/dep/sol/sol.hpp: In function ‘void sol::detail::align_one(std::size_t, std::size_t, void*&)’:
/home/bbaker/new-ospgl/dep/sol/sol.hpp:9724:51: error: ‘numeric_limits’ is not a member of ‘std’
 9724 |                         std::size_t space = (std::numeric_limits<std::size_t>::max)();
      |                                                   ^~~~~~~~~~~~~~
/home/bbaker/new-ospgl/dep/sol/sol.hpp:9724:77: error: expected primary-expression before ‘>’ token
 9724 |                         std::size_t space = (std::numeric_limits<std::size_t>::max)();
      |                                                                             ^
/home/bbaker/new-ospgl/dep/sol/sol.hpp:9724:80: error: ‘::max’ has not been declared; did you mean ‘std::max’?
 9724 |                         std::size_t space = (std::numeric_limits<std::size_t>::max)();
      |                                                                                ^~~
      |                                                                                std::max
In file included from /usr/include/c++/11/functional:65,
                 from /home/bbaker/new-ospgl/dep/sol/sol.hpp:1559,
                 from /home/bbaker/new-ospgl/src/lua/LuaLib.h:2,
                 from /home/bbaker/new-ospgl/src/lua/LuaCore.h:2,
                 from /home/bbaker/new-ospgl/src/lua/LuaCore.cpp:1:
/usr/include/c++/11/bits/stl_algo.h:3467:5: note: ‘std::max’ declared here
 3467 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
In file included from /home/bbaker/new-ospgl/src/lua/LuaLib.h:2,
                 from /home/bbaker/new-ospgl/src/lua/LuaCore.h:2,
                 from /home/bbaker/new-ospgl/src/lua/LuaCore.cpp:1:
/home/bbaker/new-ospgl/dep/sol/sol.hpp: In function ‘void* sol::detail::align_usertype_pointer(void*)’:
/home/bbaker/new-ospgl/dep/sol/sol.hpp:9749:51: error: ‘numeric_limits’ is not a member of ‘std’
 9749 |                         std::size_t space = (std::numeric_limits<std::size_t>::max)();
      |                                                   ^~~~~~~~~~~~~~
/home/bbaker/new-ospgl/dep/sol/sol.hpp:9749:77: error: expected primary-expression before ‘>’ token
 9749 |                         std::size_t space = (std::numeric_limits<std::size_t>::max)();
      |                                                                             ^
/home/bbaker/new-ospgl/dep/sol/sol.hpp:9749:80: error: ‘::max’ has not been declared; did you mean ‘std::max’?
 9749 |                         std::size_t space = (std::numeric_limits<std::size_t>::max)();
      |                                                                                ^~~
      |                                                                                std::max
In file included from /usr/include/c++/11/functional:65,
                 from /home/bbaker/new-ospgl/dep/sol/sol.hpp:1559,
                 from /home/bbaker/new-ospgl/src/lua/LuaLib.h:2,
                 from /home/bbaker/new-ospgl/src/lua/LuaCore.h:2,
                 from /home/bbaker/new-ospgl/src/lua/LuaCore.cpp:1:
/usr/include/c++/11/bits/stl_algo.h:3467:5: note: ‘std::max’ declared here
 3467 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
In file included from /home/bbaker/new-ospgl/src/lua/LuaLib.h:2,
                 from /home/bbaker/new-ospgl/src/lua/LuaCore.h:2,
                 from /home/bbaker/new-ospgl/src/lua/LuaCore.cpp:1:
/home/bbaker/new-ospgl/dep/sol/sol.hpp: In function ‘void* sol::detail::align_usertype_unique_destructor(void*)’:
/home/bbaker/new-ospgl/dep/sol/sol.hpp:9771:51: error: ‘numeric_limits’ is not a member of ‘std’
 9771 |                         std::size_t space = (std::numeric_limits<std::size_t>::max)();
      |                                                   ^~~~~~~~~~~~~~
/home/bbaker/new-ospgl/dep/sol/sol.hpp:9771:77: error: expected primary-expression before ‘>’ token
 9771 |                         std::size_t space = (std::numeric_limits<std::size_t>::max)();
      |                                                                             ^
/home/bbaker/new-ospgl/dep/sol/sol.hpp:9771:80: error: ‘::max’ has not been declared; did you mean ‘std::max’?
 9771 |                         std::size_t space = (std::numeric_limits<std::size_t>::max)();
      |                                                                                ^~~
      |                                                                                std::max
In file included from /usr/include/c++/11/functional:65,
                 from /home/bbaker/new-ospgl/dep/sol/sol.hpp:1559,
                 from /home/bbaker/new-ospgl/src/lua/LuaLib.h:2,
                 from /home/bbaker/new-ospgl/src/lua/LuaCore.h:2,
                 from /home/bbaker/new-ospgl/src/lua/LuaCore.cpp:1:
/usr/include/c++/11/bits/stl_algo.h:3467:5: note: ‘std::max’ declared here
 3467 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
In file included from /home/bbaker/new-ospgl/src/lua/LuaLib.h:2,
                 from /home/bbaker/new-ospgl/src/lua/LuaCore.h:2,
                 from /home/bbaker/new-ospgl/src/lua/LuaCore.cpp:1:
/home/bbaker/new-ospgl/dep/sol/sol.hpp: In function ‘void* sol::detail::align_usertype_unique_tag(void*)’:
/home/bbaker/new-ospgl/dep/sol/sol.hpp:9793:51: error: ‘numeric_limits’ is not a member of ‘std’
 9793 |                         std::size_t space = (std::numeric_limits<std::size_t>::max)();
      |                                                   ^~~~~~~~~~~~~~
/home/bbaker/new-ospgl/dep/sol/sol.hpp:9793:77: error: expected primary-expression before ‘>’ token
 9793 |                         std::size_t space = (std::numeric_limits<std::size_t>::max)();
      |                                                                             ^
/home/bbaker/new-ospgl/dep/sol/sol.hpp:9793:80: error: ‘::max’ has not been declared; did you mean ‘std::max’?
 9793 |                         std::size_t space = (std::numeric_limits<std::size_t>::max)();
      |                                                                                ^~~
      |                                                                                std::max
In file included from /usr/include/c++/11/functional:65,
                 from /home/bbaker/new-ospgl/dep/sol/sol.hpp:1559,
                 from /home/bbaker/new-ospgl/src/lua/LuaLib.h:2,
                 from /home/bbaker/new-ospgl/src/lua/LuaCore.h:2,
                 from /home/bbaker/new-ospgl/src/lua/LuaCore.cpp:1:
/usr/include/c++/11/bits/stl_algo.h:3467:5: note: ‘std::max’ declared here
 3467 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
In file included from /home/bbaker/new-ospgl/src/lua/LuaLib.h:2,
                 from /home/bbaker/new-ospgl/src/lua/LuaCore.h:2,
                 from /home/bbaker/new-ospgl/src/lua/LuaCore.cpp:1:
/home/bbaker/new-ospgl/dep/sol/sol.hpp: In function ‘void* sol::detail::align_usertype_unique(void*)’:
/home/bbaker/new-ospgl/dep/sol/sol.hpp:9816:51: error: ‘numeric_limits’ is not a member of ‘std’
 9816 |                         std::size_t space = (std::numeric_limits<std::size_t>::max)();
      |                                                   ^~~~~~~~~~~~~~
/home/bbaker/new-ospgl/dep/sol/sol.hpp:9816:77: error: expected primary-expression before ‘>’ token
 9816 |                         std::size_t space = (std::numeric_limits<std::size_t>::max)();
      |                                                                             ^
/home/bbaker/new-ospgl/dep/sol/sol.hpp:9816:80: error: ‘::max’ has not been declared; did you mean ‘std::max’?
 9816 |                         std::size_t space = (std::numeric_limits<std::size_t>::max)();
      |                                                                                ^~~
      |                                                                                std::max
In file included from /usr/include/c++/11/functional:65,
                 from /home/bbaker/new-ospgl/dep/sol/sol.hpp:1559,
                 from /home/bbaker/new-ospgl/src/lua/LuaLib.h:2,
                 from /home/bbaker/new-ospgl/src/lua/LuaCore.h:2,
                 from /home/bbaker/new-ospgl/src/lua/LuaCore.cpp:1:
/usr/include/c++/11/bits/stl_algo.h:3467:5: note: ‘std::max’ declared here
 3467 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
In file included from /home/bbaker/new-ospgl/src/lua/LuaLib.h:2,
                 from /home/bbaker/new-ospgl/src/lua/LuaCore.h:2,
                 from /home/bbaker/new-ospgl/src/lua/LuaCore.cpp:1:
/home/bbaker/new-ospgl/dep/sol/sol.hpp: In function ‘void* sol::detail::align_user(void*)’:
/home/bbaker/new-ospgl/dep/sol/sol.hpp:9833:51: error: ‘numeric_limits’ is not a member of ‘std’
 9833 |                         std::size_t space = (std::numeric_limits<std::size_t>::max)();
      |                                                   ^~~~~~~~~~~~~~
/home/bbaker/new-ospgl/dep/sol/sol.hpp:9833:77: error: expected primary-expression before ‘>’ token
 9833 |                         std::size_t space = (std::numeric_limits<std::size_t>::max)();
      |                                                                             ^
/home/bbaker/new-ospgl/dep/sol/sol.hpp:9833:80: error: ‘::max’ has not been declared; did you mean ‘std::max’?
 9833 |                         std::size_t space = (std::numeric_limits<std::size_t>::max)();
      |                                                                                ^~~
      |                                                                                std::max
In file included from /usr/include/c++/11/functional:65,
                 from /home/bbaker/new-ospgl/dep/sol/sol.hpp:1559,
                 from /home/bbaker/new-ospgl/src/lua/LuaLib.h:2,
                 from /home/bbaker/new-ospgl/src/lua/LuaCore.h:2,
                 from /home/bbaker/new-ospgl/src/lua/LuaCore.cpp:1:
/usr/include/c++/11/bits/stl_algo.h:3467:5: note: ‘std::max’ declared here
 3467 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
gmake[2]: *** [CMakeFiles/OSPGL.dir/build.make:930: CMakeFiles/OSPGL.dir/src/lua/LuaCore.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:309: CMakeFiles/OSPGL.dir/all] Error 2
gmake: *** [Makefile:136: all] Error 2
tatjam commented 1 year ago

There's some weird stuff going on in sol, does it work if you change this line: https://github.com/TheOpenSpaceProgram/new-ospgl/blob/bdb9057c6d802004c71c864320b8c8b09845534f/dep/sol/sol.hpp#L2373C11-L2373C11 to

#include <limits>
tatjam commented 1 year ago

I'll push the change for now. IIRC a newer version of sol fixed this, but updating sol may require some code changes to build so for now i'm simply going to push this fix.

No idea why it only fails only on some computers (including the CI!), probably some weird default behaviour.

bakerbrandond commented 1 year ago

I'll push the change for now. IIRC a newer version of sol fixed this, but updating sol may require some code changes to build so for now i'm simply going to push this fix.

No idea why it only fails only on some computers (including the CI!), probably some weird default behaviour.

Thanks, I'm able to compile the binary with gcc11 after the change... funny enough though I am still getting errors when trying to build with gcc10

❯ CC=/home/linuxbrew/.linuxbrew/bin/gcc-10 cmake --build . -- -j 4
...
[ 97%] Linking CXX executable ospgl
/usr/bin/ld: CMakeFiles/OSPGL.dir/dep/glad/glad.c.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: failed to set dynamic section sizes: bad value
collect2: error: ld returned 1 exit status
gmake[2]: *** [CMakeFiles/OSPGL.dir/build.make:2571: ospgl] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:309: CMakeFiles/OSPGL.dir/all] Error 2
gmake: *** [Makefile:136: all] Error 2

I'm fine with closing the issue. Just giving you a heads up.

tatjam commented 1 year ago

Those are some weird linker errors! I can only find references to the first when compiling assembly code, which glad is definitely not! :thinking:

I have tried g++-11 too and it works fine, going to change the README to note that. The continous integration uses g++-9 so it's a wide array of compiler versions to try on if some of these weird problems show up!