View Revisions: Issue #2424

Summary 0002424: Proposition for a clearer message when OpenFOAM environment is not loaded in the shell
Revision 2017-01-08 21:01 by wyldckat
Description First of all, I only picked up on this thanks to Alexey Matveichev who pointed it out on this post: https://www.cfd-online.com/Forums/openfoam-installation/182250-something-wrong-allwmake.html#post632112 - post #2

A somewhat common problem with new users is getting the following message when trying to build from source code:

   ./Allwmake:7:.:Can't open /wmake/scripts/AllwmakeParseArguments

Such examples were the aforementioned thread and the report #2202: https://bugs.openfoam.org/view.php?id=2202


This didn't use to happen before the introduction of using this 'AllwmakeParseArguments' script, because the following check would pretty much point out what's going on wrong:

  wmakeCheckPwd "$WM_PROJECT_DIR" || {
      echo "Allwmake error: Current directory is not \$WM_PROJECT_DIR"
      echo " The environment variables are inconsistent with the installation."
      echo " Check the OpenFOAM entries in your dot-files and source them."
      exit 1
  }


Therefore, there are various solutions to this situation, where:

The simplest solution
... is to change the sourcing of the script "AllwmakeParseArguments" to after the checks are complete in these files:

  - Allwmake
  - src/Allwmake
  - applications/Allwmake

The downside is that the script first fails with the message that the 'wmakeCheckPwd' script wasn't found.


Relative sourcing and checking for a loaded environment
After considering various scenarios and alternatives, I ended up with the attached "proposition_v1.tar.gz", which does the following changes:

  - Allwmake
  - src/Allwmake
  - applications/Allwmake

    - in all of these 3, given they mostly require hard-coded relative paths, then instead of sourcing with the full path, the relative path is used instead for sourcing "AllwmakeParseArguments".

    - Also added a comment for the checks.

  - wmake/scripts/AllwmakeParseArguments

    - It now checks if "$WM_PROJECT_DIR" is empty and if it is, then it gives the following output:

      Allwmake error: The OpenFOAM environment is not set.
          Check the OpenFOAM entries in your dot-files and source them.
          If in doubt, please read:
              http://openfoam.org/download/source/setting-environment


The only problem I can see with this is if the 'wmake' isn't where it's meant to be relative to the paths where is each of these 'Allwmake'.
Revision 2017-01-08 20:54 by wyldckat
Description First of all, I only picked up on this thanks to Alexey Matveichev who pointed it out on this post: https://www.cfd-online.com/Forums/openfoam-installation/182250-something-wrong-allwmake.html#post632112 - post #2

A somewhat common problem with new users is getting the following message when trying to build from source code:

   ./Allwmake:7:.:Can't open /wmake/scripts/AllwmakeParseArguments

Such examples were the aforementioned thread and the report #2202: https://bugs.openfoam.org/view.php?id=2202


This didn't use to happen before the introduction of using this 'AllwmakeParseArguments' script, because the following check would pretty much point out what's going on wrong:

  wmakeCheckPwd "$WM_PROJECT_DIR" || {
      echo "Allwmake error: Current directory is not \$WM_PROJECT_DIR"
      echo " The environment variables are inconsistent with the installation."
      echo " Check the OpenFOAM entries in your dot-files and source them."
      exit 1
  }


Therefore, there are various solutions to this situation, where:

<h3>The simplest solution</h3>
... is to change the sourcing of the script "AllwmakeParseArguments" to after the checks are complete in these files:

  - Allwmake
  - src/Allwmake
  - applications/Allwmake

The downside is that the script first fails with the message that the 'wmakeCheckPwd' script wasn't found.


<h3>Relative sourcing and checking for a loaded environment</h3>
After considering various scenarios and alternatives, I ended up with the attached "proposition_v1.tar.gz", which does the following changes:

  - Allwmake
  - src/Allwmake
  - applications/Allwmake

    - in all of these 3, given they mostly require hard-coded relative paths, then instead of sourcing with the full path, the relative path is used instead for sourcing "AllwmakeParseArguments".

    - Also added a comment for the checks.

  - wmake/scripts/AllwmakeParseArguments

    - It now checks if "$WM_PROJECT_DIR" is empty and if it is, then it gives the following output:

      Allwmake error: The OpenFOAM environment is not set.
          Check the OpenFOAM entries in your dot-files and source them.
          If in doubt, please read:
              http://openfoam.org/download/source/setting-environment


The only problem I can see with this is if the 'wmake' isn't where it's meant to be relative to the paths where is each of these 'Allwmake'.