LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 08-06-2003, 01:20 PM   #1
bbee00
LQ Newbie
 
Registered: Aug 2003
Location: Toledo, OH
Distribution: RH 7.2, 7.3, 8.0, 9.0
Posts: 2

Rep: Reputation: 0
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.
 
Old 08-06-2003, 01:37 PM   #2
kev82
Senior Member
 
Registered: Apr 2003
Location: Lancaster, England
Distribution: Debian Etch, OS X 10.4
Posts: 1,263

Rep: Reputation: 50
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
 
Old 08-06-2003, 03:13 PM   #3
bbee00
LQ Newbie
 
Registered: Aug 2003
Location: Toledo, OH
Distribution: RH 7.2, 7.3, 8.0, 9.0
Posts: 2

Original Poster
Rep: Reputation: 0
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.
 
Old 08-06-2003, 05:15 PM   #4
nakkaya
Guru
 
Registered: Jan 2003
Location: Turkey&USA
Distribution: Emacs and linux is its device driver(Slackware,redhat)
Posts: 1,398

Rep: Reputation: 45
why no take the source and just compile it on the other machine no need to upgrade
 
Old 08-06-2003, 06:33 PM   #5
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: ubuntu
Posts: 2,530

Rep: Reputation: 108Reputation: 108
Quote:
Originally posted by kev82
[...] static binaries are [...] more succeptable to security problems
I didn't know that.
Why is this so?
 
Old 08-06-2003, 06:59 PM   #6
kev82
Senior Member
 
Registered: Apr 2003
Location: Lancaster, England
Distribution: Debian Etch, OS X 10.4
Posts: 1,263

Rep: Reputation: 50
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.
 
Old 08-07-2003, 11:27 AM   #7
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: ubuntu
Posts: 2,530

Rep: Reputation: 108Reputation: 108
Ah, right.
Quite obvious, should have thought of that myself.
Thanks.
 
Old 08-12-2003, 02:06 AM   #8
yuray
Member
 
Registered: Apr 2003
Location: Russia, Khotkovo
Distribution: Debian
Posts: 146

Rep: Reputation: 15
>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.
 
Old 08-12-2003, 05:21 AM   #9
Robert0380
Guru
 
Registered: Apr 2002
Location: Atlanta
Distribution: Gentoo
Posts: 1,280

Rep: Reputation: 47
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
do all versions oflinux run on oracle 10g release 1 vasudha LinuxQuestions.org Member Intro 1 10-18-2005 03:23 PM
Can two versions of Java JRE run at the same time? White Spiral Suse/Novell 4 04-24-2005 02:24 PM
Program to run mfo6463 Linux - Newbie 2 04-21-2004 08:28 PM
Swaret's "latest" program versions timsch75 Slackware 7 03-20-2004 05:23 PM
Viewing program messages when program isn't run from command line? Locura Linux - Software 1 09-27-2003 09:19 AM


All times are GMT -5. The time now is 10:57 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration