Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
Prochaine révision
Révision précédente
en:documentation:tutorials:build:links [2020/07/16 09:17] flerouxen:documentation:tutorials:build:links [2023/12/12 12:59] (Version actuelle) – supprimée ltaulell
Ligne 1: Ligne 1:
-FIXME **Cette page n'est pas encore traduite entièrement. Merci de terminer la traduction**\\ //(supprimez ce paragraphe une fois la traduction terminée)// 
- 
-====== Publishing links from a bookstore ====== 
- 
-Example with the library **HDF5** in version **1.8.9** 
- 
-===== Static or Dynamic Linkage ===== 
- 
-In the subdirectory ''lib'' of the installation directory ''/softs/Hdf5/1.8.9/gnu/4.6.3'', the library is available statically and dynamically. : 
- 
-<code> 
-ls /softs/Hdf5/1.8.9/gnu/4.6.3/lib 
-libhdf5.a 
-libhdf5.so 
-... 
-</code> 
- 
-Whether static or dynamic, to use this library, when editing links (compilation step), you have to add : 
-<code> 
- -L/softs/Hdf5/1.8.9/gnu/4.6.3/lib -lhdf5  
-</code> 
- 
-===== Using the dynamic version ===== 
- 
-By default, it is the dynamic version that is first searched for when editing links. In this case, at program execution (e.g. on nodes), the variable ''LD_LIBRARY_PATH'' should contain the path of the dynamic library. To do this, add this line in the execution script : 
- 
-  * For csh (and tcsh) : 
- 
-<code bash> 
-setenv LD_LIBRARY_PATH "/softs/Hdf5/1.8.9/gnu/4.6.3/lib:$LD_LIBRARY_PATH" 
-</code> 
- 
-  * For sh (and bash) : 
- 
-<code bash> 
-export LD_LIBRARY_PATH="/softs/Hdf5/1.8.9/gnu/4.6.3/lib:$LD_LIBRARY_PATH" 
-</code> 
- 
-===== Using the static version ===== 
- 
-To link with the static version, use the ''-static'' option. Example : 
- 
-<code> 
-gcc ... -static ... -L/softs/Hdf5/1.8.9/gnu/4.6.3/lib -lhdf5 ... 
-</code> 
- 
-===== Remarks ===== 
- 
-==== -static ==== 
-Using the ''-static'' option implies to link all libraries statically. For only the desired library (here libhdf5) to be linked statically, use the full name of the library : 
- 
-<code> 
-gcc ... -static ... -L/softs/Hdf5/1.8.9/gnu/4.6.3/lib/libhdf5.a ... 
-</code> 
- 
-==== Availability ==== 
- 
-The above discussion arises only if both versions (static and dynamic) are installed (as for HDF5). If for another library only one of the versions (static or dynamic) is installed, just add ''-L/répertoire_de_recherche -lnom_librairie'' to link with ''libnom_librairie.a'' (or ''libnom_librairie.so''). 
- 
  
en/documentation/tutorials/build/links.1594891033.txt.gz · Dernière modification : 2020/08/25 15:58 (modification externe)