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

Author Topic: [Solved][Linux] Are there any needed libraries to run a SFML program?  (Read 4088 times)

0 Members and 1 Guest are viewing this topic.

santiaboy

  • Full Member
  • ***
  • Posts: 118
    • View Profile
Hey guys, it's me again ;D

First of all, I'm linking dinamically. I know that in Windows you have to provide .dlls, so anyone can run the program. Now, on Linux, I provide the SFML libs with the program, but I want to know if the user would need something else. Maybe instaling libglew or something like that.

Cheers!
« Last Edit: September 20, 2013, 07:15:45 pm by santiaboy »

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).

santiaboy

  • Full Member
  • ***
  • Posts: 118
    • View Profile
Re: [Linux] Are there any needed libraries to run a SFML program?
« Reply #2 on: September 19, 2013, 10:05:36 pm »
Just to be clear, I am not asking to compile in Linux. I can already do that.

I want to release my program, and I want to know if somebody else needs any additional libs (apart from the sfml ones)

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
Re: [Linux] Are there any needed libraries to run a SFML program?
« Reply #3 on: September 19, 2013, 10:22:19 pm »
Quote
On Linux however, nothing is provided and SFML relies on your own installation of the libraries it depends on. Here is a list of what you need to install before compiling SFML:

    pthread
    opengl
    xlib
    xrandr
    freetype
    glew
    jpeg
    sndfile
    openal

The exact name of the packages depend on each distribution. And don't forget to install the development version of these packages.
Why would you need to install the development version of the packages if SFML didn't require them in some way? If you didn't need to provide any of those libraries on the target system, there would be no need for them during development either...

This is why package managers exist. Unless you static link everything into your executable (which I don't recommend on Linux) the target machine will have to provide all these libraries as well, which the user would need to install manually.

There is no difference between the libraries you need during development (which strictly speaking consists of compiling and linking) and those you need during execution of the binary. Execution of the binary will invoke the executable linker/loader provided by the operating system to complete the final link stage if your application is using dynamic linking.
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).

FRex

  • Hero Member
  • *****
  • Posts: 1845
  • Back to C++ gamedev with SFML in May 2023
    • View Profile
    • Email
Re: [Linux] Are there any needed libraries to run a SFML program?
« Reply #4 on: September 19, 2013, 10:32:27 pm »
Quote
There is no difference between the libraries you need during development (which strictly speaking consists of compiling and linking) and those you need during execution of the binary.
Don't devel packages come with headers besides just binaries or am I living in horrible self deceit here?
Back to C++ gamedev with SFML in May 2023

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10819
    • View Profile
    • development blog
    • Email
AW: Re: [Linux] Are there any needed libraries to run a SFML program?
« Reply #5 on: September 19, 2013, 10:54:05 pm »
Don't devel packages come with headers besides just binaries or am I living in horrible self deceit here?
Yes that's why he was talking about libraries and not packages. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Ixrec

  • Hero Member
  • *****
  • Posts: 1241
    • View Profile
    • Email
Re: [Linux] Are there any needed libraries to run a SFML program?
« Reply #6 on: September 19, 2013, 11:13:28 pm »
He switched between the two terms so often I honestly thought he was saying the end users need to install all the development packages on their system to run any dynamically-linked SFML program on Linux.  I assume FRex was similarly confused.

To be honest, I still don't get the arguments for dynamic linking outside of multi-threaded applications.  I've been using static for everything just so I don't have to worry about all these dependencies (except the LGPL ones).  Is there some really compelling reason for dynamic linking that applies on Linux and Mac but not on Windows?  Because "this 3rd party library might improve its implementation someday and you might get the benefit of that for free!" just doesn't sound like a good enough reason to complicate distribution and introduce potential compatibility problems.
« Last Edit: September 19, 2013, 11:15:04 pm by Ixrec »

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
Re: [Linux] Are there any needed libraries to run a SFML program?
« Reply #7 on: September 19, 2013, 11:36:43 pm »
He switched between the two terms so often I honestly thought he was saying the end users need to install all the development packages on their system to run any dynamically-linked SFML program on Linux.  I assume FRex was similarly confused.
"Library" is easier to type than "Shared Object File" but yes... I was referring to the file containing the library object code.

To be honest, I still don't get the arguments for dynamic linking outside of multi-threaded applications.  I've been using static for everything just so I don't have to worry about all these dependencies (except the LGPL ones).  Is there some really compelling reason for dynamic linking that applies on Linux and Mac but not on Windows?  Because "this 3rd party library might improve its implementation someday and you might get the benefit of that for free!" just doesn't sound like a good enough reason to complicate distribution and introduce potential compatibility problems.
Package managers... and GPL.

