Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
| elearning:workbooks:redhat:rh124:l106 [2024/09/30 12:08] – admin | elearning:workbooks:redhat:rh124:l106 [2024/10/24 10:48] (Version actuelle) – admin | ||
|---|---|---|---|
| Ligne 25: | Ligne 25: | ||
| * 2.9 - L' | * 2.9 - L' | ||
| * 2.10 - Le Dépôt Application Stream | * 2.10 - Le Dépôt Application Stream | ||
| + | * LAB #3 - Les Bibliothèques Partagées | ||
| + | * 3.1 - Présentation | ||
| + | * Introduction | ||
| + | * Stockage | ||
| + | * ld-linux.so.2 | ||
| + | * 3.2 - La Commande ldd | ||
| + | * 3.3 - Le fichier / | ||
| + | * 3.4 - La Commande ldconfig | ||
| =====LAB #1 - La commande rpm===== | =====LAB #1 - La commande rpm===== | ||
| Ligne 2388: | Ligne 2396: | ||
| Last metadata expiration check: 0:59:14 ago on Mon 30 Sep 2024 12:48:56 PM CEST. | Last metadata expiration check: 0:59:14 ago on Mon 30 Sep 2024 12:48:56 PM CEST. | ||
| </ | </ | ||
| + | |||
| + | =====LAB #3 - Les Bibliothèques Partagées===== | ||
| + | |||
| + | ====3.1 - Présentation==== | ||
| + | |||
| + | ===Introduction=== | ||
| + | |||
| + | Les bibliothèques partagées sont des fonctions communes à plusieurs programmes différents d'un même **domaine** (son, base de données, vidéo etc.). Les fonctions proposées par une ou plusieurs bibliothèques forment un **API** (// | ||
| + | |||
| + | ===Stockage=== | ||
| + | |||
| + | Les bibliothèques partagées sont stockées par convention dans des répertoires **lib**, par exemple : | ||
| + | |||
| + | ^ Répertoire ^ Contenu | ||
| + | | /lib | Bibliothèques du système de base | | ||
| + | | /usr/lib | Bibliothèques utilisateurs | | ||
| + | | / | ||
| + | | / | ||
| + | | / | ||
| + | |||
| + | <WRAP center round important> | ||
| + | **Important** : La bibliothèque la plus importante est **libc**. Sans elle, le système Linux ne peut pas fonctionner. | ||
| + | </ | ||
| + | |||
| + | ===ld-linux.so.2=== | ||
| + | |||
| + | La bibliothèque **ld-linux.so.2** est utilisée par le système pour créer un lien avec une bibliothèque partagée au moment de l' | ||
| + | |||
| + | * dans les chemins précisés par la variable système **LD_LIBRARY_PATH**, | ||
| + | * dans les chemins précisés dans le contenu compilé du fichier **/ | ||
| + | * dans **/lib** et **/ | ||
| + | |||
| + | Il est à noter que le contenu du cache **ld.so.cache** est construit à partir des informations contenus dans le fichier de configuration **/ | ||
| + | |||
| + | Afin d' | ||
| + | |||
| + | < | ||
| + | [root@redhat9 ~]# dnf install mc -y | ||
| + | </ | ||
| + | |||
| + | ====3.2 - La Commande ldd==== | ||
| + | |||
| + | Pour déterminer quelles sont les bibliothèques liées à une application, | ||
| + | |||
| + | < | ||
| + | [root@redhat9 ~]# ldd /usr/bin/mc | ||
| + | linux-vdso.so.1 (0x00007ffe40b83000) | ||
| + | libslang.so.2 => / | ||
| + | libgpm.so.2 => / | ||
| + | libe2p.so.2 => / | ||
| + | libglib-2.0.so.0 => / | ||
| + | libc.so.6 => / | ||
| + | libm.so.6 => / | ||
| + | libpcre.so.1 => / | ||
| + | / | ||
| + | </ | ||
| + | |||
| + | Afin de comprendre ce qui se passe dans le cas où une bibliothèque est manquante, renommez la bibliothèque **/ | ||
| + | |||
| + | < | ||
| + | [root@redhat9 ~]# mv / | ||
| + | </ | ||
| + | |||
| + | Exécutez de nouveau la commande ldd. Vous obtiendrez un résultat similaire à celui-ci : | ||
| + | |||
| + | < | ||
| + | [root@redhat9 ~]# ldd /usr/bin/mc | ||
| + | linux-vdso.so.1 (0x00007ffe893a6000) | ||
| + | libslang.so.2 => not found | ||
| + | libgpm.so.2 => / | ||
| + | libe2p.so.2 => / | ||
| + | libglib-2.0.so.0 => / | ||
| + | libc.so.6 => / | ||
| + | libpcre.so.1 => / | ||
| + | / | ||
| + | </ | ||
| + | |||
| + | Notez la présence de la ligne **libslang.so.2 => not found**. Compte tenu de la bibliothèque partagée manquante, le programme **mc** ne peut plus être lancé : | ||
| + | |||
| + | < | ||
| + | [root@redhat9 ~]# mc | ||
| + | / | ||
| + | </ | ||
| + | |||
| + | Renommez la bibliothèque correctement et vérifiez la résolution de l' | ||
| + | |||
| + | < | ||
| + | [root@redhat9 ~]# mv / | ||
| + | |||
| + | [root@redhat9 ~]# ldd /usr/bin/mc | ||
| + | linux-vdso.so.1 (0x00007ffff85f9000) | ||
| + | libslang.so.2 => / | ||
| + | libgpm.so.2 => / | ||
| + | libe2p.so.2 => / | ||
| + | libglib-2.0.so.0 => / | ||
| + | libc.so.6 => / | ||
| + | libm.so.6 => / | ||
| + | libpcre.so.1 => / | ||
| + | / | ||
| + | </ | ||
| + | |||
| + | ====3.3 - Le fichier / | ||
| + | |||
| + | Le fichier **/ | ||
| + | |||
| + | < | ||
| + | [root@redhat9 ~]# cat / | ||
| + | include ld.so.conf.d/ | ||
| + | </ | ||
| + | |||
| + | Dans ce cas, le fichier ne contient qu'une directive **include** qui renvoie vers le contenu du répertoire **/ | ||
| + | |||
| + | < | ||
| + | [root@redhat9 ~]# ls -l / | ||
| + | total 4 | ||
| + | -rw-r--r--. 1 root root 30 Jan 19 2024 pipewire-jack-x86_64.conf | ||
| + | </ | ||
| + | |||
| + | Par exemple, le contenu du fichier **pipewire-jack-x86_64.conf** est : | ||
| + | |||
| + | < | ||
| + | [root@redhat9 ~]# cat / | ||
| + | / | ||
| + | </ | ||
| + | |||
| + | ====3.4 - La Commande ldconfig==== | ||
| + | |||
| + | La commande **ldconfig** est utilisée pour : | ||
| + | |||
| + | * mettre à jour le cache pour les chemins inclus dans le fichier **/ | ||
| + | * mettre à jour les liens symboliques sur les bibliothèques. L' | ||
| + | |||
| + | Les liens symboliques sont utilisés pour gérer les versions de bibliothèques. | ||
| + | |||
| + | La commande ldconfig peut être utilisée avec l' | ||
| + | |||
| + | < | ||
| + | [root@redhat9 ~]# ldconfig -p | more | ||
| + | 827 libs found in cache `/ | ||
| + | libzstd.so.1 (libc6, | ||
| + | libz.so.1 (libc6, | ||
| + | libyelp.so.0 (libc6, | ||
| + | libyaml-0.so.2 (libc6, | ||
| + | libyajl.so.2 (libc6, | ||
| + | libxtables.so.12 (libc6, | ||
| + | libxslt.so.1 (libc6, | ||
| + | libxshmfence.so.1 (libc6, | ||
| + | libxml2.so.2 (libc6, | ||
| + | libxmlsec1.so.1 (libc6, | ||
| + | libxmlsec1-openssl.so.1 (libc6, | ||
| + | libxmlsec1-openssl.so (libc6, | ||
| + | libxmlb.so.2 (libc6, | ||
| + | libxklavier.so.16 (libc6, | ||
| + | libxkbregistry.so.0 (libc6, | ||
| + | libxkbfile.so.1 (libc6, | ||
| + | libxkbcommon.so.0 (libc6, | ||
| + | libxkbcommon-x11.so.0 (libc6, | ||
| + | libxcvt.so.0 (libc6, | ||
| + | libxcb.so.1 (libc6, | ||
| + | libxcb-xvmc.so.0 (libc6, | ||
| + | libxcb-xv.so.0 (libc6, | ||
| + | libxcb-xtest.so.0 (libc6, | ||
| + | libxcb-xselinux.so.0 (libc6, | ||
| + | libxcb-xkb.so.1 (libc6, | ||
| + | libxcb-xinput.so.0 (libc6, | ||
| + | libxcb-xinerama.so.0 (libc6, | ||
| + | libxcb-xf86dri.so.0 (libc6, | ||
| + | libxcb-xfixes.so.0 (libc6, | ||
| + | libxcb-util.so.1 (libc6, | ||
| + | libxcb-sync.so.1 (libc6, | ||
| + | libxcb-shm.so.0 (libc6, | ||
| + | libxcb-shape.so.0 (libc6, | ||
| + | libxcb-screensaver.so.0 (libc6, | ||
| + | libxcb-res.so.0 (libc6, | ||
| + | libxcb-render.so.0 (libc6, | ||
| + | libxcb-record.so.0 (libc6, | ||
| + | libxcb-randr.so.0 (libc6, | ||
| + | libxcb-present.so.0 (libc6, | ||
| + | libxcb-glx.so.0 (libc6, | ||
| + | libxcb-dri3.so.0 (libc6, | ||
| + | libxcb-dri2.so.0 (libc6, | ||
| + | libxcb-dpms.so.0 (libc6, | ||
| + | libxcb-damage.so.0 (libc6, | ||
| + | libxcb-composite.so.0 (libc6, | ||
| + | libxatracker.so.2 (libc6, | ||
| + | libwpe-1.0.so.1 (libc6, | ||
| + | libwoff2enc.so.1.0.2 (libc6, | ||
| + | libwoff2dec.so.1.0.2 (libc6, | ||
| + | libwoff2common.so.1.0.2 (libc6, | ||
| + | libwnck-3.so.0 (libc6, | ||
| + | libwireplumber-0.4.so.0 (libc6, | ||
| + | libwebrtc_audio_processing.so.1 (libc6, | ||
| + | libwebpmux.so.3 (libc6, | ||
| + | --More-- | ||
| + | </ | ||
| + | |||
| + | Pour ajouter des bibliothèques partagées, il convient de : | ||
| + | |||
| + | * créer un fichier dans le répertoire **/ | ||
| + | * exécuter la commande **ldconfig -v**, où v implique verbose, afin de reconstruire le cache. | ||
| ----- | ----- | ||
| Copyright © 2024 Hugh Norris. | Copyright © 2024 Hugh Norris. | ||