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

Author Topic: Redistributing SFML games for Linux  (Read 2656 times)

0 Members and 1 Guest are viewing this topic.

calcfreak89

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • https://sites.google.com/site/calcfreak89/
Redistributing SFML games for Linux
« on: November 08, 2010, 04:40:11 am »
How could I use static libraries with SFML games for Linux?  If I can't, then how can I just include the .so files for SFML in the same folder as the game, so that people don't have to install SFML just to have my games work?  The only way I can get a program working that uses SFML is if SFML is installed on that computer (running a Linux distro).  Whereas on Windows, I can just include the necessary DLLs, and it works.  I use Code::Blocks on Ubuntu 10.10 x64 and I am only writing C++ code, so it works natively with SFML.

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
Redistributing SFML games for Linux
« Reply #1 on: November 08, 2010, 06:59:44 am »
You can link them statically. Add a -s to the end of the library name when linking them. (Example: -lsfml-system-s)

Anyway since you are using a Debian based system you can wrap your application up in a .deb package and make it depend on the SFML library which will force the user to install them. Voila, problem solved.

Also, what says you can't take the shared libraries of Linux and put them in the same folder just as Windows? Works there too. If you are having trouble finding your SFML library files then they should be placed under /usr/lib and just search after "sfml".
Developer and Maker of rbSFML and Programmer at Paradox Development Studio

bastien

  • Full Member
  • ***
  • Posts: 231
    • View Profile
    • http://bastien-leonard.alwaysdata.net
Redistributing SFML games for Linux
« Reply #2 on: November 08, 2010, 11:52:47 am »
If you make the source code available, people will install the program in whatever way is the standard on their distribution.
There are various formats of packages which contain your program, its data and its dependencies. When the user installs the package, the package automatically ensure that the dependencies are installed as well.
You just give people the source code, the data and the installation instructions, and if your program gets somewhat popular, some people will create the packages for their distribution.

If you don't distribute your source code, you can create an installer (can be as simple as a script or can be like a Windows installer) which will attempt to install the program à la Windows. That's pretty ugly though.

Quote from: "Groogy"
Also, what says you can't take the shared libraries of Linux and put them in the same folder just as Windows? Works there too. If you are having trouble finding your SFML library files then they should be placed under /usr/lib and just search after "sfml".


If I remember correctly, you can't do that because of security issues. I just tried it and it didn't seem to work, but it's been a while since I made a so so I might have done something wrong.
Check out pysfml-cython, an up to date Python 2/3 binding for SFML 2: https://github.com/bastienleonard/pysfml-cython

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
Redistributing SFML games for Linux
« Reply #3 on: November 08, 2010, 01:02:23 pm »
Well what I remember the linker should look in the "./" folder too. Might be that it depends on the distribution. Anyway you can force it to look at the "./" folder trough the -rpath when linking the executable.

Might've also been that you copied a symbolic link file and not the actual library and that somehow made a mess? Or just the simple idea about it being different on distributions or me being wrong :P
Developer and Maker of rbSFML and Programmer at Paradox Development Studio

Svenstaro

  • Full Member
  • ***
  • Posts: 222
    • View Profile
Redistributing SFML games for Linux
« Reply #4 on: November 08, 2010, 01:36:18 pm »
This question has been answered quite a few times already. Please use the search: http://www.sfml-dev.org/forum/viewtopic.php?t=3260&highlight=ldlibrarypath

calcfreak89

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • https://sites.google.com/site/calcfreak89/
Redistributing SFML games for Linux
« Reply #5 on: November 08, 2010, 07:10:32 pm »
Thank you very much for all your help.  It seems the best thing I can do is package it in a .deb package.  I don't know how to do this though...  Could someone tell me about any programs that can make those packages and how to use them?

 

anything