{"action":"created","issue":{"url":"https://api.github.com/repos/mapbox/mapbox-gl-native/issues/4922","repository_url":"https://api.github.com/repos/mapbox/mapbox-gl-native","labels_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/issues/4922/labels{/name}","comments_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/issues/4922/comments","events_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/issues/4922/events","html_url":"https://github.com/mapbox/mapbox-gl-native/issues/4922","id":152710143,"number":4922,"title":"Error: \"what():  Failed to open X display\" in Ubuntu VM","user":{"login":"Maarius","id":3234136,"avatar_url":"https://avatars.githubusercontent.com/u/3234136?v=3","gravatar_id":"","url":"https://api.github.com/users/Maarius","html_url":"https://github.com/Maarius","followers_url":"https://api.github.com/users/Maarius/followers","following_url":"https://api.github.com/users/Maarius/following{/other_user}","gists_url":"https://api.github.com/users/Maarius/gists{/gist_id}","starred_url":"https://api.github.com/users/Maarius/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Maarius/subscriptions","organizations_url":"https://api.github.com/users/Maarius/orgs","repos_url":"https://api.github.com/users/Maarius/repos","events_url":"https://api.github.com/users/Maarius/events{/privacy}","received_events_url":"https://api.github.com/users/Maarius/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/mapbox/mapbox-gl-native/labels/node","name":"node","color":"009800"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-05-03T06:41:29Z","updated_at":"2016-05-03T15:55:59Z","closed_at":null,"body":"I installed \"mapbox-gl-native\" for node in my Ubuntu virtual machine, however when I try to run the sample code (https://github.com/mapbox/mapbox-gl-native/tree/master/platform/node#rendering-a-map-tile), I get the error \r\n```\r\nterminate called after throwing an instance of 'std::runtime_error'\r\n  what():  Failed to open X display.\r\nAborted (core dumped)\r\n```\r\n\r\nMy system setup:\r\n```\r\nnode: 5.4.1\r\nmapbox-gl-native: 3.1.2 (build from source without errors)\r\nsharp 0.14.1\r\nUbuntu: 15.10 running in a Virtualbox (5.0.16) on an OSX host system.\r\n```\r\n\r\nCan you give me any hints how to solve this? Is it possible to run mapbox-gl-native in a VM and export map images using node?"},"comment":{"url":"https://api.github.com/repos/mapbox/mapbox-gl-native/issues/comments/216574903","html_url":"https://github.com/mapbox/mapbox-gl-native/issues/4922#issuecomment-216574903","issue_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/issues/4922","id":216574903,"user":{"login":"mikemorris","id":1149913,"avatar_url":"https://avatars.githubusercontent.com/u/1149913?v=3","gravatar_id":"","url":"https://api.github.com/users/mikemorris","html_url":"https://github.com/mikemorris","followers_url":"https://api.github.com/users/mikemorris/followers","following_url":"https://api.github.com/users/mikemorris/following{/other_user}","gists_url":"https://api.github.com/users/mikemorris/gists{/gist_id}","starred_url":"https://api.github.com/users/mikemorris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikemorris/subscriptions","organizations_url":"https://api.github.com/users/mikemorris/orgs","repos_url":"https://api.github.com/users/mikemorris/repos","events_url":"https://api.github.com/users/mikemorris/events{/privacy}","received_events_url":"https://api.github.com/users/mikemorris/received_events","type":"User","site_admin":false},"created_at":"2016-05-03T15:55:59Z","updated_at":"2016-05-03T15:55:59Z","body":"Yes, it's possible (I ssh into a Linux VM setup for local Node.js mapbox-gl-native dev), but it can be a bit painful dealing with configuration and Linux graphics drivers issues. You can check in [`scripts/travis_setup.sh`](https://github.com/mapbox/mapbox-gl-native/blob/f964e40e7e9220d08751d8607af61ac5a7c0794c/scripts/travis_setup.sh) for some hints, but off the top of my head here's the most important bits:\r\n\r\n- Start up a real X server (by installing the [X.org](x.org) drivers on your host Mac and sshing into the VM with `-X` or `-Y`) OR spin up [xvfb](https://github.com/mapbox/mapbox-gl-native/blob/f964e40e7e9220d08751d8607af61ac5a7c0794c/scripts/travis_setup.sh#L33-L38) on the Linux VM for a virtual framebuffer\r\n\r\nOn the Linux VM:\r\n- Install a relatively recent version of Mesa on the Linux VM ([we're using 10.4.3 for CI testing](https://github.com/mapbox/mapbox-gl-native/blob/f964e40e7e9220d08751d8607af61ac5a7c0794c/scripts/travis_setup.sh#L46-L49) with these [compile flags](https://github.com/mapbox/mason/blob/master/scripts/mesa/10.4.3/script.sh#L21-L34))\r\n- `export DISPLAY=:0` for real X server (I think) or `export DISPLAY=:99.0` for xvfb\r\n- `export LD_LIBRARY_PATH=\"{PATH_TO_MESA_LIB_DIRECTORY}\"`"}}