Can a pgm compiled on RH 5.1 run on RH 4.2?

Can a pgm compiled on RH 5.1 run on RH 4.2?

Post by Bobby D. Bryan » Sat, 29 Aug 1998 04:00:00




> I compiled a simple Hello World C program on RedHat 5.1 .
> It runs on 5.1 but not 4.2 .  In fact, 4.2 doesn't know it's
> there.  Typing ./hello in 4.2 yields this error message:

> bash: ./hello: No such file or directory.

> Yes, it has +x permissions for ugo.

> compile command line:  g++ -o hello hello.c

> What's wrong?  What needs to be done so the program
> runs on both systems?

I hope someone better informed than me responds, but can at least tell you
you're not alone, because I see the same thing.  It is surely a result of
compiling for glibc under RH 5.1 and only having libc5 under RH 4.2, but I
have not even been able to work around it  by copying the glibc libraries
to the 4.2 system and defining LD_LIBRARY_PATH.  I suspect the
libc5-compatible linker/loader is * because it sees things it
doesn't understand in the glibc-compatible executable.

There is some downward-compatibility stuff for RH 5.* at
http://www.veryComputer.com/, which may allow you to compile
libc5-compatible images on your system, but I have not had time to try it,
or even read up on it.

Bobby Bryant
Austin, Texas

 
 
 

Can a pgm compiled on RH 5.1 run on RH 4.2?

Post by Henrik Storn » Sat, 29 Aug 1998 04:00:00



>I compiled a simple Hello World C program on RedHat 5.1 .
>It runs on 5.1 but not 4.2 .

By default, when you compile a program it gets linked dynamically
to the standard run-time libraries: The libc (and for C++ programs)
libstdc++ libraries.

Red Hat 5.x uses a new set of these libraries, that are not present
on older systems such as Red Hat 4.2. Thus the program cannot run,
because it fails to locate the needed libraries.

You have a couple of options:

1) Compile the program on the Red Hat 4.2 system. Red Hat 5.x includes
   support for the older libraries, for backwards compatibility, so
   programs compiled with the old libraries will run on the newer RH5
   systems
2) Link the program statically, using the '-static' option with the
   link command. The downside is that the size of the program will
   grow, both re. filesize and memory usage.
3) Tell people to upgrade. No, it isn't the nice thing to do, but
   chances are good that they will eventually have to, as all of the
   application development is moving to the newer library standards.

--
Henrik Storner  |  "testing? What's that? If it compiles, it is good,
                |   if it boots up it is perfect."
                |                                    Linus Torvalds

 
 
 

Can a pgm compiled on RH 5.1 run on RH 4.2?

Post by Matthew Vanece » Sat, 29 Aug 1998 04:00:00



> I compiled a simple Hello World C program on RedHat 5.1 .
> It runs on 5.1 but not 4.2 .  In fact, 4.2 doesn't know it's
> there.  Typing ./hello in 4.2 yields this error message:

> bash: ./hello: No such file or directory.

> Yes, it has +x permissions for ugo.

> compile command line:  g++ -o hello hello.c

> What's wrong?  What needs to be done so the program
> runs on both systems?

> Dale

No. It won't work. Obvious, because it's not working.  To have it work
on both systems, you would need to compile it on the 4.2 system.  This,
of course, is assuming that you followed the default RH 5.1 install
which will install a libc5 for backwards compatibility.

When you compile programs on RH 5.1, they are linked against the glibc
libraries.  Since these are the most basic of libraries and necessary
for compiling and C/C++ programs, and since glibc is not backwards
compatible, you will not be able to run glibc-compiled binaries on a
system which only has libc5.

--
Matthew Vanecek


send me mail.  I appreciate your effort! :-)

Studies in Business Computers at the University of North Texas
http://www.unt.edu/bcis
*****************************************************************
Visit my Website at http://people.unt.edu/~mev0003
*****************************************************************
For 93 million miles, there is nothing between the sun and my shadow
except me. I'm always getting in the way of something...