Bureaucrats, cc_docs_admin, cc_staff
2,879
edits
No edit summary |
mNo edit summary |
||
Line 43: | Line 43: | ||
Loading a library [[Using modules | module]] will set environment variables <tt>CPATH</tt> and <tt>LIBRARY_PATH</tt> pointing to the location of the library itself and its header files. These environment variables are supported by most compilers (for example [https://software.intel.com/en-us/node/522775 Intel] and [https://gcc.gnu.org/onlinedocs/gcc/Environment-Variables.html GCC]), which will automatically try the directories listed in those environment variables during compilation and linking phases. This feature allows you you to easily link against the library without specifying its location explicitly by passing the <tt>-I</tt> and <tt>-L</tt> options to the compiler. If your make- or config- file calls for an explicit location of the library to pass to the compiler via <tt>-I</tt> and <tt>-L</tt>, you can usually omit the location of the library and leave these lines blank in the make- or config- file. | Loading a library [[Using modules | module]] will set environment variables <tt>CPATH</tt> and <tt>LIBRARY_PATH</tt> pointing to the location of the library itself and its header files. These environment variables are supported by most compilers (for example [https://software.intel.com/en-us/node/522775 Intel] and [https://gcc.gnu.org/onlinedocs/gcc/Environment-Variables.html GCC]), which will automatically try the directories listed in those environment variables during compilation and linking phases. This feature allows you you to easily link against the library without specifying its location explicitly by passing the <tt>-I</tt> and <tt>-L</tt> options to the compiler. If your make- or config- file calls for an explicit location of the library to pass to the compiler via <tt>-I</tt> and <tt>-L</tt>, you can usually omit the location of the library and leave these lines blank in the make- or config- file. | ||
In some cases, however, particularly with <tt>cmake</tt>, it may be necessary to specify the location of the library provided | In some cases, however, particularly with <tt>cmake</tt>, it may be necessary to specify explicitly the location of the library provided by the modulefile. The preferred and the most robust way to do so is to use an EasyBuild environment variable, <tt>EBROOT...</tt>, instead of manually typing a path. This will allow you to switch easily between toolchains without modifying the compilation instructions, and will also reduce the risk of linking a mismatched library. For example, if you need to specify the location of the GSL library, the option you provide to <tt>cmake</tt> might look like <tt>-DGSL_DIR=$EBROOTGSL</tt>. The <tt>EBROOT...</tt> environment variables adhere to the same construction pattern: <tt>EBROOT</tt> followed by the name of the package, for example <tt>EBROOTGCC</tt>. | ||
== BLAS/LAPACK and MKL == <!--T:10--> | == BLAS/LAPACK and MKL == <!--T:10--> |