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

Shader compilation error on Ubuntu 20.04 LTS #205

Open
juozaspo opened this issue Jul 27, 2020 · 9 comments
Open

Shader compilation error on Ubuntu 20.04 LTS #205

juozaspo opened this issue Jul 27, 2020 · 9 comments
Labels
Bug Reporting or fixing something that is not working as intended

Comments

@juozaspo
Copy link

juozaspo commented Jul 27, 2020

Describe the bug

Game does not run on Ubuntu 20.04 LTS, Fails with shader compilation error.

terminate called after throwing an instance of 'std::runtime_error'
  what():  Shader shaders/gui_vertex.glsl failed to compile:

Aborted (core dumped)

To Reproduce

Steps to reproduce the behavior:

  1. Build according to Linux build instruction using cmake (run scripts/build.sh after installing build dependencies)
  2. Run scripts/run.sh
  3. See crash

Expected behavior

Game runs w/o error, no crash

Desktop

  • OS: Ubuntu Linux 20.04 LTS

Additional context

Pentium(R) Dual-Core CPU E6300 @ 2.80GHz
NVIDIA GeForce 210/PCIe/SSE2, 512 MB video memory, NVIDIA Driver version 340.108

Build log
-- The C compiler identification is GNU 9.3.0
-- The CXX compiler identification is GNU 9.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Found SFML .. in /usr/include
-- Configuring done
-- Generating done
-- Build files have been written to: /home/juozas/Darbastalis/open-builder/bin/debug
Scanning dependencies of target ob-common
[  1%] Building CXX object src/common/common/CMakeFiles/ob-common.dir/util.cpp.o
/home/juozas/Darbastalis/open-builder/src/common/common/util.cpp:12:17: warning: ‘std::string {anonymous}::cleanString(const string&)’ defined but not used [-Wunused-function]
   12 |     std::string cleanString(const std::string& line)
      |                 ^~~~~~~~~~~
