How do I keep the /lib folder clean?

Mark S

I have been installing libraries for use with c programs. Is there a way to keep the /lib folder clean? Can I use subdirectories, links, etc to manage this? It's getting pretty cluttered, I'm not sure I'll be able to adequately remove a specific library if I want to remove it later.

Same question goes for /bin.

I am on OSX at home and also CentOS6 at work, where I am working with IT to install some things like GCC. A yum package is not available for the latest GCC.

Warren Young

Is there a way to keep the /lib folder clean?

It is not in the nature of the lib directories on a Unix/Linux type system to be "clean." They are aggregate directories, collectively holding all of the library files that your system needs.

They might contain libraries that you don't need any more. The proper tool for deciding and coping with that is a package manager.

That's clearly yum+rpm on your CentOS 6 box.

On OS X, it's not so clear. There are a bunch of package managers for OS X, some built-in and some third-party:

  • Probably the most commonly used method for managing the pairing between applications and their dependent libraries on OS X are .app packages, which the user drags into /Applications or ~/Applications to install, and drags to the Trash to uninstall.

    In the Finder, OS X app packages look and behave like single files, but they're actually directories full of files, which may contain dependent libraries, among other things. (Right-click one and select "Show Package Contents" to explore this.) Thus, when you "uninstall" the app by dragging it to the Trash, you're not just removing the main executable, but also all of its app-specific libraries and non-code assets.

    This is basically how the Mac App Store works. In that sense, the App Store program is filling the role of yum or apt-get: the .app files it downloads are managed packages, scarcely different from RPMs on your CentOS box.

    I suspect this meets your desired state admirably: the executable, libraries, and other dependencies of the executable are held in their own subdirectory, easily removed when not wanted any more.

  • There's also the old pkg* tools, but those have been slowly going out of style for years. This is what you're using when you open up a .dmg file and get a .pkg or .mpkg file inside which installs when you double-click it.

    These tools scatter files all over your system, and there is no easy first-party way to uninstall them. Consequently, there are many third-party tools and manual techniques for uninstalling OS X pkg packages.

    Consequently, I can't recommend that you use OS X package files if your goal is to precisely manage the set of files that are installed on your system.

  • There are three major third-party package management systems for OS X: Fink, MacPorts, and Homebrew.

    If app packages are not appropriate for your use cases, I'd recommend that you use packages from one of these repositories. Homebrew seems to have the most traction today.

    These package systems behave like package managers on Linux and BSD systems in that you can install, upgrade, and remove packages from a simple command line interface.

I am working with IT to install some things like GCC. A yum package is not available for the latest GCC.

You should not be using CentOS if you need the latest GCC. The whole point of CentOS is that package versions remain stable from a time well before the initial OS release (often 6 months or more!) clear through the end-of-life for that release. That pinned-in-place version then gets backported fixes through the support lifetime of the OS. This is one of the ways such as distribution gets its stability.

There's really only one official way to get a newer version of GCC for a CentOS 6 box: upgrade to CentOS 7.

If you feel you have a good reason to disregard that advice, it is possible to build an alternate version of GCC that installs in parallel with the OS-provided version. Probably the simplest way to do that is to use the --prefix option to the configure script when building your custom GCC. For example:

$ ./configure --prefix=/usr/local/gcc-5.3

When you later say make install, the resulting binaries, libraries and non-code assets will all be placed under that directory prefix, much like the way Mac OS X app packages work.

Having done that, you could then package your custom GCC as an RPM. The docs are freely available, and examples abound online. Or, you might find that someone else has already done this, and you can just use their RPMs.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How do I locate the "lib" folder in nuget error?

From Dev

How can I clean the publish folder so a DLL doesn't keep getting copied to my website?

From Dev

How do I delete a folder but only keep selected files?

From Dev

How can I keep my keyboard clean?

From Dev

What git command do I need to keep a clean commit history?

From Dev

How do I create a Netbeans style Jar with all dependencies in a lib folder?

From Dev

How do I do a clean install of Yeoman?

From Java

How do you keep clean layers separation with Hibernate/ORM?

From Dev

When using CI, how can I keep my environments clean?

From Dev

How do I remove a folder, but keep all subfodlers and files, only in one git branch?

From Dev

How do I keep folder integrity when compressing files in different folders

From Dev

How can I safely clean up root's .cpan folder?

From Dev

How do I clean dust from a computer?

From Dev

Boost 1.59.0 how do I clean the project?

From Dev

How do I check if last shutdown was clean?

From Dev

How do I clean twitter data in R?

From Dev

How do I clean phone numbers in pandas

From Dev

How do I clean or disable the memory cache?

From Dev

How do I clean my dirty bit?

From Dev

How do I clean up my harddrive?

From Dev

How do I write clean Swift models?

From Dev

Why does it keep say "Refactoring cannot be performed" when I copy a jar file into the lib folder in Android Studio?

From Dev

How do I delete a folder

From Dev

How to restore lib folder?

From Dev

How do i use flutter variables from main.dart in other screen.dart files in the same lib folder?

From Dev

should we delete lib folder when we clean project in java and how to build it again after delete lib folder using apache ant and ivy

From Dev

How I get access to it a module in the folder "/lib" in phoenix?

From Dev

How can i include templete from lib folder to the theme?

From Dev

How do i do a clean with git like rcsclean

Related Related

  1. 1

    How do I locate the "lib" folder in nuget error?

  2. 2

    How can I clean the publish folder so a DLL doesn't keep getting copied to my website?

  3. 3

    How do I delete a folder but only keep selected files?

  4. 4

    How can I keep my keyboard clean?

  5. 5

    What git command do I need to keep a clean commit history?

  6. 6

    How do I create a Netbeans style Jar with all dependencies in a lib folder?

  7. 7

    How do I do a clean install of Yeoman?

  8. 8

    How do you keep clean layers separation with Hibernate/ORM?

  9. 9

    When using CI, how can I keep my environments clean?

  10. 10

    How do I remove a folder, but keep all subfodlers and files, only in one git branch?

  11. 11

    How do I keep folder integrity when compressing files in different folders

  12. 12

    How can I safely clean up root's .cpan folder?

  13. 13

    How do I clean dust from a computer?

  14. 14

    Boost 1.59.0 how do I clean the project?

  15. 15

    How do I check if last shutdown was clean?

  16. 16

    How do I clean twitter data in R?

  17. 17

    How do I clean phone numbers in pandas

  18. 18

    How do I clean or disable the memory cache?

  19. 19

    How do I clean my dirty bit?

  20. 20

    How do I clean up my harddrive?

  21. 21

    How do I write clean Swift models?

  22. 22

    Why does it keep say "Refactoring cannot be performed" when I copy a jar file into the lib folder in Android Studio?

  23. 23

    How do I delete a folder

  24. 24

    How to restore lib folder?

  25. 25

    How do i use flutter variables from main.dart in other screen.dart files in the same lib folder?

  26. 26

    should we delete lib folder when we clean project in java and how to build it again after delete lib folder using apache ant and ivy

  27. 27

    How I get access to it a module in the folder "/lib" in phoenix?

  28. 28

    How can i include templete from lib folder to the theme?

  29. 29

    How do i do a clean with git like rcsclean

HotTag

Archive