bug-glibc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Make an executable independent of libraries? (repost w/clarifications)


From: Peter Sherwood
Subject: Make an executable independent of libraries? (repost w/clarifications)
Date: Thu, 24 May 2001 12:19:59 -0400

Environment: Pentium II 450, Red Hat Linux 7.0

[repost with clarification]

Using Red Hat Linux 7 and gcc to compile/link C sources, I created an
executable for my program BPlot. This executable worked fine on my system,
but when I sent a copy of the executable to someone to try on a Red Hat
Linux 6.2 system, when he started the program with

    ./BPlot B.dat

./BPlot: /lib/libc.so.6: version `GLIBC_2.2' not found (required by ./BPlot)

This seems to indicate there is some component of glibc necessary for the
executable to run. How can I create an executable which is independent of
the system (i e, is portable), including all the library components it
needs within the executable itself.

Here's what I mean by "portable": the executable is a file containing
executable code and data. Among the code are many system calls (i e,
invocations of services provided by the Linux O/S, such as file open or
read). Other than these system calls, I do not want to have any other
interactions with the programs installed on the target machine; in
particular, I do not want to use any shared C library functions or utility
programs on the target machine. The reason for this is that I need only be
compatible with the Linux API, via well-defined and rarely-changing system
calls, and thus my executable will run on almost any target with the
correct CPU architecture.

I would expect the linker to have some way to choose whether to create a
"static" (i e, self-contained) executable or one with dynamic links to a
shared runtime library.

I cannot find any discussion of this in either the gcc or glibc manuals.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]