[  1%] Building CXX object src/common/common/CMakeFiles/ob-common.dir/maths.cpp.o
[  2%] Building CXX object src/common/common/CMakeFiles/ob-common.dir/debug.cpp.o
[  3%] Building CXX object src/common/common/CMakeFiles/ob-common.dir/network/enet.cpp.o
[  4%] Building CXX object src/common/common/CMakeFiles/ob-common.dir/network/packet.cpp.o
[  5%] Building CXX object src/common/common/CMakeFiles/ob-common.dir/lua/script_engine.cpp.o
[  6%] Building CXX object src/common/common/CMakeFiles/ob-common.dir/lua/util_api.cpp.o
[  7%] Building CXX object src/common/common/CMakeFiles/ob-common.dir/world/chunk.cpp.o
[  8%] Building CXX object src/common/common/CMakeFiles/ob-common.dir/world/chunk_manager.cpp.o
[  8%] Building CXX object src/common/common/CMakeFiles/ob-common.dir/world/coordinate.cpp.o
[  9%] Building CXX object src/common/common/CMakeFiles/ob-common.dir/world/voxel_data.cpp.o
[ 10%] Building CXX object src/common/common/CMakeFiles/ob-common.dir/world/biome.cpp.o
[ 11%] Linking CXX static library libob-common.a
[ 11%] Built target ob-common
Scanning dependencies of target glad
[ 12%] Building C object deps/CMakeFiles/glad.dir/glad/glad.c.o
[ 13%] Linking C static library libglad.a
[ 13%] Built target glad
Scanning dependencies of target lua
[ 14%] Building C object deps/lua/CMakeFiles/lua.dir/lstrlib.c.o
[ 15%] Building C object deps/lua/CMakeFiles/lua.dir/lundump.c.o
[ 16%] Building C object deps/lua/CMakeFiles/lua.dir/lmathlib.c.o
[ 17%] Building C object deps/lua/CMakeFiles/lua.dir/lopcodes.c.o
[ 17%] Building C object deps/lua/CMakeFiles/lua.dir/lcorolib.c.o
[ 18%] Building C object deps/lua/CMakeFiles/lua.dir/lfunc.c.o
[ 19%] Building C object deps/lua/CMakeFiles/lua.dir/lstate.c.o
[ 20%] Building C object deps/lua/CMakeFiles/lua.dir/lutf8lib.c.o
[ 21%] Building C object deps/lua/CMakeFiles/lua.dir/lbitlib.c.o
[ 22%] Building C object deps/lua/CMakeFiles/lua.dir/loslib.c.o
[ 23%] Building C object deps/lua/CMakeFiles/lua.dir/lobject.c.o
[ 24%] Building C object deps/lua/CMakeFiles/lua.dir/lapi.c.o
[ 24%] Building C object deps/lua/CMakeFiles/lua.dir/lbaselib.c.o
[ 25%] Building C object deps/lua/CMakeFiles/lua.dir/lzio.c.o
[ 26%] Building C object deps/lua/CMakeFiles/lua.dir/lcode.c.o
[ 27%] Building C object deps/lua/CMakeFiles/lua.dir/lparser.c.o
[ 28%] Building C object deps/lua/CMakeFiles/lua.dir/llex.c.o
[ 29%] Building C object deps/lua/CMakeFiles/lua.dir/liolib.c.o
[ 30%] Building C object deps/lua/CMakeFiles/lua.dir/linit.c.o
[ 31%] Building C object deps/lua/CMakeFiles/lua.dir/ldump.c.o
[ 31%] Building C object deps/lua/CMakeFiles/lua.dir/loadlib.c.o
[ 32%] Building C object deps/lua/CMakeFiles/lua.dir/ltablib.c.o
[ 33%] Building C object deps/lua/CMakeFiles/lua.dir/lmem.c.o
[ 34%] Building C object deps/lua/CMakeFiles/lua.dir/lgc.c.o
[ 35%] Building C object deps/lua/CMakeFiles/lua.dir/ldebug.c.o
[ 36%] Building C object deps/lua/CMakeFiles/lua.dir/ldblib.c.o
[ 37%] Building C object deps/lua/CMakeFiles/lua.dir/ldo.c.o
[ 38%] Building C object deps/lua/CMakeFiles/lua.dir/ltm.c.o
[ 38%] Building C object deps/lua/CMakeFiles/lua.dir/ltable.c.o
[ 39%] Building C object deps/lua/CMakeFiles/lua.dir/lctype.c.o
[ 40%] Building C object deps/lua/CMakeFiles/lua.dir/lvm.c.o
[ 41%] Building C object deps/lua/CMakeFiles/lua.dir/lstring.c.o
[ 42%] Building C object deps/lua/CMakeFiles/lua.dir/lua.c.o
[ 43%] Building C object deps/lua/CMakeFiles/lua.dir/lauxlib.c.o
[ 44%] Building C object deps/lua/CMakeFiles/lua.dir/luac.c.o
[ 45%] Linking C static library liblua.a
[ 45%] Built target lua
Scanning dependencies of target ob-server
[ 46%] Building CXX object src/server/CMakeFiles/ob-server.dir/server_engine.cpp.o
/home/juozas/Darbastalis/open-builder/src/server/server_engine.cpp: In constructor ‘ServerEngine::ServerEngine()’:
/home/juozas/Darbastalis/open-builder/src/server/server_engine.cpp:16:37: warning: missing initializer for member ‘_ENetAddress::sin6_scope_id’ [-Wmissing-field-initializers]
   16 |     , m_salt(createHandshakeRandom())
      |                                     ^
[ 47%] Building CXX object src/server/CMakeFiles/ob-server.dir/network/client_session.cpp.o
[ 48%] Building CXX object src/server/CMakeFiles/ob-server.dir/network/pending_client_session.cpp.o
[ 49%] Building CXX object src/server/CMakeFiles/ob-server.dir/world/terrain_generation.cpp.o
[ 49%] Building CXX object src/server/CMakeFiles/ob-server.dir/world/server_world.cpp.o
/home/juozas/Darbastalis/open-builder/src/server/world/server_world.cpp: In member function ‘glm::vec3 ServerWorld::getPlayerSpawnPosition(u32)’:
/home/juozas/Darbastalis/open-builder/src/server/world/server_world.cpp:125:51: warning: unused parameter ‘playerId’ [-Wunused-parameter]
  125 | glm::vec3 ServerWorld::getPlayerSpawnPosition(u32 playerId)
      |                                               ~~~~^~~~~~~~
