WM_SCHEDULER breaks compilation generated sources (flex, bison etc)
Summary
When using a wrapper for the compiler with WM_SCHEDULER the compilation of sources where another utility generates the sources breaks
Steps to reproduce
I use ccache
speed up re-compilation. When I enable it and compile a library I get an error message for one of the flex-files
> export WM_SCHEDULER=ccache
> wmake libso src/fileFormats
ccache flex -+ -f -o /slowdata/OpenFOAMInstallations/OpenFOAM-Ubuntu/OpenFOAM-plus/build/linux64Clang120DPInt32Opt/src/fileFormats/stl/STLAsciiParseFlex.L.C stl/STLAsciiParseFlex.L '&&' clang++ -std=c++14 -m64 -pthread -DOPENFOAM=2202 -DWM_DP -DWM_LABEL_SIZE=32 -Wall -Wextra -Wold-style-cast -Wnon-virtual-dtor -Wno-unused-parameter -Wno-invalid-offsetof -Wno-undefined-var-template -Wno-unknown-warning-option -O3 -DNoRepository -ftemplate-depth-100 -iquote. -IlnInclude -I/slowdata/OpenFOAMInstallations/OpenFOAM-Ubuntu/OpenFOAM-plus/src/OpenFOAM/lnInclude -I/slowdata/OpenFOAMInstallations/OpenFOAM-Ubuntu/OpenFOAM-plus/src/OSspecific/POSIX/lnInclude -fPIC -Wno-old-style-cast -Wno-unused-local-typedefs -Wno-tautological-undefined-compare -Wno-shift-negative-value -Wno-null-pointer-arithmetic -Wno-null-pointer-subtraction -Wno-unknown-warning-option -Wno-deprecated-copy-with-user-provided-copy -Wno-tautological-overlap-compare -Wno- -c /slowdata/OpenFOAMInstallations/OpenFOAM-Ubuntu/OpenFOAM-plus/build/linux64Clang120DPInt32Opt/src/fileFormats/stl/STLAsciiParseFlex.L.C -o /slowdata/OpenFOAMInstallations/OpenFOAM-Ubuntu/OpenFOAM-plus/build/linux64Clang120DPInt32Opt/src/fileFormats/stl/STLAsciiParseFlex.o
/usr/bin/flex: can't open &&
/usr/bin/m4:stdin:7265: ERROR: end of file in string
Example case
Not applicable
What is the current bug behaviour?
Compilation fails for this and similar files (Lemon, Bison etc)
What is the expected correct behavior?
Compilation should work
Relevant logs and/or images
See above
Environment information
- OpenFOAM version : current git-version. But also any other release from the last years
- Operating system : Ubuntu 18.04
- Compiler : Clang 12 (but happens with other compilers as well)
The problem might be that Ubuntu doesn't use for /bin/sh
not bash
like most distros but they use dash
which has some small incompatibilities and one of them might be a different treatment of '&&'
that is used if WM_SCHEDULER is set
Possible fixes
Attached there is a patch that fixes this by moving the WM_SCHEDULER immediately before the compiler call not the call of the utility that generates the source code. This makes sense as utilities like ccache (or distcc - which is the other application for WM_SCHEDULER that I've seen) only know how to wrap the compiler calls anyway