SFML community forums

Bindings - other languages => C => Topic started by: c-jay on August 20, 2016, 11:16:20 am

Title: How to release a sfml-program for several distribution?
Post by: c-jay on August 20, 2016, 11:16:20 am
Hi, my project of coding some stuff with sfml is in the final state.
Now I like to build a release for students but I'm very new to cmake/ make .

Do anybody know a good tutorial or bool to release an C-program, based on SFML/CSFML 2.3 to another machine like Ubuntu 14.04 ?

Thank you very much
Title: Re: How to release a sfml-program for several distribution?
Post by: Jesper Juhl on August 21, 2016, 09:44:36 pm
1. Build your own sfml. 2. Build your executable with a RPATH that finds the library relative to the executable ($ORIGIN). 3. Package the library files alongside your executable in the expected location.
Title: AW: Re: How to release a sfml-program for several distribution?
Post by: eXpl0it3r on August 22, 2016, 10:31:39 am
1. Build your own sfml. 2. Build your executable with a RPATH that finds the library relative to the executable ($ORIGIN). 3. Package the library files alongside your executable in the expected location.
I always wonder with that, how are SFML's dependencies handled? Can I compile this on Debian and then really run it on Ubuntu, Arch and Gentoo? What if runtime libs differ?
Title: Re: How to release a sfml-program for several distribution?
Post by: texus on August 22, 2016, 04:54:03 pm
Quote
I always wonder with that, how are SFML's dependencies handled? Can I compile this on Debian and then really run it on Ubuntu, Arch and Gentoo? What if runtime libs differ?
I have tried compiling an application in the past that ran on both ubuntu and arch linux. I never really knew which dependencies to ship so I just copied the ones that were asked for when starting the app. The result was that a year later on a different system it sometimes missed some library.
So I decided to take a more detailed look into this today and these are my findings (some information may be incorrect, these are simply my observations). Since I do not have ubuntu I used docker from arch linux.

There are 2 problems with distributing the executable:
1) You can only run the executable on newer systems (or the same) as the one you compile with.
(click to show/hide)

2) Not all dependencies should be shipped.
(click to show/hide)

A third problem might be 32bit vs 64bit, I didn't test with that but I doubt that my 64bit app will just run on a 32bit linux.

The following test program should run out of the box on anything newer than ubuntu 14.04 (only tested running on arch linux):
https://www.dropbox.com/s/jacna15uyttfwov/linux64-binary-test.tar.gz?dl=1 (https://www.dropbox.com/s/jacna15uyttfwov/linux64-binary-test.tar.gz?dl=1)

This is the code that I have in my cmake script (https://github.com/texus/LD33-Game/blob/master/CMakeLists.txt) to set the RPATH
Code: [Select]
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
set(CMAKE_INSTALL_RPATH "$ORIGIN/lib/:$$ORIGIN/lib/")