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

Author Topic: [Solved][Linux] linking statically some, dinamically others  (Read 2653 times)

0 Members and 1 Guest are viewing this topic.

santiaboy

  • Full Member
  • ***
  • Posts: 118
    • View Profile
[Solved][Linux] linking statically some, dinamically others
« on: November 21, 2013, 09:20:34 pm »
Hey guys!

I made a game using SFML and I wanted to link statically some libraries so the user doesn't have to download anything but the game. This is for the Desura branch, so I can link some libraries dinamically and the Desura App will handle the rest.

I can link these dinamically: sfml, libfreetype6, libjpeg8, libglew1.5, libopenal. And opengl and xlib should be installed by default. So, that leaves me with pthread, xrandr and sndfile to link statically.

I was wondering it's better to link statically some, dinamically others? Everything statically? I think that linking everything statically has the advantage that I know there won't be any library issues. I am unsure on how to proceed, and I was wondering how do you commonly approach this, or better yet, if you uploaded anything to Desura how did you do it?
« Last Edit: November 22, 2013, 01:19:01 am by santiaboy »

FRex

  • Hero Member
  • *****
  • Posts: 1848
  • Back to C++ gamedev with SFML in May 2023
    • View Profile
    • Email
Re: [Linux] linking statically some, dinamically others
« Reply #1 on: November 21, 2013, 09:37:26 pm »
A thing I seen R.U.B.E.(Qt based Box2D editor) and Don't Starve and Shadow Warrior Classis(games on Steam) do is ship all libs as .so, and then provide .sh script that sets LD_LIBRARY_PATH to right relative path(./bin/ or similar) and then runs the actual game so that it finds it's libs correctly(./game_exec or ./bin/game or similar). It's probably the easiest, nicest, and least troubling one.
Back to C++ gamedev with SFML in May 2023

santiaboy

  • Full Member
  • ***
  • Posts: 118
    • View Profile
Re: [Linux] linking statically some, dinamically others
« Reply #2 on: November 21, 2013, 09:45:26 pm »
Ah yes, with the "export LD_LIBRARY_PATH=./lib && ./myGame". Are you saying that's better to provide the .so instead of telling the Desura app what dependencies to install?

Also, do you know if there's some trouble with including .so as regards to licensing?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11016
    • View Profile
    • development blog
    • Email
AW: [Linux] linking statically some, dinamically others
« Reply #3 on: November 22, 2013, 12:41:59 am »
Kind of hard to really answer since probably no one really knows what the requirements are for Desura, plus what Desura can offer/guarantee.
Can you provide more info?

From a Linux perspective both static linking and shipping shared libraries is a bad idea, since it works against the philosophy of packet managers etc.

Mixing static and shared libs is mostly a bad idea though.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

santiaboy

  • Full Member
  • ***
  • Posts: 118
    • View Profile
Re: [Linux] linking statically some, dinamically others
« Reply #4 on: November 22, 2013, 01:18:46 am »
Thing is, in Desura you have a few dependencies to choose from, that will install alongside the game (think it like installing the c++ redistributable you need for playing a game). This is, so the player can install a game, and play it right away, without doing any 'sudo apt-get install X'.

However, upong further investigation, when you install Ubuntu 12.04 LTS, you install a lot of dependencies that SFML uses. You just need SFML (duh), openal and glew. You can choose those on Desura, so I don't need to link anything statically.

Marked as Solved