|
|
Dependencies
To compile Gosu, you will need the following packages (install via sudo apt-get install <packagename>):
- g++
- autoconf
- libgl1-mesa-dev
- libglu1-mesa-dev
- libglut3-dev
- libpango1.0-dev
- libboost-dev
- libxxf86vm-dev
If you want to use FMOD for audio, fmod 3.75 must be installed system-wide or manually unpacked so that the fmod... folder is in the same folder as the Gosu, GosuImpl and linux folders. Otherwise, SDL_mixer needs to be present (package libsdl-mixer1.2-dev).
Copy-and-pastable command line for Ubuntu 7.10 (Gutsy Gibbon), with SDL-mixer as the audio library and without Ruby support:
sudo apt-get install g++ autoconf libgl1-mesa-dev libglu1-mesa-dev libglut3-dev libpango1.0-dev libboost-dev libxxf86vm-dev libsdl-mixer1.2-dev
Ruby/Gosu will be built if the following packages are installed as well:
- ruby
- ruby1.8
- ruby1.8-dev
- swig (or swig1.3)
Copy-and-pastable command line for Ubuntu 7.10 (Gutsy Gibbon), with SDL-mixer as the audio library and Ruby support:
sudo apt-get install g++ autoconf libgl1-mesa-dev libglu1-mesa-dev libglut3-dev libpango1.0-dev libboost-dev libxxf86vm-dev ruby ruby1.8 ruby1.8-dev swig libsdl-mixer1.2-dev
Compiling Gosu
To compile Gosu for Unix, go into the linux directory and execute:
autoconf ./configure make
Using Ruby/Gosu
Just require gosu.so (require 'gosu') and everything should work fine. You can copy gosu.so into the examples folder and run Tutorial.rb to check everything's okay.
Using C++ Gosu
Copy or link Gosu into your application's directory. You've got to compile with `gosu/linux/gosu-config --libs` and -Igosu `gosu/linux/gosu-config --cxxflags`
A simple Makefile could look like this:
OBJS = main.o player.o
CXXFLAGS += -Igosu/ `gosu/linux/gosu-config --cxxflags`
LIBS = `gosu/linux/gosu-config --libs`
myGame: $(OBJS) gosu/linux/gosu.a
g++ -o myGame $(OBJS) gosu/linux/gosu.a $(LIBS)
Sign in to add a comment

Might want to add that you need to copy gosu.so to your ruby installation's lib directory in order to use Gosu in ruby. This could alternatively be added to the Makefile with the install target.
The make error above is a result of compiling Gosu on Ubuntu Feisty. To fix the error I added #include <boost/none.hpp> to the LargeImageData?.hpp file and recompiled with make. More details can be found at http://crunchlife.com/articles/2007/11/20/compiling-the-gosu-game-development-library-on-ubuntu-feisty
Thanks, I fixed and committed this. I'll leave the rather unhandy error message as it is for now though, because there may still be Ubuntu users looking for just this :) Thanks!
Doesn't seem to work with ruby1.9. Reports about missing ruby.h.
Running Ubuntu Gutsy.
Hi, weird, I see nothing specific to Ruby 1.8 in the configure/makefile. Is ruby1.9-dev installed? Can you find ruby.h via locate?
julianraschke: ruby.h was found with locate and ruby1.9-dev was installed, but gosu build process couldn't find it or something
Hi! I'm wondering if a Fedora user can help me. I'm trying to get Gosu to compile on an XO laptop.
When I try to ./configure, i get "lib/cpp fails sanity check" but I have gcc, g++ installed and they are in $PATH. What else could I try?
Thanks!
ah, I needed glibc-headers...
jeremias.kangas: I hope you are still reading this -- Gosu should now work with Ruby 1.9 on Linux. Check out the latest source from SVN and let me know how it works for you! :)
I'm using qmake for just about everything, but I needed some time to get gosu working with qmake. Here's how you do it:
you need the folder structure: gosu_tutorial/src/Tutorial.cpp << from the gosu examples dir
gosu_tutorial/media << from the gosu examples dir
gosu_tutorial/gosu_tutorial.pro << create with contents below
TEMPLATE = app DEPENDPATH += . include src INCLUDEPATH += . include INCPATH += $$system(../gosu/gosu-read-only/linux/gosu-config --cxxflags) LIBS += ../gosu/gosu-read-only/linux/gosu-config --libs -lgosu SOURCES += src/Tutorial.cpp HEADERS += CONFIG += qt debug_and_release warn_on CONFIG(debug, debug|release) { DESTDIR = debug } else { DESTDIR = release }now you run "qmake" in that dir
then "make"
then "debug/gosu_tutorial" (or if you used "make release" use "release/gosu_tutorial")
I'll create a windows tutorial for that as soon as I successfully compiled everything on windows
Hey, guys. I'm trying to get gosu installed on Fedora 8. When compiling, I'm getting an error (/usr/bin/ld: cannot find -lboost_thread). Seems it can't find libboost_thread. But when I locate libboost_th, I get
Any suggestions? Am I missing a library? I can't seem to find any other boost libraries to install, so I'm really not sure.
Well, the -mt suffix means a boost library is compiled with multithread support, which is kind of redundant for Boost Threads. I don't know why some distributions omit this and Fedora doesn't, but if you can just replace -lboost_thread by -lboost_thread-mt, that should fix it :) Not sure how to add a check for this case to the AutoConf? file right now… :(
Thanks, Julian. That fixed it.
For anyone else installing gosu in Fedora 8 (maybe earlier version, as well), I'll just recap the fix.
Run autoconf and ./configure as normal, but before running make, open up the Makefile and change the two libboost_thread references from -lboost_thread to -lboost_thread-mt. Then run make to compile.
AFter compiling you need to move <gosu_direcotry>/linux/gosu.so to /usr/lib/ruby/site_ruby/1.8/i386-linux/ (assuming you took the default options when install ruby).
(Note regarding the above comments: The threading has been taken out in 0.7.9 and will come back in 0.8.x, so these libraries aren't relevant or needed right now.)
How can I compile Gosu on a x64 system (Ubuntu)? make stops with an error:
about the ruby.h missing: if you got ruby1.9 installed, you need ruby1.9-dev since gosu will automatically try to use ruby1.9 (the above apt-get line will only install 1.8 and 1.8-dev which will be ignored)
dasgib: see http://code.google.com/p/gosu/issues/detail?id=38
also: like seancribbs said, it would be nice if "make install" actually installed gosu.so in the ruby lib dir…
Using the right paths causes so much trouble that I've actually removed the 'make install' command for now. Maybe it'll come back, but I'd much prefer a binary Linux gem anyway. Of course, it'd be even cooler if the Rakefile could somehow cross-compile all common Linux architectures at once.
For Ubuntu 8.04 (Hardy Heron) Install package "libasound2-plugins" Run "asoundconf set-pulseaudio"