[ 50%] Building CXX object src/server/CMakeFiles/ob-server.dir/lua/data_api.cpp.o
[ 51%] Building CXX object src/server/CMakeFiles/ob-server.dir/lua/world_api.cpp.o
[ 52%] Building CXX object src/server/CMakeFiles/ob-server.dir/lua/server_lua_callback.cpp.o
[ 53%] Linking CXX static library libob-server.a
[ 53%] Built target ob-server
Scanning dependencies of target enet
[ 53%] Building CXX object deps/CMakeFiles/enet.dir/enet/enet_impl.cpp.o
[ 54%] Linking CXX static library libenet.a
[ 54%] Built target enet
Scanning dependencies of target ob-client
[ 54%] Building CXX object src/client/CMakeFiles/ob-client.dir/input/keyboard.cpp.o
[ 55%] Building CXX object src/client/CMakeFiles/ob-client.dir/gl/textures.cpp.o
[ 56%] Building CXX object src/client/CMakeFiles/ob-client.dir/gl/shader.cpp.o
[ 57%] Building CXX object src/client/CMakeFiles/ob-client.dir/gl/font.cpp.o
[ 58%] Building CXX object src/client/CMakeFiles/ob-client.dir/gl/framebuffer.cpp.o
[ 59%] Building CXX object src/client/CMakeFiles/ob-client.dir/gl/vertex_array.cpp.o
[ 60%] Building CXX object src/client/CMakeFiles/ob-client.dir/gl/gl_errors.cpp.o
[ 61%] Building CXX object src/client/CMakeFiles/ob-client.dir/gl/primitive.cpp.o
[ 61%] Building CXX object src/client/CMakeFiles/ob-client.dir/client_state_controller.cpp.o
[ 62%] Building CXX object src/client/CMakeFiles/ob-client.dir/client_engine.cpp.o
[ 63%] Building CXX object src/client/CMakeFiles/ob-client.dir/game/chunk_mesh.cpp.o
[ 64%] Building CXX object src/client/CMakeFiles/ob-client.dir/game/chunk_mesh_generation.cpp.o
[ 65%] Building CXX object src/client/CMakeFiles/ob-client.dir/game/client_world.cpp.o
/home/juozas/Darbastalis/open-builder/src/client/game/client_world.cpp: In member function ‘void ClientWorld::setupData(int)’:
/home/juozas/Darbastalis/open-builder/src/client/game/client_world.cpp:33:33: warning: unused parameter ‘maxEntities’ [-Wunused-parameter]
   33 | void ClientWorld::setupData(int maxEntities)
      |                             ~~~~^~~~~~~~~~~
/home/juozas/Darbastalis/open-builder/src/client/game/client_world.cpp: In member function ‘void ClientWorld::tick(float)’:
/home/juozas/Darbastalis/open-builder/src/client/game/client_world.cpp:38:30: warning: unused parameter ‘dt’ [-Wunused-parameter]
   38 | void ClientWorld::tick(float dt)
      |                        ~~~~~~^~
