.. _FAQ: Frequently Asked Questions ========================== Module command -------------- How does the ``module`` command work? ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ The command ``module`` is an alias for something like: sh: .. code-block:: sh module () { eval `/some/path/modulecmd sh $*` } csh: .. code-block:: csh eval `/some/path/modulecmd csh !*` Where the ``modulecmd`` outputs valid shell commands to *stdout* which manipulates the shell's environment. Any text that is meant to be seen by the user **must** be sent to *stderr*. For example: .. code-block:: tcl puts stderr "\n\tSome Text to Show\n" I put the ``module`` command in a script and I run the script... it doesn't change my environment? ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ A child process (script) can not change the parent process environment. A ``module load`` in a script only affects the environment for the script itself. The only way you can have a script change the current environment is to *source* the script which reads it into the current process. sh: .. code-block:: sh . somescript csh: .. code-block:: csh source somescript How do I capture the module command output? ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ This ties in with the very first question. Since the :ref:`module(1)` command is essentially an *eval*, the visible output to the screen must necessarily be sent to *stderr*. It becomes a matter on how to capture output from *stderr* for the various shells. The following examples just show how to spool the output from the **avail** command to a file. This also works for the various other module commands like **list**, **display**, etc. There are also various tricks for piping *stderr* to another program. sh: .. code-block:: sh module avail 2> spoolfile csh: (overwrite existing file) .. code-block:: csh module avail >&! spoolfile How to use the module command from Makefile? ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ To make use of the ``module`` command from a Makefile, the shell initialization script should first be sourced within Makefile rule to define the ``module`` function in that context. Environment variable ``MODULESHOME`` may help to locate the shell initialization script in a generic way, like done in the following example: .. code-block:: Makefile module_list: source $$MODULESHOME/init/bash; module list Modulefiles ----------- I want the modulefile to source some rc script that came with some application ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ See the module :ref:`sh-to-mod_sub-command` sub-command to translate the environment changes done by a shell script into a :ref:`modulefile(4)`. You could also check the :ref:`source-sh_modulefile_command` to directly import the environment changes performed by a shell script within a :ref:`modulefile(4)`. How do I specify the *default* modulefile for some modulefile directory? ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Modules usually uses the the highest lexicographically sorted :ref:`modulefile(4)` under the directory, unless there is a ``.version`` file in that directory which has a format like the following where "native" is a modulefile (or a sub-directory) in that directory. It's also possible to set the default with a ``.modulerc`` file with a **module-version** command. .. code-block:: tcl #%Module1.0##################################################################### ## ## version file for Perl ## set ModulesVersion "native" I don't want a *default* modulefile for the directory? ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Follow the same prescription as setting a *default*, but give some *bogus* value, say *no_default*. The :ref:`module(1)` command will return an error message when no specific version is given. Build Issues ------------ The configure script complains about Tclx ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ :: ... checking for TclX configuration (tclxConfig.sh)... not found checking for TclX version... using 8.4 checking TCLX_VERSION... 8.4 checking TCLX_LIB_SPEC... TCLX_LIB_SPEC not found, need to use --with-tclx-lib checking TCLX_INCLUDE_SPEC... TCLX_INCLUDE_SPEC not found, need to use --with-tclx-inc ... TclX is an optional library that can speed up some operations. You don't need TclX for modules to compile and work, so you can add the --without-tclx option when configuring and it should proceed to completion. In fact, it should have succeeded anyways and just not attempt to use TclX. Otherwise, you can load the TclX library package for your OS and the ``configure`` script should find it. If not then if you know where the ``tclxConfig.sh`` file or the library and include files are placed then use the following options:: --with-tclx=