3

I tried to install the gosu Ryby gem with

$ sudo gem install gosu

Building native extensions. This could take a while...

ERROR:  Error installing gosu:

    ERROR: Failed to build gem native extension.

    current directory: /var/lib/gems/2.5.0/gems/gosu-0.13.3/ext/gosu
/usr/bin/ruby2.5 -r ./siteconf20180610-10446-laumk5.rb extconf.rb
The Gosu gem requires some libraries to be installed system-wide.
See the following site for a list:

https://github.com/gosu/gosu/wiki/Getting-Started-on-Linux

checking for TTF_RenderUTF8_Blended() in -lSDL2_ttf... yes

checking for SDL_ttf.h... yes

checking for -lopenal... no

creating Makefile

current directory: /var/lib/gems/2.5.0/gems/gosu-0.13.3/ext/gosu

make "DESTDIR=" clean

current directory: /var/lib/gems/2.5.0/gems/gosu-0.13.3/ext/gosu

make "DESTDIR="

compiling ../../src/Audio.cpp

In file included from ../../src/Audio.cpp:1:0:

../../src/AudioImpl.hpp:9:10: fatal error: AL/al.h: No such file or directory

 #include <AL/al.h>

          ^~~~~~~~~

compilation terminated.

Makefile:234: recipe for target 'Audio.o' failed

make: *** [Audio.o] Error 1

make failed, exit code 2

Gem files will remain installed in /var/lib/gems/2.5.0/gems/gosu-0.13.3 for inspection.

Results logged to /var/lib/gems/2.5.0/extensions/x86_64-linux/2.5.0/gosu-

0.13.3/gem_make.out

shane@shane-HP-x2-Detachable-10-p0XX:~$ sudo apt-get install -lopenal

E: Command line option 'l' [from -lopenal] is not understood in combination 
with the other options.

I notice that the problem is with -lopenal, but how do I install or get this so it will download properly

EDIT: -lopenal now has a yes thanks to N0rbert. But now I see it says "fatal error" a bit down the screen, so how do I fix this?

Dan
  • 13,119
Shane.D
  • 605

2 Answers2

3

You need to install the package, which contains header AL/al.h - use packages.ubuntu.com with sudo apt install libopenal-dev.

But if you need the gosu Gem to be compiled successfully, the installation of libopenal-dev is not enough.

You need to consult official documentation to install other build-dependencies with:

# Dependencies for both C++ and Ruby
sudo apt-get install build-essential libsdl2-dev libsdl2-ttf-dev libpango1.0-dev \
                     libgl1-mesa-dev libopenal-dev libsndfile-dev libmpg123-dev \
                     libgmp-dev

# To install Ruby itself - if you are using rvm or rbenv, please skip this step
sudo apt-get install ruby-dev

# If you are using a Ruby version manager (i.e. rvm or rbenv)
gem install gosu
# If you are using system Ruby, you will need "sudo" to install Ruby libraries (gems)
sudo gem install gosu
N0rbert
  • 99,918
2

You can install the package by running the following command

sudo apt install libopenal-dev

Having a hyphen (-) before a parameter in bash commands is considered as if you are passing options to the commands.

You should figure out what is the package name for a certain header file, and then install it with apt.

The command you ran

sudo apt install -lopenal

is interpreted as the following

sudo apt install -l -o -p -e -n -a -l

A few tips

  • A package name never starts with a hyphen.
  • Most of the times, if not always, package names are suffixed with -dev when you only need header files.
  • Library packages are often, but not always, prefixed with lib.
  • A package name isn't always exactly the same name as the software.
  • You can search for a package with apt search <keyword>
  • I hate to be the "go to Google" person, but in this case, Google or any other search engine can be really helpful to figure out what are the dependencies for a certain gem/package when the official documentation does not mention it.
Dan
  • 13,119