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

Author Topic: Distribute linux binary using SFML  (Read 3708 times)

0 Members and 1 Guest are viewing this topic.

petitg1987

  • Newbie
  • *
  • Posts: 4
    • View Profile
Distribute linux binary using SFML
« on: April 03, 2016, 12:40:50 pm »
Hello,

I've created an application which use SFML on Ubuntu 15.10 using: libsfml-graphics2.3v5, libsfml...
I try to create a Debian package (.deb) from the binary and I need to specify the dependencies of my binary.

I don't know which exact dependencies/version I need to specify. Here the tests I've done:

- I've tried to specify libsfml-graphics2.3v5 as dependency: it work on Ubuntu 15.10 but not on Ubuntu 14.04 because this package doesn't exist (only libsfml-graphics2 exist).

- I've tried to specify libsfml-graphics2 as dependency: it doesn't work on Ubuntu 15.10 because this package doesn't exist (only libsfml-graphics2.3v5 exist). On Ubuntu 14.04, the package is installed because all dependencies exist. Unfortunately, when I execute the binary, I've got this message : "libsfml-graphics.so.2.3...no such file or directory" (only libsfml-graphics.so.2 & libsfml-graphics.so.2.1 exist).

My question:
* Is it possible to compile a binary which can run on all Linux distributions having libsfml-graphics2* ? How ?
* Which dependency I need to specify for my binary ?

Thank you in advance.


Spirro

  • Jr. Member
  • **
  • Posts: 66
    • View Profile
Re: Distribute linux binary using SFML
« Reply #1 on: April 03, 2016, 06:39:00 pm »
My question:
* Is it possible to compile a binary which can run on all Linux distributions having libsfml-graphics2* ? How ?
* Which dependency I need to specify for my binary ?

Thank you in advance.

You can set a primary search path at compile/link time with -R or -rpath.  When the application is run, whatever path you set at compile/link time will get searched first.  If the lib isn't found then the system paths will be searched.  You can do a search for how to use those commands.

Dependencies will depend on what SFML libraries you used for your application.  You can get full lists of what each module depends on in the tutorial pages.  If you can't figure out the exact list you need then one option would be to just make a virtual box and put your app in that.  Run it and it will complain about what it cant find then add libs till it works.
 

Jesper Juhl

  • Hero Member
  • *****
  • Posts: 1405
    • View Profile
    • Email
Re: Distribute linux binary using SFML
« Reply #2 on: April 03, 2016, 09:15:36 pm »
Running ldd -v on a file will list its dependencies.
« Last Edit: April 03, 2016, 09:18:05 pm by Jesper Juhl »

petitg1987

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Distribute linux binary using SFML
« Reply #3 on: April 04, 2016, 09:07:43 am »
Thanks for your answers:

Quote
You can set a primary search path at compile/link time with -R or -rpath.
When I launch my app on Ubuntu 14.04: it doesn't find libsfml-graphics.so.2.3 because it doesn't exist (only version 2.1 exist). Do you suggest I insert SFML 2.3 directly on my package and I reference it with -rpath option ?

Quote
Running ldd -v on a file will list its dependencies.
Yes, I have already run this command and the dependencies returned are libsfml-graphics2.3v5,.... But as I explain in my first post: it's incompatible with Ubuntu older version like 14.04 :(

Here others questions which could help me to understand better:
* If I create an binary using SFML 2.3. Could I execute it with SFML 2.1 without re-compile it ?
* Why in Ubuntu 14.04, the package name is "libsfml-graphics2" (which refer to version 2.1) and on Unbutu 15.10, the package name is "libsfml-graphics2.3v5". Shouldn't we have same package name: "libsfml-graphics2" ?

fallahn

  • Hero Member
  • *****
  • Posts: 507
  • Buns.
    • View Profile
    • Trederia
Re: Distribute linux binary using SFML
« Reply #4 on: April 04, 2016, 10:54:23 am »
I had this problem when I wanted to place binaries of my game on itch.io. In the end I found the best solution was to statically link all the dependencies.

Spirro

  • Jr. Member
  • **
  • Posts: 66
    • View Profile
Re: Distribute linux binary using SFML
« Reply #5 on: April 04, 2016, 04:51:27 pm »
When I launch my app on Ubuntu 14.04: it doesn't find libsfml-graphics.so.2.3 because it doesn't exist (only version 2.1 exist). Do you suggest I insert SFML 2.3 directly on my package and I reference it with -rpath option ?
Yes.

Quote
Here others questions which could help me to understand better:
* If I create an binary using SFML 2.3. Could I execute it with SFML 2.1 without re-compile it ?
Yes you should be able to because the API hasn't changed, but how some of the features are implemented has.  So if you run your game binary and it uses a lower version of SFML it may not behave as expected, so distributing your development version of SFML with the binary is your best option so that it runs as expected.

Quote
* Why in Ubuntu 14.04, the package name is "libsfml-graphics2" (which refer to version 2.1) and on Unbutu 15.10, the package name is "libsfml-graphics2.3v5". Shouldn't we have same package name: "libsfml-graphics2" ?

It's up to the people that maintain the packages for Ubuntu.  They do what they think is best/needed.  If you want it changed you can get in contact with them.  But you'd be fine compiling SFML for yourself and distributing those libs with your program.

victorlevasseur

  • Full Member
  • ***
  • Posts: 206
    • View Profile
Re: Distribute linux binary using SFML
« Reply #6 on: April 04, 2016, 08:07:29 pm »
Quote
Yes you should be able to because the API hasn't changed, but how some of the features are implemented has.  So if you run your game binary and it uses a lower version of SFML it may not behave as expected, so distributing your development version of SFML with the binary is your best option so that it runs as expected.
Because the API was not broken, you can compile it with 2.1. But the ABI changed so you will need to rebuild it.