You are not logged in.
Can someone please explain to me why GNU programs (and presumably many others) ship with their own library files (usually in the lib directory)? For example, the source for grep has its own lib folder containing many of the standard library files like regex.c and stat.c. Why is this? Why not just use the shared library already installed on the user's system? Doesn't this miss the entire point of having a shared library?
Offline
Just because they are there doesn't mean they get used.
Offline
The grep package doesn't include any libs on my system.
I don't know where this is being "shipped" from, but if you mean the upstream source, I suspect it is just incase those shared libraries are not yet installed, then they can be. This is a good form of redundancy.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
The grep package doesn't include any libs on my system.
I don't know where this is being "shipped" from, but if you mean the upstream source, I suspect it is just incase those shared libraries are not yet installed, then they can be. This is a good form of redundancy.
I'm referring to the source release, which you can find on any of gnu's mirrors. The library functions would be compiled into the final binaries, so it's not like you'd see any shared object files in the binary package in the repos.
Of course, just becuase the source files are there doesn't mean that they're used. But why are they there in the first place?
Offline
Oh. That's a much easier question, I suspect: static linking.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Oh. That's a much easier question, I suspect: static linking.
Yes, I know that it's called static linking. But my question is not what it's called, but why it's done in the first place instead of dynamically linking to the shared libraries.
Offline
So you wanted to discuss the pro's and cons of static versus dynamic linking, but instead you asked by grep shipped with a c file?
If the former is really what you want, I'd suggest google, or wikipedia, they have very extensive answers to you (new) question.
I'm out of this thread.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Because the automake tools allow you to specify whether you want to use dynamic or static libraries. It is up to the person doing the compilation to define the configuration.
Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way
Offline
Because the automake tools allow you to specify whether you want to use dynamic or static libraries. It is up to the person doing the compilation to define the configuration.
Okay, I think that's the answer I'm looking for. I knew it couldn't be the case that all of these programs use static linking. Is there an easy way to tell make to use one or the other?
Offline
ewaller wrote:Because the automake tools allow you to specify whether you want to use dynamic or static libraries. It is up to the person doing the compilation to define the configuration.
Okay, I think that's the answer I'm looking for. I knew it couldn't be the case that all of these programs use static linking. Is there an easy way to tell make to use one or the other?
Yes.
CLI Paste | How To Ask Questions
Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L
Offline
It is called GNUlib and making things portable...
Offline
It is called GNUlib and making things portable...
How can I tell whether the autotools/makefiles default to static linking to the files in the lib directory or to dynamic linking to the system's shared libraries?
Offline
Allan wrote:It is called GNUlib and making things portable...
How can I tell whether the autotools/makefiles default to static linking to the files in the lib directory or to dynamic linking to the system's shared libraries?
By doing your own research instead of asking on a forum.
Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.
Offline
nbtrap wrote:Allan wrote:It is called GNUlib and making things portable...
How can I tell whether the autotools/makefiles default to static linking to the files in the lib directory or to dynamic linking to the system's shared libraries?
By doing your own research instead of asking on a forum.
From: http://www.gnu.org/software/gnulib/
GNU software has a well-deserved reputation for running on many different types of systems. While our primary goal is to write software for the GNU system, many users and developers have been introduced to us through the systems that they were already using.
Gnulib is a central location for common GNU code, intended to be shared among GNU packages. GCC has libiberty, but this is hard to disentangle from the GCC build tree.
Gnulib takes a different approach. Its components are intended to be shared at the source level, rather than being a library that gets built, installed, and linked against. Thus, there is no distribution tarball; the idea is to copy files from Gnulib into your own source tree.
Gnulib also includes copies of a few files purely for convenience: the GNU coding standards, the GNU maintainer information, the GPL and other licenses (in Texinfo), assorted configuration scripts, and more. The goal is to provide all the common infrastructure needed by GNU packages.
Now then again, since packages are made by maintainers if they choose to use static linking you'd have to recompile the packages (each probably has different flags, but basically in the end you don't want -static you want -shared).
This might be also happening because of this (from the Arch FAQ):
Q) Why is there only a single version of each shared library in the official repositories?
A) Several distros, such as Debian, have different versions of shared libraries packaged as different packages: libfoo1, libfoo2, libfoo3 and so on. In this way it is possible to have apps compiled against different versions of libfoo installed on the same system.
Unlike Debian, Arch is a rolling-release cutting-edge distribution. The most visible trait of a cutting-edge distribution is availability of the latest versions of software in the repositories; in the case of Arch it also means that only the latest versions of all packages are officially supported. By dropping support for outdated software, package maintainers are able to spend more time ensuring the newest versions work as expected. As soon as a new version of a shared library becomes available from upstream, it is added to the repositories and affected packages are rebuilt to utilize the new version.
specially for AUR I guess. In that case you should generally recompile the package against the new lib instead.
There might be more to it but apparently you've to find out on your own. Cause Arch forums are apparently not made for asking questions even thus they're non-trivial and polite.
Offline
There might be more to it but apparently you've to find out on your own. Cause Arch forums are apparently not made for asking questions even thus they're non-trivial and polite.
I'm not sure what you're trying to achieve, given that the OP asked a totally different question to the one you're answering. One which:-
a) should be quite easily solvable
b) based on the way it was posted, wasn't the subject of even an attempted search
Its good to be helpful, but better to realize when helping isn't really helping.
Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.
Offline