Static Libraries
Hey,
I'm using the Irrlicht Engine (http://irrlicht.sourceforge.net/) and am after building it into my application statically. All I've really done is add the following to the makefile: Code:
-static-libgcc -static-libstdc++ -static Quote:
However, am I going to run into problems or suchlike, and if so what can I do to sort them? e.g. Irrlicht could probably be built without support for various drivers and suchlike...? Thankyou |
I think I maybe ok with those libraries (not checked the gl version yet as VirtualBox has issues with mesa on my machine)
So, I'm only using: Code:
-static-libgcc -static-libstdc++ |
Since you removed -static from your build command, you're no longer building a static executable. Run "ldd" on your executable to check.
It sounds like you're missing the static versions of those libraries (*.a versus *.so). |
I'm on a Fedora 21 system, after compilation I transferred the compiled program to an instance of Kali (Debian) on VirtualBox and it ran fine. The Irrlicht library was already a static library.
From looking, I'll have to sort a lot of X11 to compile the needed static libraries and as Fedora say, it makes it vulnerable if bugs are found. I'm no expert in this area though, far from it... Running ldd showed a lot of shared libraries, mainly associated with X11 and one for GL. Running nm showed a whole mass of lowercase types, so I'm guessing the Irrlicht library is in ok...? Not sure how else to analyse further... So, how do other game developers compile statically, is it ok to build the above statically, won't it run into issues? If so I'll be happy to do a special source build, seems a big challenge which'd take me a day probably but if its worth it...? cheers |
Even with dynamic libraries it will run on other systems, provided their library versions are compatible with the one you used to build the executable.
A static executable will be more portable since it brings the libraries with it, but yes, if one of those libraries is found to have a bug, you'd need to rebuild and redistribute your executable with the patched library, rather than simply relying on the end user to patch their own library. This goes the other direction too though, if a bug is introduced into a library, your static executable would be immune to it, while a dynamic executable would start failing until the problematic library is patched. If I need to distribute a program to multiple systems, I always either build it statically or distribute the source and build it locally on each system. Trying to distribute a pre-compiled dynamic executable can be very problematic, especially if you need to use it on a wide range of distros. |
----
I'm on a Fedora 21 system, ---- BE Aware!!! fedora 21 is at it's END OF LIFE!!! there is and never will be any more support for it no SECURITY updates on nothing R.I.P. fedora 21 - you will be missed upgrade to Fedora 23 ASAP |
Quote:
|
Sounds like you should switch distros to one that's a better match for your requirements. Fedora isn't for everyone.
|
Been using since Redhat 7, its more Gnome, GIMP, Files, etc, all config has changed, etc. Too much else to do than learn a new system every few months.
I know there are projects which use the old interfaces and config formats, but I haven't had the time recently to look into them, never mind test them out. |
Quote:
You would be much more at-home with RHEL/CentOS or Debian Stable from the sound of it. |
lol, just dl'd ubuntu 14 LTS and installed default on VirtualBox, bleh, even worse, it feels like a kids toy...
CentOS, last time I used it didn't even have built-in support for mounting flash drives and such, way behind, either way it'll become Fedora sooner or later anyway. Anyway, off-topic so I'll do another thread if required Cheers |
to link against static libraries first make sure that they exists (the .la files instead of .so)
fedora is known to hate static linking, so do make sure you can't statically link against libGL, though as that library is provided by the specific opengl driver the X11 things should be fine then again X has a stable ABI (as far as your case goes) so there is no need to statically link it the "security!" yells you can just ignore you are building a game, not a TLS capable web server |
All times are GMT -5. The time now is 06:16 AM. |