LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   C program to run under all versions (https://www.linuxquestions.org/questions/programming-9/c-program-to-run-under-all-versions-79552/)

bbee00 08-06-2003 12:20 PM

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.

kev82 08-06-2003 12:37 PM

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

bbee00 08-06-2003 02:13 PM

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.

nakkaya 08-06-2003 04:15 PM

why no take the source and just compile it on the other machine no need to upgrade :)

Hko 08-06-2003 05:33 PM

Quote:

Originally posted by kev82
[...] static binaries are [...] more succeptable to security problems
I didn't know that.
Why is this so?

kev82 08-06-2003 05:59 PM

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.

Hko 08-07-2003 10:27 AM

Ah, right.
Quite obvious, should have thought of that myself.
Thanks.

yuray 08-12-2003 01:06 AM

>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.

Robert0380 08-12-2003 04:21 AM

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.