Error in foamInstallationTest running under WSL2
Summary
I had the same issue when running foamInstallaionTest
command under WSL2 on Windows 10 as reported in issue #2453 (closed). foamInstallationTest
cannot locate software components and reports 'CRITICAL ERRORS' including for gcc
and isoFoam
when running under WSL2 on Windows 10.
Steps to reproduce
Standard install using `apt-get' for Ubuntu under WSL2 on Windows 10.
Example case
oleg$ foamInstallationTest
Executing foamInstallationTest
Basic setup :
-------------------------------------------------------------------------------
OpenFOAM: openfoam2212
ThirdParty: [missing]
This can be intentional, or indicate a faulty installation
Shell: bash
Host: DESK
OS: Linux version 5.15.146.1-microsoft-standard-WSL2
-------------------------------------------------------------------------------
...
(cut)
...
Software Components
-------------------------------------------------------------------------------
Software Version Location
-------------------------------------------------------------------------------
flex *** not installed ***
make *** not installed ***
wmake *** not installed ***
gcc *** not installed ***
CRITICAL ERROR
g++ *** not installed ***
-------------------------------------------------------------------------------
icoFoam *** not installed ***
CRITICAL ERROR
Environment information
- OpenFOAM version : v2212
- Operating system : Ubuntu 22.04 on WSL2, Windows 10
- Hardware info : n/a
- Compiler : n/a
Possible fixes
The problem is that $PATH
includes directories with spaces under WSL2. The fix is to add double quotes around $PATH
in reportExecutable()
function such as:
reportExecutable()
{
APP_NAME="$1"
APP_SPEC="$2"
APP_PATH="$(findExec "$PATH" $1)"
VERSION="unknown"
After the fix, the srcipt works as expected:
Software Components
-------------------------------------------------------------------------------
Software Version Location
-------------------------------------------------------------------------------
flex 2.6.4 /usr/bin/flex
make 4.3 /usr/bin/make
wmake 2212 /usr/lib/openfoam/openfoam2212/wmake/wmake
gcc 11.4.0 /usr/bin/gcc
g++ 11.4.0 /usr/bin/g++
-------------------------------------------------------------------------------
icoFoam exists ...nfoam2212/platforms/linux64GccDPInt32Opt/bin/icoFoam
I just checked the latest development code and it has the same line as in v2212 (see foamInstallationTest@L213).