maptiler / tileserver-gl

Vector and raster maps with GL styles. Server side rendering by MapLibre GL Native. Map tile server for MapLibre GL JS, Android, iOS, Leaflet, OpenLayers, GIS via WMTS, etc.
https://tileserver.readthedocs.io/en/latest/
Other
2.24k stars 639 forks source link

Runtime error (std::runtime_error) #345

Open toton6868 opened 5 years ago

toton6868 commented 5 years ago

I have built tileserver earlier and it was running fine. Recently I reboot the server and made an update. After the update I was not able to run Tileserver-GL. Its showing the following error

Starting tileserver-gl v2.4.0
Using specified config file from config.json
terminate called after throwing an instance of 'std::runtime_error'
  what():  eglInitialize() failed.

Aborted (core dumped)
mloskot commented 5 years ago

See https://github.com/maptiler/tileserver-gl/issues/255#issuecomment-365506211

dup #357

njanakiev commented 3 years ago

Thanks for the great project!

I had the same error and I managed to solve it with on Debian 10, node v10.19.0 and Tileserver-GL v3.0.0 and v3.1.0 by installing these packages and following these steps, as outlined in the Dockerfile:

sudo apt-get -y --no-install-recommends install \
  apt-transport-https \
  curl \
  unzip \
  build-essential \
  libcairo2-dev \
  libgles2-mesa-dev \
  libgbm-dev \
  libllvm7 \
  libprotobuf-dev \
  libgles2-mesa \
  libegl1 \
  xvfb \
  xauth

Installing the server with:

export NODE_ENV="production"
npm install --production

And running the server with:

export CHOKIDAR_USEPOLLING=1
export CHOKIDAR_INTERVAL=500
xvfb-run -a --server-args="-screen 0 1024x768x24" -- node . -p 8080

When running the same steps in Ubuntu 20.04, I get the previous error:

terminate called after throwing an instance of 'std::runtime_error'
  what():  eglInitialize() failed.

Do you know what could be the cause of the issue or what needs to be additionally installed?

mloskot commented 3 years ago

@njanakiev Try two things:

  1. Don't use xfvb-run wrapper, see https://github.com/maptiler/tileserver-gl/issues/336#issuecomment-451099438
  2. Ensure you run xfvb with loaded GLX, i.e. follow the run.sh https://github.com/maptiler/tileserver-gl/blob/8126b31081bce168e9714e9b7d67ad09b399aaf1/run.sh#L19
yetzt commented 3 years ago

you can debug egl with setting EGL_LOG_LEVEL=debugin your environment.

in my case egl wanted to use gbm for whatever reason, but i could convince it by explicitly setting EGL_PLATFORM=x11 in the environment.