Not logged inGosu Forums
Forum back to libgosu.org Help Search Register Login
Up Topic Gosu / Gosu Exchange / Can’t compile under linux. LibX11 error …
- - By ICEM4N Date 2011-05-17 19:24 Edited 2011-05-18 05:14
Hi, i'm trying to compile gosu (well, the examples) under Linux Mint Debian (Based on Debian Testing). I'm using the C++ option (instead of Ruby)

Every packed seemed to be installed ok, but I'm getting this error :



conejo@madriguera ~/devkitpro/cosas/jlnr-gosu-6ffa49f/linux $ make
if [ \! -d ../bin ]; then mkdir ../bin; fi
if [ \! -d ../lib ]; then mkdir ../lib; fi
if [ \! -d Graphics ]; then mkdir Graphics; fi
if [ \! -d Sockets ]; then mkdir Sockets; fi
if [ \! -d Audio ]; then mkdir Audio; fi
g++ /home/conejo/devkitpro/cosas/jlnr-gosu-6ffa49f/linux/../examples/Tutorial.cpp -o /home/conejo/devkitpro/cosas/jlnr-gosu-6ffa49f/linux/../examples/Tutorial -fPIC -I.. -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -Wall -pthread -I/usr/include/pango-1.0 -I/usr/include/freetype2 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -DHAVE_SYS_STAT_H -DNDEBUG -O3 -pipe -fomit-frame-pointer -I/usr/include/SDL -L -lX11 -pthread -lpangoft2-1.0 -lpango-1.0 -lfreetype -lfontconfig -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lrt -lglib-2.0   -L/usr/lib -lSDL -lSDL_mixer -lpng -lstdc++ -lGL -lSDL_ttf -lfreeimage  ../lib/libgosu.a
In file included from ../Gosu/Gosu.hpp:13:0,
                 from /home/conejo/devkitpro/cosas/jlnr-gosu-6ffa49f/linux/../examples/Tutorial.cpp:1:
../Gosu/Fwd.hpp:10:11: warning: attribute ignored in declaration of ‘struct Gosu::Audio’
../Gosu/Fwd.hpp:10:11: warning: attribute for ‘struct Gosu::Audio’ must follow the ‘struct’ keyword
/home/conejo/devkitpro/cosas/jlnr-gosu-6ffa49f/linux/../examples/Tutorial.cpp: In constructor ‘Player::Player(Gosu::Graphics&, Gosu::Audio&)’:
/home/conejo/devkitpro/cosas/jlnr-gosu-6ffa49f/linux/../examples/Tutorial.cpp:75:52: warning: ‘Gosu::Sample::Sample(Gosu::Audio&, const std::wstring&)’ is deprecated (declared at ../Gosu/Audio.hpp:100)
/usr/bin/ld: ../lib/libgosu.a(WindowX.o): undefined reference to symbol 'XAllocSizeHints'
/usr/bin/ld: note: 'XAllocSizeHints' is defined in DSO //usr/lib/libX11.so.6 so try adding it to the linker command line
//usr/lib/libX11.so.6: could not read symbols: Invalid operation
collect2: ld returned 1 exit status
make: *** [/home/conejo/devkitpro/cosas/jlnr-gosu-6ffa49f/linux/../examples/Tutorial] Error 1


In fact, the library seemed to be compiled OK. If I removed the examples folder, it compiled and installed perfectly, but trying to compile the examples (or any other code with gosu C++) gives the same error, for example :



conejo@madriguera ~/devkitpro/omegote/linux/Parte 1 $ make
Compiling... main.cpp
Linking binary...
/usr/bin/ld: /usr/local/lib/libgosu.a(WindowX.o): undefined reference to symbol 'XAllocSizeHints'
/usr/bin/ld: note: 'XAllocSizeHints' is defined in DSO //usr/lib/libX11.so.6 so try adding it to the linker command line
//usr/lib/libX11.so.6: could not read symbols: Invalid operation
collect2: ld returned 1 exit status
make: *** [programa] Error 1
Parent - - By jlnr (dev) Date 2011-05-18 07:11
To be honest, I have absolutely no idea what the Linux autotools setup is doing and how and why :) What does the generated makefile look like? Does it link against -LX11?
Parent - By ICEM4N Date 2011-05-18 13:07
Solved,

Need to add this to the Makefile :

-lX11 -ldl -lXext

Then, everything works as expected
Parent - - By beoran Date 2011-05-20 06:01
Then perhaps you should use a different build system *cough*CMake*cough*? :)
Parent - - By jlnr (dev) Date 2011-05-20 16:17
The C++ Linux port is not exactly my favorite part of Gosu ;) I only ever use it to test if it still works.

I love how the Ruby gem works so much better with so much less fugliness. Contributions (github forks) are very welcome, if the CMake setup would be as clean as the extconf.rb.
Parent - - By beoran Date 2011-05-20 19:22
Well, I don't actually use Gosu as have my own C game library, "Gari", but I'll see what I can do.
Cmake, is useful on windows and mac too, it generates native files for visual C++, etc.
Parent - - By erisdiscord Date 2011-05-20 22:04
I feel CMake is not that great either. The Xcode projects it creates are structured oddly and it's nearly impossible to trace the source of a library error in its Makefile output. I've always had terrible luck with it. :C

I'd like to see something akin to Ant, but without all the verbosity of XML. Build systems that just generate files for other build systems are lame.
Parent - By beoran Date 2011-05-21 12:46
Unfortunately, most build systems for C do just that. I think that from all the build systems I know, CMake is currently the open source build system that sucks the least. But if you know any better alternatives, I'd love to hear about them, though. :)
Up Topic Gosu / Gosu Exchange / Can’t compile under linux. LibX11 error …

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill