![]() |
|
How to compile for a release from linux for all linux platforms? |
Ori553
Member #15,835
December 2014
|
Hi So I discovered it hasn't been working for the last 2 years, so this means I disappointed the 1/week downloader from linux that tried my program. so I downloaded allegro 4.4, followed the instructions: so I tried it again ./Sconvolt: So I tried to compile it again with: now my question is: I'd like to create a linux executable so that anyone downloading my program can just type ./Sconvolt and have it work without having to install anything, how can I do that? what commands should I use? thanks for any help I might get |
Arthur Kalliokoski
Second in Command
February 2005
![]() |
Elias came up witha good solution to that a while ago. They all watch too much MSNBC... they get ideas. |
Ori553
Member #15,835
December 2014
|
I have no idea about what is "liballegro-monolith.so" or where to find it. But I copied liballeg.so.4.4 in my game's folder, renamed Sconvolt to Sconvolt.bin, created a file startSconvoltLinux and put: so I tried to run ./startSconvoltLinux it works. Sconvolt.bin, cannot execute binary file can a good soul just tell me what to do? I am still a linux beginner |
Arthur Kalliokoski
Second in Command
February 2005
![]() |
Ori553 said: Sconvolt.bin, cannot execute binary file My best guess: Sconvolt.bin is a 64 bit executable, but Knoppix is 32 bit. Show the output of "stat Sconvolt.bin" and "file Sconvolt.bin" if you would. [EDIT] Building the monolithic library is an option in Cmake when you compile allegro. (WANT_MONOLITH) They all watch too much MSNBC... they get ideas. |
Ori553
Member #15,835
December 2014
|
ori@ori-300E4C-300E5C-300E7C:~/Desktop/sconvolt/Sconvolt_Chess$ stat ./Sconvolt.bin ori@ori-300E4C-300E5C-300E7C:~/Desktop/sconvolt/Sconvolt_Chess$ file Sconvolt.bin |
Arthur Kalliokoski
Second in Command
February 2005
![]() |
Ori553 said: Sconvolt.bin: ELF 64-bit LSB executable So if the Knoppix live CD is 32 bit, it can't run Sconvolt.bin. If you compiled everything as 32 bit then it would probably work. IIRC, you can compile 32 bit progs from gcc by using the -m switch, but it'd probably be easier to do it in a virtual machine using a 32 bit distro. Of course, this implies that anybody trying to run it on a 64 bit distro would have the 32 bit compatibility libraries, which is usually the case. Maybe you could provide both versions? They all watch too much MSNBC... they get ideas. |
Ori553
Member #15,835
December 2014
|
I tried to run it both on Knoppix and Knoppix64bit (on a 64 bit machine), it says the same then I tried it on Ubuntu Live CD, and it works.. I have no idea why it works on Ubuntu and not on Knoppix, I can't believe there isn't a striaghtforward way, how do other allegro projects have their releases? so my best bet would be to compile it from a 32 bit virtual machine? |
Arthur Kalliokoski
Second in Command
February 2005
![]() |
If it doesn't run on Knoppix 64 bit, I don't know what the trouble is. They all watch too much MSNBC... they get ideas. |
Ori553
Member #15,835
December 2014
|
I will try to compile it for 32 bits |
bamccaig
Member #7,536
July 2006
![]() |
There are a few things you'll have to check.
For the dependencies check the output of ldd ./liballeg.so.4.4 and ldd ./Sconvolt.bin. Those should list mandatory dynamically loaded libraries that are loaded by the linker at run-time. They typically have paths in them. IIRC, those paths can be either absolute or relative. Make sure whatever paths they are have matches within the system you're trying to run on. If not you may need to copy libraries to a relative path in order to link with them. I'm not 100% sure what the difference is between relative and absolute paths when linking. bambams@test-chamber-1:~/src$ cd ldd-example/ bambams@test-chamber-1:~/src/ldd-example$ ls -la total 20 drwx------ 2 bambams bambams 4096 Dec 24 16:18 . drwx--x--x 65 bambams bambams 4096 Dec 24 16:18 .. -rw------- 1 bambams bambams 76 Dec 24 16:11 main.c -rw------- 1 bambams bambams 190 Dec 24 16:17 Makefile -rw------- 1 bambams bambams 78 Dec 24 16:09 so.c bambams@test-chamber-1:~/src/ldd-example$ make gcc -c -fPIC -Wall -o so.o so.c gcc -o libmy.so -shared -Wl,-soname,libmy.so so.o gcc -c -fPIC -Wall -o main.o main.c gcc -o a.out libmy.so main.o bambams@test-chamber-1:~/src/ldd-example$ ls -la total 44 drwx------ 2 bambams bambams 4096 Dec 24 16:18 . drwx--x--x 65 bambams bambams 4096 Dec 24 16:18 .. -rwx------ 1 bambams bambams 7138 Dec 24 16:18 a.out -rwx------ 1 bambams bambams 6432 Dec 24 16:18 libmy.so -rw------- 1 bambams bambams 76 Dec 24 16:11 main.c -rw------- 1 bambams bambams 1400 Dec 24 16:18 main.o -rw------- 1 bambams bambams 190 Dec 24 16:17 Makefile -rw------- 1 bambams bambams 78 Dec 24 16:09 so.c -rw------- 1 bambams bambams 1520 Dec 24 16:18 so.o bambams@test-chamber-1:~/src/ldd-example$ LD_LIBRARY_PATH=$(pwd) ./a.out Hello bambams@test-chamber-1:~/src/ldd-example$ ldd ./libmy.so ./a.out ./libmy.so: linux-vdso.so.1 => (0x00007fff13f8b000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f358a019000) /lib64/ld-linux-x86-64.so.2 (0x00007f358a5b3000) ./a.out: linux-vdso.so.1 => (0x00007fffb09c5000) libmy.so => not found libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fb12e9b5000) /lib64/ld-linux-x86-64.so.2 (0x00007fb12ed4e000) bambams@test-chamber-1:~/src/ldd-example$ LD_LIBRARY_PATH=$(pwd) ldd ./a.out linux-vdso.so.1 => (0x00007ffff99e9000) libmy.so => /home/bambams/src/ldd-example/libmy.so (0x00007fdcc5333000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fdcc4f9c000) /lib64/ld-linux-x86-64.so.2 (0x00007fdcc5536000) bambams@test-chamber-1:~/src/ldd-example$
It's really rather silly to distribute shared object files like this though. They're intended to be shared, but when they're bundled like this they tend not to be. You're better off just statically linking when possible. That said, I'm not sure how easy or difficult it is to statically link an Allegro program. I suppose it depends on how hard the dependencies are to statically link too. -- acc.js | al4anim - Allegro 4 Animation library | Allegro 5 VS/NuGet Guide | Allegro.cc Mockup | Allegro.cc <code> Tag | Allegro 4 Timer Example (w/ Semaphores) | Allegro 5 "Winpkg" (MSVC readme) | Bambot | Blog | C++ STL Container Flowchart | Castopulence Software | Check Return Values | Derail? | Is This A Discussion? Flow Chart | Filesystem Hierarchy Standard | Clean Code Talks - Global State and Singletons | How To Use Header Files | GNU/Linux (Debian, Fedora, Gentoo) | rot (rot13, rot47, rotN) | Streaming |
Arthur Kalliokoski
Second in Command
February 2005
![]() |
A few months ago, Linux Mint wouldn't run programs compiled under Slackware 14.1 because the glibc version differed. They all watch too much MSNBC... they get ideas. |
|