Porting binaries compiled on Linux RedHat 5.1 on other systems / Gethostbyaddr()
Posted on 1998-12-24
Hello, this is for you experts, I've been browsing the net for days looking for an answer.
I have this simple program:
I compile it using the command line:
gcc -o port_test port_test.c
The program binary, about 4k of size, runs fine on my Linux Redhat 5.1, but as soon as I try to copy it on another system (tried with Slackware and Debian Linux), I get this error message:
./port_test: No such file or directory
I thought it could be a problem with the shared libraries, and I recompiled the program with this command line:
gcc -static -o port_test.st port_test.c
Now my program, which has reached a size of 435k, runs fine on every system.
Unfortunately, in a program slightly bigger than the example above, when I try to call an important system function, "gethostbyaddr()", it returns an error condition without setting any additional information in the external variable h_error.
However, the function call seems to work fine on my personal system (cannot say actually, since my pc is not connected, but it can resolve "localhost" at least).
I tought it was easier to solve the problem understanding how to run my binary with shared libraries on other systems, and this is what the question is about.
However, if someone has additional information about how to solve the problem with gethostbyaddr() I can provide more explanation about that aspect, and more points as well.
So the question is:
- How can I run my binary compiled on my Linux RedHat 5.1 without the -static switch, that is using shared libraries?