everest-web/docs/musl-or-glibc.html
2023-10-13 12:59:24 -04:00

111 lines
5.4 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Everest Linux - Docs</title>
<link type="text/css" rel="stylesheet" href="../css/nord.css"/>
</head>
<body>
<!-- Navbar -->
<div class="sidenav">
<img src="../img/everest-nord.svg" alt="everest-logo">
<a href="../index.html">Home</a>
<a href="../about.html">About</a>
<a href="../install.html">Install</a>
<a href="../packages.html">Packages</a>
<a href="../download.html">Downloads</a>
<a href="home.html">Docs</a>
<a href="../errata.html">Errata</a>
<a href="https://git.everestlinux.org">Git ↗</a>
</div>
<!-- Rest of page -->
<div class="main">
<button onclick="window.location.href='home.html';">
Back to home
</button>
<h2>Musl or Glibc?</h2>
<p>Everest supports 2 different C libraries, musl and glibc. This guide should help you decide which to choose.</p>
<h2>1 - musl</h2>
<p><strong>1.1 </strong>Pros</p>
<p>Musl is extremely lightweight and easy to build, compared to Glibc.</p>
<p>As an added bonus, musl is also more secure than Glibc.</p>
<p>Musl recieves the most support from the Everest development team.</p>
<p><strong>1.2 </strong>Cons</p>
<p>Musl may not support all programs, especially proprietary programs, or programs using Glibc-specific APIs.</p>
<p><strong>1.3 </strong>Who should use musl</p>
<p>Users running a server, doing simple web browsing, or using programs which do not depend on Glibc should use musl.</p>
<p><strong>1.4 </strong>Who shouldn't use musl</p>
<p>Users requiring proprietary software that cannot be patched and recompiled against musl, users who require nvidia graphics drivers, or those who use Steam.</p>
<p>While compatibility layers, such as gcompat, can remedy these issues, there is no 100% perfect solution.</p>
<p><strong>1.5 </strong>Solutions</p>
<p>Those wishing to run musl, even with incompatible software and hardware, have a couple of solutions:</p>
<p><i>1.5.1 </i>gcompat</p>
<p>Gcompat is a shared object file that provides programs with Glibc APIs on a musl system. This can be used for running Glibc programs, but CANNOT be used for compiling them.</p>
<p>Install gcompat by running the following:</p>
<code>(root)# gpkg -f gcompat</code>
<p><i>1.5.2 </i>Glibc chroot</p>
<p>A minimal chroot containing Glibc can be set up very quickly.</p>
<p>First, ensure you have the everest-devtools and everest-buildtools packages installed:</p>
<code>(root)# gpkg -f everest-devtools everest-buildtools</code>
<p>Next, create a directory for the chroot:</p>
<code>(user)$ mkdir your-chroot</code>
<p>Create a filesystem skeleton in the new directory:</p>
<code>(user)$ mkskel -d your-chroot</code>
<p>Install the necessary packages to the chroot:</p>
<warnhead><strong>WARNING:</strong></warnhead>
<div class="warning">
<p>The following command costs a fair amount of disk space. Ensure you have enough free space before proceeding.</p>
<p>Check disk space with the following command:</p>
<code>(root)# df /</code>
</div>
<p><p>
<code>(user)$ mkchroot-glibc -d your-chroot</code>
<p>Finally, use everest-chroot to access the chroot:</p>
<code>(root)# everest-chroot your-chroot</code>
<p>Or, you can manually mount the required filesystems and run:</p>
<code>(root)# chroot --userspec=0:0 your-chroot /bin/sh</code>
<h2>2 - Glibc</h2>
<p><strong>2.1 </strong>Pros</p>
<p>Glibc is the de-facto standard C library in Linux, and as a result supports most programs, including proprietary ones.</p>
<p><strong>2.2 </strong>Cons</p>
<p>Glibc is very bloated and heavy on resources for what it does.</p>
<p><strong>2.3 </strong>Who should use Glibc</p>
<p>Users who wish to use proprietary programs, play Steam games, or have hardware that is incompatible with musl should use Glibc.</p>
<p><strong>2.4 </strong>Who shouldn't use Glibc</p>
<p>Users running an embedded, or otherwise resource-constrained system should not use Glibc.</p>
<h2>3 - Migrating</h2>
<p><strong>3.1 </strong>Prerequisites</p>
<p>Changing the C library on an existing Everest system is known as migrating.</p>
<warnhead><strong>WARNING:</strong></warnhead>
<div class="warning">
<p>Migration requires rebuilding most, if not all of the system. It may also present other issues. Continue at your own risk.</p>
</div>
<p><strong>3.2 </strong>Preparations</p>
<p>First, change the system profile, corresponding to the C library you are switching to:</p>
<code>(root)# glacier-mkprofile -u <i>SYSTEM_PROFILE</i></code>
<p>Next, update the local package database:</p>
<code>(root)# glacier-update-pkgdb</code>
<p>Finally, change branches on / and pull in the new files:</p>
<code>(user)$ cd /</code>
<p></p>
<code>(root)# git checkout <i>SYSTEM_PROFILE</i></code>
<p></p>
<code>(root)# git pull</code>
<p></p>
<warnhead><strong>WARNING</strong></warnhead>
<div class="warning">
<p>Pulling in a new root filesystem requires a substantial amount of time. Ensure your system continuously stays connected to the network and doesn't loose power.</p>
<p>Your system may become corrupted if something interrupts this process.</p>
</div>
</div>
<footer>
<p>Page last updated 6/17/23 @ 20:16</p>
<p>Page licensed under GNU Free Documentation License 1.3 or later</p>
<p>--------------------</p>
<p>Copyright (C) 2021-2023 Everest Linux</p>
<p>Linux (R) is a registered trademark of Linus Torvalds.</p>
<p>Everest Linux is provided AS IS, WITHOUT WARRANTY.</p>
</footer>