C program to run under all versions
I have created a C program that complies and runs under RH 9.0, but when i take the executable to another box running RH 7.3 it will not run.
I have been told that I can build the executable to contain all of it's needed libraries, that way it can run on any system I need to copy it too. Is this true? If so how? Any help or suggestions?? Thanks. |
gcc -static <rest of arguments>
but why not just provide the source and compile it on the rh9 machine because static binaries are larger and more succeptable to security problems |
Using the gcc -static does work.
When I take the source over to the RH 7.3 system and try to compile I get a few errors, missing libraries. I am trying to run this on a production system and do not want to create other problems by updating glibc. |
why no take the source and just compile it on the other machine no need to upgrade :)
|
Quote:
Why is this so? |
well not directly but for example take something thats linked to zlib, if a security problem is found in zlib then all dynamically linked programs are fixed as soon as you upgrade zlib but all statically linked programs require a recompile which it is quite easy to forget to do.
|
Ah, right.
Quite obvious, should have thought of that myself. Thanks. |
>When I take the source over to the RH 7.3 system and try to compile I get a few errors, missing libraries.
>I am trying to run this on a production system and do not want to create other problems by updating glibc. You need install _additionally_ old libraries from RH7.3 on RH9.0 and change some compilation options. |
i'd recommend compiling with the -ansi -Wall options to help portability, remove all warnings as well as errors. just a suggestion but it may not help your library issue.
|
All times are GMT -5. The time now is 03:39 AM. |