|
Ubuntu 18.04 Allegro 5 on Codeblocks |
Matias Persson
Member #15,093
May 2013
|
Following this guide https://wiki.allegro.cc/index.php?title=Install_Allegro_from_Ubuntu_PPAs And even trying to build it from source https://wiki.allegro.cc/index.php?title=Install_Allegro5_From_Git/Linux/Debian neither works. I cannot at all compile when linking statically. Please help! |
Edgar Reynaldo
Major Reynaldo
May 2007
|
Yet another victim of static linking on Linux. :/ The short answer is, don't. It's far easier to distribute a set of .so files and set LD_LIBRARY_PATH at runtime to load them. Otherwise, you're in for a heap of hurt. There is no such thing as a fully statically linked executable in Linux due to all the different library versions available that have to be linked dynamically. Or give users a script that installs the dependencies for you before first run. There was a talk about this on IRC and there is another solution I can't remember at the moment. Someone please chime in here. It allowed you to distribute a single file to multiple distros. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
Matias Persson
Member #15,093
May 2013
|
Nevermind the static linking. What if I want to dynamic link the library, seeing as I was just told that Steam requires dynamic linking too. |
Edgar Reynaldo
Major Reynaldo
May 2007
|
It's not the linking causing the seg fault, it's your code, likely the current working directory is wrong when run from inside code blocks. You can set the project cwd with the following; Go to Menu->Project->Build Settings->Executable working directory and change it. Then your program will find your runtime dependencies. You can also fix your program by setting the cwd programmatically. Try a debugger like gdb. It will tell you exactly why it is throwing a seg fault. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
Ariesnl
Member #2,902
November 2002
|
Edgar Reynaldo said: It's far easier to distribute a set of .so files and set LD_LIBRARY_PATH at runtime to load them.
Could you explain this in detail ? I managed to get it richt with static linking once... but just once ( Ant I want to get rid of windows, since Win 10 my HDD thinks it's a jet engine with afterburner ) Perhaps one day we will find that the human factor is more complicated than space and time (Jean luc Picard) |
GullRaDriel
Member #3,861
September 2003
|
Commonly you add your env to the library path just before launching, like: export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/your/custom/path/ In a .sh script, admitting you put all the .so in a lib directory: #!/bin/sh export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./lib/ ./my_super_binary -o my_options_if_any exit $? #return the launched proc exit code
Edit: "Code is like shit - it only smells if it is not yours" |
Ariesnl
Member #2,902
November 2002
|
I read something about setting the rPath for the executable.. Perhaps one day we will find that the human factor is more complicated than space and time (Jean luc Picard) |
GullRaDriel
Member #3,861
September 2003
|
I don't know. I never use it or see it a lot. "Code is like shit - it only smells if it is not yours" |
Edgar Reynaldo
Major Reynaldo
May 2007
|
It's worth mentioning you can get a list of dependencies by using ldd. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
|