Windows doesn't have a decent and widely accepted package manager (yet). If you are lucky the installer will take care of installing the required runtimes but that is also all it does most of the time. Some highly advanced installers might also pull other dependencies from the internet and install them somewhere for you, but there isn't any central repository within the operating system where all installed programs and their dependencies are registered. As far as I know, there also (still) isn't a proper way of solving the compatibility issue between programs and the specific versions of libraries they depend on. If I browse through my program folders I tend to see .dlls shipped with them all with the same name and roughly the same size. The few bytes that are different is what breaks the whole idea behind sharing multiple DLLs between programs. Was a nice idea.... horrible implementation, hence, broken. Since you are inclined to ship the DLL you depend on with the program, you might as well static link it into the program if you can, the less files the better. The only thing that prevents many from doing this is the licensing restrictions that apply to those libraries dictating that you can only dynamic link (kind of like LGPL except proprietary).

With package managers and proper versioning, program A depends on library version X.Y.Z, program B depends on the same library version X.Y, hence they can share the shared object file and it doesn't need to be reinstalled somewhere else. They don't need to be identical as is common practice in Windows (yes, even a minor version number change can break things so better stay safe, many developers didn't understand the notion of binary compatibility I guess). If you know that your library probably won't be used by any other program, there really is no space advantage, so static linking is just as good in that respect.

In the end, if you want to install awesome_game_9000 on Linux, you will do something like apt-get install awesome_game_9000 and apt will take care of the rest. Whether you static link or dynamic link doesn't really matter for the end user, since they will run it and it will work. If only your program uses the library, they also won't notice any difference in disk space taken up assuming you didn't compress the binary files in anyway (static linking might yield better compression than compressing 2 separate binary files).

For development I always static link. It is way easier to use standard profiling tools such as gprof when all the symbols are in a single file, be it on Linux or Windows.
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).

FRex

  • Hero Member
  • *****
  • Posts: 1845
  • Back to C++ gamedev with SFML in May 2023
    • View Profile
    • Email
Re: [Linux] Are there any needed libraries to run a SFML program?
« Reply #8 on: September 19, 2013, 11:47:26 pm »
If one library is used by few things it's loaded just once and everyone shares so your program starts faster and uses less memory. Happens on Windows too, there was something to bring FF launch up to par with IE which was preloading its libs like IE did on startup, but you don't usually get chance to share anything because everyone brings own dlls or links statically.
I may be horribly wrong.
Back to C++ gamedev with SFML in May 2023

Ixrec

  • Hero Member
  • *****
  • Posts: 1241
    • View Profile
    • Email
Re: [Linux] Are there any needed libraries to run a SFML program?
« Reply #9 on: September 20, 2013, 12:21:08 am »
Thanks for the thorough answer, I think that clears up all of my confusion regarding linking.

I think the main thing putting me off it right now is that it seems like all of the *nix-based OSes (ie, everyone but Windows) has a completely different package format, so I'd have to not only compile on every system but learn how to make packages on every system.  But whenever I finally learn .deb and .rpm and desktop entries and .app and some tool to make .pkg and .dmg and whatever else I need, then I'll probably switch to dynamic linking for non-Windows.  But man is that going to take a while.

Any advice on the best way to learn how to do packaging right for all the platforms?  Or do I just have to bite the bullet and study every single format one at a time?
« Last Edit: September 20, 2013, 12:27:57 am by Ixrec »

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
Re: [Linux] Are there any needed libraries to run a SFML program?
« Reply #10 on: September 20, 2013, 12:37:45 am »
There is no single let alone best "way" to do packaging right on all platforms. Even on Linux along there are multiple package management systems... apt, rpm, pacman, portage, etc. and they all have their own philosophies. If you want to create a package for them, you should start by reading their official documentation.

The documentation for apt can be found here: https://wiki.debian.org/HowToPackageForDebian
For PKGBUILD here: https://wiki.archlinux.org/index.php/Creating_Packages
For RPM here: http://fedoraproject.org/wiki/How_to_create_an_RPM_package
For portage here: http://wiki.gentoo.org/wiki/Binary_package_guide
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).

santiaboy

  • Full Member
  • ***
  • Posts: 118
    • View Profile
Re: [Linux] Are there any needed libraries to run a SFML program?
« Reply #11 on: September 20, 2013, 07:15:28 pm »
There is no difference between the libraries you need during development (which strictly speaking consists of compiling and linking) and those you need during execution of the binary. Execution of the binary will invoke the executable linker/loader provided by the operating system to complete the final link stage if your application is using dynamic linking.

Thanks! Marked as solved.

 

anything