[ 66%] Building CXX object src/client/CMakeFiles/ob-client.dir/game/game.cpp.o
[ 67%] Building CXX object src/client/CMakeFiles/ob-client.dir/game/game_def.cpp.o
/home/juozas/Darbastalis/open-builder/src/client/game/game_def.cpp: In member function ‘void ClientGameDef::handleInput(const Keyboard&, const InputState&)’:
/home/juozas/Darbastalis/open-builder/src/client/game/game_def.cpp:98:16: warning: declaration of ‘position’ shadows a previous local [-Wshadow]
   98 |     for (auto& position : voxels) {
      |                ^~~~~~~~
/home/juozas/Darbastalis/open-builder/src/client/game/game_def.cpp:93:11: note: shadowed declaration is here
   93 |     auto& position = m_player.m_state.position;
      |           ^~~~~~~~
[ 68%] Building CXX object src/client/CMakeFiles/ob-client.dir/game/game_type.cpp.o
[ 69%] Building CXX object src/client/CMakeFiles/ob-client.dir/game/player.cpp.o
/home/juozas/Darbastalis/open-builder/src/client/game/player.cpp: In member function ‘void Player::keyboardInput(const Keyboard&)’:
/home/juozas/Darbastalis/open-builder/src/client/game/player.cpp:92:16: warning: unused variable ‘velocity’ [-Wunused-variable]
   92 |     glm::vec3& velocity = m_state.velocity;
      |                ^~~~~~~~
[ 69%] Building CXX object src/client/CMakeFiles/ob-client.dir/lua/client_lua_callback.cpp.o
[ 70%] Building CXX object src/client/CMakeFiles/ob-client.dir/lua/gui_api.cpp.o
[ 71%] Building CXX object src/client/CMakeFiles/ob-client.dir/lua/gui_widget_api.cpp.o
[ 72%] Building CXX object src/client/CMakeFiles/ob-client.dir/lua/client_input_api.cpp.o
[ 73%] Building CXX object src/client/CMakeFiles/ob-client.dir/lua/client_control_api.cpp.o
[ 74%] Building CXX object src/client/CMakeFiles/ob-client.dir/gui/overlay.cpp.o
[ 75%] Building CXX object src/client/CMakeFiles/ob-client.dir/gui/overlay_factory.cpp.o
[ 76%] Building CXX object src/client/CMakeFiles/ob-client.dir/gui/gui_system.cpp.o
[ 76%] Building CXX object src/client/CMakeFiles/ob-client.dir/gui/component/rectangle_component.cpp.o
[ 77%] Building CXX object src/client/CMakeFiles/ob-client.dir/gui/component/text_component.cpp.o
[ 78%] Building CXX object src/client/CMakeFiles/ob-client.dir/gui/widget/widget.cpp.o
[ 79%] Building CXX object src/client/CMakeFiles/ob-client.dir/gui/widget/image_widget.cpp.o
[ 80%] Building CXX object src/client/CMakeFiles/ob-client.dir/gui/widget/label_widget.cpp.o
[ 81%] Building CXX object src/client/CMakeFiles/ob-client.dir/gui/widget/button_widget.cpp.o
[ 82%] Building CXX object src/client/CMakeFiles/ob-client.dir/gui/widget/text_box_widget.cpp.o
[ 83%] Building CXX object src/client/CMakeFiles/ob-client.dir/gui/widget/widget_helper.cpp.o
[ 83%] Building CXX object src/client/CMakeFiles/ob-client.dir/gui/widget/checkbox_widget.cpp.o
[ 84%] Building CXX object src/client/CMakeFiles/ob-client.dir/window.cpp.o
[ 85%] Building CXX object src/client/CMakeFiles/ob-client.dir/network/client.cpp.o
In file included from /home/juozas/Darbastalis/open-builder/src/client/network/client.cpp:1:
/home/juozas/Darbastalis/open-builder/src/client/network/client.h: In constructor ‘Client::Client(ClientWorld&, Player&)’:
/home/juozas/Darbastalis/open-builder/src/client/network/client.h:59:9: warning: ‘Client::m_salt’ will be initialized after [-Wreorder]
   59 |     u32 m_salt;
      |         ^~~~~~
/home/juozas/Darbastalis/open-builder/src/client/network/client.h:56:18: warning:   ‘ClientWorld* Client::mp_world’ [-Wreorder]
   56 |     ClientWorld* mp_world = nullptr;
      |                  ^~~~~~~~
/home/juozas/Darbastalis/open-builder/src/client/network/client.cpp:14:1: warning:   when initialized here [-Wreorder]
   14 | Client::Client(ClientWorld& world, Player& player)
      | ^~~~~~
[ 86%] Building CXX object src/client/CMakeFiles/ob-client.dir/renderer/camera.cpp.o
[ 87%] Building CXX object src/client/CMakeFiles/ob-client.dir/renderer/gui_renderer.cpp.o
[ 88%] Building CXX object src/client/CMakeFiles/ob-client.dir/renderer/chunk_renderer.cpp.o
[ 89%] Linking CXX static library libob-client.a
[ 89%] Built target ob-client
Scanning dependencies of target tests
[ 90%] Building CXX object CMakeFiles/tests.dir/tests/tests.cpp.o
[ 90%] Building CXX object CMakeFiles/tests.dir/tests/common/world/chunk_manager_test.cpp.o
[ 91%] Building CXX object CMakeFiles/tests.dir/tests/common/world/coordinate_test.cpp.o
[ 92%] Building CXX object CMakeFiles/tests.dir/tests/common/world/chunk_test.cpp.o
[ 93%] Building CXX object CMakeFiles/tests.dir/tests/common/util/obd_parser_test.cpp.o
[ 94%] Building CXX object CMakeFiles/tests.dir/tests/common/lua/script_engine_test.cpp.o
[ 95%] Building CXX object CMakeFiles/tests.dir/tests/client/lua/client_control_api_test.cpp.o
[ 96%] Building CXX object CMakeFiles/tests.dir/tests/client/lua/gui_widget_api_test.cpp.o
[ 97%] Building CXX object CMakeFiles/tests.dir/tests/client_server_tests.cpp.o
[ 98%] Linking CXX executable tests
/usr/bin/ld: deps/lua/liblua.a(loslib.c.o): in function `os_tmpname':
/home/juozas/Darbastalis/open-builder/deps/lua/loslib.c:169: warning: the use of `tmpnam' is dangerous, better use `mkstemp'
[ 98%] Built target tests
Scanning dependencies of target open-builder
[ 99%] Building CXX object CMakeFiles/open-builder.dir/src/main.cpp.o
[100%] Linking CXX executable open-builder
/usr/bin/ld: deps/lua/liblua.a(loslib.c.o): in function `os_tmpname':
/home/juozas/Darbastalis/open-builder/deps/lua/loslib.c:169: warning: the use of `tmpnam' is dangerous, better use `mkstemp'
[100%] Built target open-builder
Built target in bin/debug/
@juozaspo juozaspo added the Bug Reporting or fixing something that is not working as intended label Jul 27, 2020
@juozaspo juozaspo changed the title Not running on Ubuntu 20.04 LTS Shader compilation error on Ubuntu 20.04 LTS Jul 27, 2020
@Green-Sky
Copy link

My guess is, that you are not running the game from the project directory.

@juozaspo
Copy link
Author

I'm not sure what the you meen by project directory, but I do confirm that I run the game from the main open-builder folder (where folders such as bin, cmake*, deps, docs, game, res, scripts, shaders etc. reside) and call scripts/run.sh while in there. The game won't run from elsewhere and report different error when calling the script. (../scripts/run.sh: line 7: ./bin/debug/open-builder: No such file or directory)

@Green-Sky
Copy link

"...the main open-builder folder (where folders such as bin, cmake*, deps, docs, game, res, scripts, shaders etc. reside)..."

yea, thats what i meant.

when i run the script, it looks like this:

~/workspace/open-builder$ scripts/run.sh 
OpenGL Message
Type: ?
Severity: medium
Source: shader compiler
Message: SIMD32 shader inefficient

and it works

../scripts/run.sh

to me, it looks like you are running it from some directory inside the main directory....

@juozaspo
Copy link
Author

juozaspo commented Jul 31, 2020

../scripts/run.sh

to me, it looks like you are running it from some directory inside the main directory....

I didn't run ../scripts/run.sh when trying to launch the game, I run scripts/run.sh and it still didn't work for me. The game folder was in desktop (cloned using git). I cd'd into that folder and executed scripts/build.sh then scripts/run.sh and it still failed. I'm running Ubuntu 20.04 LTS

juozas@xubuntu:~/Darbastalis/open-builder$ scripts/run.sh 
terminate called after throwing an instance of 'std::runtime_error'
  what():  Shader shaders/gui_vertex.glsl failed to compile:

scripts/run.sh: line 8: 10510 Aborted                 (core dumped) ./bin/debug/open-builder $1 $2 $3 $4 $5 $6 $7 $8 $9
juozas@xubuntu:~/Darbastalis/open-builder$ sh scripts/run.sh 
terminate called after throwing an instance of 'std::runtime_error'
  what():  Shader shaders/gui_vertex.glsl failed to compile:

Aborted (core dumped)
juozas@xubuntu:~/Darbastalis/open-builder$ ls -A
.clang-format  .gitattributes  .gitignore      LICENSE    bin    cmake_modules  credits.txt  docs  libraries.md  scripts  src    texture_packs
.git           .github         CMakeLists.txt  README.md  cmake  config.obd     deps         game  res           shaders  tests

@Green-Sky
Copy link

ok.
on another topic, do you have mesa-utils installed?
can you give me the result of glxinfo | grep "version string"
it might be your driver installation.

@juozaspo
Copy link
Author

I have mesa-utils installed. glxinfo output:

$ glxinfo | grep "version string"
server glx version string: 1.4
client glx version string: 1.4
OpenGL core profile version string: 3.3.0 NVIDIA 340.108
OpenGL core profile shading language version string: 3.30 NVIDIA via Cg compiler
OpenGL version string: 3.3.0 NVIDIA 340.108
OpenGL shading language version string: 3.30 NVIDIA via Cg compiler
OpenGL ES profile version string: OpenGL ES 2.0 NVIDIA 340.108 340.108
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 1.00

@Green-Sky
Copy link

hmm should be fine...

@Green-Sky
Copy link

there might actually an error in the code of the game:
https://github.com/Hopson97/open-builder/blob/master/src/client/gl/shader.cpp#L34

here we read the length of the log message, that got produced by the compilation AND ASSUME, that if the value is > 0, the compilation was not successful. This might not be true. There should be a dedicated check using this glGetShaderiv(shader, GL_COMPILE_STATUS, &success);.

@Green-Sky
Copy link

but that is not your problem, damn.
since you get Shader shaders/gui_vertex.glsl failed to compile:
so it looks like the error message gets cut-off.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Reporting or fixing something that is not working as intended
Projects
None yet
Development

No branches or pull requests

2 participants