Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Compiling SFML (snapshot from github) on Ubuntu 12.04  (Read 4815 times)

0 Members and 1 Guest are viewing this topic.

amhndu

  • Newbie
  • *
  • Posts: 42
  • Err, err and err again, but less, less and less
    • View Profile
    • amhndu.github.io
    • Email
Compiling SFML (snapshot from github) on Ubuntu 12.04
« on: March 07, 2015, 07:35:31 am »
I had way too much troubles compiling SFML on Ubuntu 12.04, thought I'd write how to do it so someone else hopefully won't have to waste as much time.

First, the packages, apart from the packages listed on the tutorial , I had to install the XCB packages.
Code: [Select]
sudo apt-get install libxcb1-dev libx11-xcb-dev libxcb-icccm4-dev libxcb-image0 libxcb-randr0-dev libxcb-util0-dev

And then as it comes out the xcb_icccm (/usr/include/xcb/xcb_icccm.h) header , has a function prototype using a variable name "class" ...
I had to manually edit it and rename "class" to "_class". (I don't why the error happened, it did have a preprocessor directive to declare "extern C" if __cplusplus was defined , to fix it I tried #define __cpluscplus in Unix/WindowX11impl but it produced tons of more errors  :P)

And then finally , I could compile . (But [on my system at least] , there was no libGLEW.so , i manually had to make a symlink to libGLEW.so.1.5).

Oh and of course , installing the compiled SFML libraries don't work because of the outdated packages in the Ubuntu repository for 12.04

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Compiling SFML (snapshot from github) on Ubuntu 12.04
« Reply #1 on: March 07, 2015, 09:20:03 am »
The xcb_icccm problem is really annoying. However, it seems that this header can easily be dropped (how many symbols are we using from it?), and if not, there is a hack that we can apply.

#define class class_name
#include <xcb_icccm.h>
#undef class
Laurent Gomila - SFML developer

amhndu

  • Newbie
  • *
  • Posts: 42
  • Err, err and err again, but less, less and less
    • View Profile
    • amhndu.github.io
    • Email
Re: Compiling SFML (snapshot from github) on Ubuntu 12.04
« Reply #2 on: March 07, 2015, 10:26:11 am »
Hmm, that's a better way to do it :)

Also, it would be helpful if the dependencies include the xcb components as well. Or is it only required when compiling from github ? Even in that case , could we have some documentation for the list of dependencies and workarounds for compiling from github ? That would be very useful.

(And thank you for making this awesome project :))

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
Re: Compiling SFML (snapshot from github) on Ubuntu 12.04
« Reply #3 on: March 07, 2015, 11:07:37 am »
The xcb_icccm thing is only annoying for those unwilling or unable to upgrade. Bear in mind that it was already fixed 4 years ago. Why Ubuntu didn't manage to get it into their 12.04 release? I have no idea.

You really can't expect software like SFML that is constantly evolving and taking advantage of new features to be able to work with such old headers. And to be fair, it's not the Ubuntu team's fault either. There have been 5 releases since Precise, and the class issue in xcb_icccm was already fixed in Quantal. If you want to use cutting edge software (direct from source even), then it is not unreasonable to ask that the dependencies for it should be up-to-date as well. On the other hand, if you want to stay on an older release, then there are older versions of SFML you can use. This is exactly the same with any package you install through your package manager, you can't just install a newer version of a certain package without the newer version of its dependencies. It's all or nothing.

As for documenting the required packages, don't forget that this is still in development. Documentation for building will be updated before it gets released, but until then, we expect anybody building from the repository to either "figure it out" for themselves, or ask here on the forum.

About the missing GLEW symlink: I have no idea why that is happening, but maybe it has something to do with still being on such an outdated release? ;D Either way, GLEW is going to be removed as a dependency from SFML soon, so it won't matter in the future.
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).

amhndu

  • Newbie
  • *
  • Posts: 42
  • Err, err and err again, but less, less and less
    • View Profile
    • amhndu.github.io
    • Email
Re: Compiling SFML (snapshot from github) on Ubuntu 12.04
« Reply #4 on: March 07, 2015, 11:18:24 am »
Alright, I get it : Old distribution (but still officially supported) -> Bad :(

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
Re: Compiling SFML (snapshot from github) on Ubuntu 12.04
« Reply #5 on: March 07, 2015, 11:43:59 am »
There is nothing wrong with using a dated distribution, if you don't intend on changing your usage of the machine. I can imagine people running a local server (not so security critical) for 5 years and still being happy with it. If it ran back then, it will still run now. You also don't necessarily go trying to compile new stuff on servers do you?

Using a dated distribution, and expecting it to be compatible with newer stuff, now that is a different story. The "guarantee" that was made back then when it was released was that packages would function more or less fine with each other, provided they were part of the same release. If you want to use even just 1 newer package, or something directly from source, anybody will tell you that it is more than likely you will eventually have to upgrade. I don't know of any Linux distributions that let you install individual packages from the latest snapshot without requiring you to upgrade a ton of other stuff as well, which ends up performing the equivalent of a distribution upgrade.

This is not just a Linux thing by the way. The difference between Linux and other operating systems is that Linux probably has a much shorter life cycle. You will find the same on Windows. Want to play the latest games that depend on Direct3D 11 and still running Windows XP? Too bad, you'll have to upgrade. Many take it for granted that we are able to "fix" these issues so easily on Linux compared to Windows. Like you found out, it doesn't take that much to make an older system compatible with newer software, if you know that it is possible and how to do it. On Windows, even if you get a new graphics card and stick it in a Windows XP machine, there is still no chance you are going to get Direct3D 11 games running.
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).

Jesper Juhl

  • Hero Member
  • *****
  • Posts: 1405
    • View Profile
    • Email
Re: Compiling SFML (snapshot from github) on Ubuntu 12.04
« Reply #6 on: March 07, 2015, 03:40:57 pm »
@binary1248 right on the money.

amhndu

  • Newbie
  • *
  • Posts: 42
  • Err, err and err again, but less, less and less
    • View Profile
    • amhndu.github.io
    • Email
Re: Compiling SFML (snapshot from github) on Ubuntu 12.04
« Reply #7 on: March 08, 2015, 04:19:01 am »
@binary1248 You are right, I shouldn't have made that generalization. :)

Glocke

  • Sr. Member
  • ****
  • Posts: 289
  • Hobby Dev/GameDev
    • View Profile
Re: Compiling SFML (snapshot from github) on Ubuntu 12.04
« Reply #8 on: March 08, 2015, 10:44:20 am »
Alright, I get it : Old distribution (but still officially supported) -> Bad :(
Well ^^ I'm running 14.04 and there wasn't any problem while compiling SFML.

But anyway: In general keeping your ubuntu (nearly) up-to-date is often a good idea. In the beginning I was always upgrading when a release came ^^ But nowadays I'm waiting for the next release before installing the previous one - it made the total experience more stable :D

So I'd recommend upgrading your ubuntu distribution. Of course there might be other ways (e.g. using PPA for the outdated headers). But this will lead you to lots of PPAs...

Hope that helps xD

Kind regards
Glocke
Current project: Racod's Lair - Rogue-inspired Coop Action RPG

 

anything