rubygame-developmentlibgosu

Can't install gosu gem


I am trying to install gosu gem using docker but I am getting the following error:

/usr/local/bundle/gems/gosu-1.4.5/lib/gosu.so: warning: undefining the allocator of T_DATA class swig_runtime_data
/usr/local/bundle/gems/gosu-1.4.5/lib/gosu/swig_patches.rb:18:in `initialize': Could not initialize SDL Video: No available video device (RuntimeError)

I have tried modifying the dockerfile or installing additional libraries For example:

ENV XDG_RUNTIME_DIR=/tmp

or

apt install xorg-dev

Here is my Dockerfile

from ruby:latest

WORKDIR /usr/src/app

COPY . .

RUN apt-get update && apt-get -qq -y install curl && apt-get install -y build-essential libsdl2-dev libgl1-mesa-dev libopenal-dev libgmp-dev libfontconfig1-dev xorg-dev && gem install gosu
ENV XDG_RUNTIME_DIR=/tmp

EXPOSE 3000

Solution

  • It depends on the SDL library to display graphics. Add this to docker file,

    RUN apt-get update && apt-get install -y libsdl2-dev
    RUN gem install gosu
    

    Refer this for the set of libraries to be further added for docker if the above command don't solve the issue. unable to install Gosu library in Ruby in Linux .