I've downloaded the command-line program "Whitaker's Words" which was available for Linux as well as Windows etc.
There is a main program named words
. I tried to execute it on my Ubuntu (11.10) machine on command line and it worked:
./words
When I tested it on my Linux webserver (Linux 2.6.37-he-xeon-64gb+1 i686), it worked as well.
Then I decided to apply some changes to the source code and to recompile it. For that, I used the following commands (the latter four are supporting programs):
gnatmake -O3 words -bargs -static
gnatmake makedict -bargs -static
gnatmake makestem -bargs -static
gnatmake makeefil -bargs -static
gnatmake makeinfl -bargs -static
The resulting program worked properly on my Ubuntu machine again, as I could see the correct output in the terminal.
But when I tried to execute it on my webserver using PHP's shell_exec()
or passthru()
, there was simply no output! According to ldd
, the program is statically linked
so it should really work, shouldn't it?
I've been testing and debugging for weeks now and I can't find any reason why this is so. Can you help me?
You can get the program here: download link at filedropper.com
(I guess this is no programming question, as my problem is just: How to get that program running on my webserver?)
System I want to compile the program on:
Linux ubuntu 3.0.0-12-generic #20-Ubuntu x86 GNU/Linux
This is the newest Wubi (32-bit) release of Ubuntu.
ldd --version
outputs ldd (Ubuntu EGLIBC 2.13-20ubuntu5) 2.13
System I want to run the compiled program on (webserver):
Linux 2.6.37-he-xeon-64gb+1 i686 GNU/Linux
ldd --version
outputs ldd (GNU libc) 2.7
Note:
Errors on the server side can be excluded as everything works fine if I just replace my own Linux program by the pre-compiled one.
Update #1:
I've tried running the program (that works fine under Ubuntu 11.10) in my VirtualBox under Ubuntu 5.10 - and it didn't work, either. Good news, so it's definitely not the server's fault. Ubuntu 5.10 just said: floating point exception
. Does this help? Why is there an exception but not under Ubuntu 11.10?
Update #2:
Now compiled with Ubuntu 5.1 using GNAT 3.4. But all hope for nothing - still no output, ldd
says statically linked
(as I've compiled it that way) and strace
gives the same error message. What does it mean? Is there any file missing? Is this the reason why it is not working?
execve("./words", ["./words"], [/* 15 vars */]) = 0
brk(0) = 0x811e000
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
mmap2(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb76f8000
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb76f7000
set_thread_area({entry_number:-1 -> 6, base_addr:0xb76f7680, limit:1048575, seg_32bit:1, contents:0, read_exec_only:0, limit_in_pages:1, seg_not_present:0, useable:1}) = 0
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
+++ killed by SIGSEGV +++