Is it possible to compile on one Linux and run on another Linux?

  • Follow


Subject: Is it possible to compile on one Linux and run on another
Linux?

Usually, different Linux version will have a lot of libraries version
changed (Of course, I just mean the situation that both environments
have related libraries, but version changed.). So is it possible to
compile on one Linux and run on another Linux?
If it's impossible or very hard, then how could so many products which
only provide one binary for installation and can be installed on
several systems like Redhat4 and Redhat5?
How they achieved this? Or what shall we do to ensure that? I have
tried, it seems normal dynamic/static link is not the right solution.
0
Reply billdavidcn (24) 9/19/2008 12:18:39 PM

On 2008-09-19, Bill David <billdavidcn@gmail.com> wrote:
> Subject: Is it possible to compile on one Linux and run on another
> Linux?

As long as they have the same architecture and reasonably closer
libraries versions.

Davide

-- 
PC's are designed by a committee of people who are in different companies
in different countries and who never talk to each other.
And nobody speaks the same language and they hate each other...
-- Derick Siddoway & Chris Adams
0
Reply davideyeahsure (1281) 9/19/2008 12:19:33 PM


On 2008-09-19, Davide Bianchi <davideyeahsure@onlyforfun.net> wrote:
> On 2008-09-19, Bill David <billdavidcn@gmail.com> wrote:
>> Subject: Is it possible to compile on one Linux and run on another
>> Linux?
>
> As long as they have the same architecture and reasonably closer
> libraries versions.

They don't have to be the same architecture or have the same
library versions if you've installed a cross-compiler and the
proper target libraries.

-- 
Grant Edwards                   grante             Yow! I like your SNOOPY
                                  at               POSTER!!
                               visi.com            
0
Reply grante (5411) 9/19/2008 2:07:56 PM

On Fri, 19 Sep 2008 05:18:39 -0700, Bill David wrote:

> Subject: Is it possible to compile on one Linux and run on another
> Linux?
> 
> Usually, different Linux version will have a lot of libraries version
> changed (Of course, I just mean the situation that both environments
> have related libraries, but version changed.). So is it possible to
> compile on one Linux and run on another Linux? If it's impossible or
> very hard, then how could so many products which only provide one binary
> for installation and can be installed on several systems like Redhat4
> and Redhat5? How they achieved this? Or what shall we do to ensure that?
> I have tried, it seems normal dynamic/static link is not the right
> solution.

Compile what? If you're talking about a simple program - yes. If you're 
talking about the kernel - more problematic.
0
Reply ray65 (5398) 9/19/2008 3:03:41 PM

It is possible, we do it at work, but it is not always easy. You may
have to carry some libraries with you.

i

On 2008-09-19, ray <ray@zianet.com> wrote:
> On Fri, 19 Sep 2008 05:18:39 -0700, Bill David wrote:
>
>> Subject: Is it possible to compile on one Linux and run on another
>> Linux?
>> 
>> Usually, different Linux version will have a lot of libraries version
>> changed (Of course, I just mean the situation that both environments
>> have related libraries, but version changed.). So is it possible to
>> compile on one Linux and run on another Linux? If it's impossible or
>> very hard, then how could so many products which only provide one binary
>> for installation and can be installed on several systems like Redhat4
>> and Redhat5? How they achieved this? Or what shall we do to ensure that?
>> I have tried, it seems normal dynamic/static link is not the right
>> solution.
>
> Compile what? If you're talking about a simple program - yes. If you're 
> talking about the kernel - more problematic.

-- 
   Due to extreme spam originating from Google Groups, and their inattention 
      to spammers, I and many others block all articles originating 
       from Google Groups. If you want your postings to be seen by 
         more readers you will need to find a different means of 
                       posting on Usenet.
                   http://improve-usenet.org/
0
Reply Ignoramus18195 9/19/2008 3:08:10 PM

Bill David <billdavidcn@gmail.com> wrote:
> Subject: Is it possible to compile on one Linux and run on another
> Linux?
> 
> Usually, different Linux version will have a lot of libraries version
> changed (Of course, I just mean the situation that both environments
> have related libraries, but version changed.). So is it possible to
> compile on one Linux and run on another Linux?

Compile with the -static switch, which prevents linking
with shared libraries, and the resulting executable
image is usually portable to other linux boxes, e.g.,
   gcc -static program.c -lm -o program
builds program with any needed library routines statically
linked into the image.
-- 
John Forkosh  ( mailto:  j@f.com  where j=john and f=forkosh )
0
Reply john42 (309) 9/20/2008 1:07:08 AM

On Sep 20, 9:07=A0am, JohnF <j...@please.see.sig.for.email.com> wrote:
> Bill David <billdavi...@gmail.com> wrote:
> > Subject: Is it possible to compile on one Linux and run on another
> > Linux?
>
> > Usually, different Linux version will have a lot of libraries version
> > changed (Of course, I just mean the situation that both environments
> > have related libraries, but version changed.). So is it possible to
> > compile on one Linux and run on another Linux?
>
> Compile with the -static switch, which prevents linking
> with shared libraries, and the resulting executable
> image is usually portable to other linux boxes, e.g.,
> =A0 =A0gcc -static program.c -lm -o program
> builds program with any needed library routines statically
> linked into the image.
> --
> John Forkosh =A0( mailto: =A0j...@f.com =A0where j=3Djohn and f=3Dforkosh=
 )

I am sure I have try my best to link to libraries statically. But it
seems libraries I have static-linked have dynamically linked to other
dynamic libraries. Now, my program will complain that some libraries
with minor version number like 'libldap-2.2.so.7' can't be found
(because the existing ldap library has version number as 2.3.0).
I am afraid I have no choice but to deliver some libraries with my
program. Terrible thing.
0
Reply billdavidcn (24) 9/22/2008 5:09:28 AM

6 Replies
25 Views

(page loaded in 2.751 seconds)

Similiar Articles:













7/29/2012 11:20:34 PM


Reply: