我尝试使用gosu
以下方式安装 Ryby gem
$ 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.
我注意到问题出在 -lopenal,但我该如何安装或获取它才能正确下载
编辑:感谢 N0rbert,-lopenal 现在为“是”。但现在我看到屏幕下方显示“致命错误”,那么我该如何修复它?
答案1
您需要安装包含标头的包AL/al.h - 使用 packages.ubuntu.com和sudo apt install libopenal-dev
。
但如果你需要戈苏Gem才算编译成功,安装libopenal-dev
还不够。
您需要咨询官方文档使用以下命令安装其他构建依赖项:
# 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
答案2
您可以通过运行以下命令来安装该包
sudo apt install libopenal-dev
在 bash 命令中,在参数前使用连字符 ( -
) 被认为是向命令传递选项。
您应该弄清楚某个头文件的包名是什么,然后使用 apt 安装它。
您运行的命令
sudo apt install -lopenal
解释如下
sudo apt install -l -o -p -e -n -a -l
一些建议
- 包名称不能以连字符开头。
- 大多数情况下(如果不是总是),
-dev
当您只需要头文件时,包名称都会以 为后缀。 - 库包通常(但并非总是)以 为前缀
lib
。 - 包名称并不总是与软件名称完全相同。
- 您可以使用以下方式搜索包
apt search <keyword>
- 我不喜欢成为“去谷歌”的人,但在这种情况下,当官方文档没有提到时,谷歌或任何其他搜索引擎可以真正帮助您找出某个 gem/package 的依赖关系。