Error building package under WSL2/Ubuntu20.04

I run into the following error when trying to build a package under WSL2/Ubuntu20.04:

autoreconf: Leaving directory `.'
(cd /mnt/e/Win10/Projects/WSL/gl-sdk/sdk/1806/ramips/build_dir/target-mipsel_24kc_musl/c-ares-1.13.0/./; if [ -x ./configure ]; then find /mnt/e/Win10/Projects/WSL/gl-sdk/sdk/1806/ramips/build_dir/target-mipsel_24kc_musl/c-ares-1.13.0/ -name config.guess | xargs -r chmod u+w; find /mnt/e/Win10/Projects/WSL/gl-sdk/sdk/1806/ramips/build_dir/target-mipsel_24kc_musl/c-ares-1.13.0/ -name config.guess | xargs -r -n1 cp --remove-destination /mnt/e/Win10/Projects/WSL/gl-sdk/sdk/1806/ramips/scripts/config.guess; find /mnt/e/Win10/Projects/WSL/gl-sdk/sdk/1806/ramips/build_dir/target-mipsel_24kc_musl/c-ares-1.13.0/ -name config.sub | xargs -r chmod u+w; find /mnt/e/Win10/Projects/WSL/gl-sdk/sdk/1806/ramips/build_dir/target-mipsel_24kc_musl/c-ares-1.13.0/ -name config.sub | xargs -r -n1 cp --remove-destination /mnt/e/Win10/Projects/WSL/gl-sdk/sdk/1806/ramips/scripts/config.sub; AR="mipsel-openwrt-linux-musl-gcc-ar" AS="mipsel-openwrt-linux-musl-gcc -c -Os -pipe -mno-branch-likely -mips32r2 -mtune=24kc -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -msoft-float -iremap/mnt/e/Win10/Projects/WSL/gl-sdk/sdk/1806/ramips/build_dir/target-mipsel_24kc_musl/c-ares-1.13.0:c-ares-1.13.0 -Wformat -Werror=format-security -fstack-protector -Wl,-z,now -Wl,-z,relro" LD=mipsel-openwrt-linux-musl-ld NM="mipsel-openwrt-linux-musl-gcc-nm" CC="mipsel-openwrt-linux-musl-gcc" GCC="mipsel-openwrt-linux-musl-gcc" CXX="mipsel-openwrt-linux-musl-g++" RANLIB="mipsel-openwrt-linux-musl-gcc-ranlib" STRIP=mipsel-openwrt-linux-musl-strip OBJCOPY=mipsel-openwrt-linux-musl-objcopy OBJDUMP=mipsel-openwrt-linux-musl-objdump SIZE=mipsel-openwrt-linux-musl-size CFLAGS="-Os -pipe -mno-branch-likely -mips32r2 -mtune=24kc -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -msoft-float -mips16 -minterlink-mips16 -iremap/mnt/e/Win10/Projects/WSL/gl-sdk/sdk/1806/ramips/build_dir/target-mipsel_24kc_musl/c-ares-1.13.0:c-ares-1.13.0 -Wformat -Werror=format-security -fstack-protector -Wl,-z,now -Wl,-z,relro " CXXFLAGS="-Os -pipe -mno-branch-likely -mips32r2 -mtune=24kc -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -msoft-float -mips16 -minterlink-mips16 -iremap/mnt/e/Win10/Projects/WSL/gl-sdk/sdk/1806/ramips/build_dir/target-mipsel_24kc_musl/c-ares-1.13.0:c-ares-1.13.0 -Wformat -Werror=format-security -fstack-protector -Wl,-z,now -Wl,-z,relro " CPPFLAGS="-I/mnt/e/Win10/Projects/WSL/gl-sdk/sdk/1806/ramips/staging_dir/target-mipsel_24kc_musl/usr/include -I/mnt/e/Win10/Projects/WSL/gl-sdk/sdk/1806/ramips/staging_dir/target-mipsel_24kc_musl/include -I/mnt/e/Win10/Projects/WSL/gl-sdk/sdk/1806/ramips/staging_dir/toolchain-mipsel_24kc_gcc-7.3.0_musl/usr/include -I/mnt/e/Win10/Projects/WSL/gl-sdk/sdk/1806/ramips/staging_dir/toolchain-mipsel_24kc_gcc-7.3.0_musl/include/fortify -I/mnt/e/Win10/Projects/WSL/gl-sdk/sdk/1806/ramips/staging_dir/toolchain-mipsel_24kc_gcc-7.3.0_musl/include -D_FORTIFY_SOURCE=1 " LDFLAGS="-L/mnt/e/Win10/Projects/WSL/gl-sdk/sdk/1806/ramips/staging_dir/target-mipsel_24kc_musl/usr/lib -L/mnt/e/Win10/Projects/WSL/gl-sdk/sdk/1806/ramips/staging_dir/target-mipsel_24kc_musl/lib -L/mnt/e/Win10/Projects/WSL/gl-sdk/sdk/1806/ramips/staging_dir/toolchain-mipsel_24kc_gcc-7.3.0_musl/usr/lib -L/mnt/e/Win10/Projects/WSL/gl-sdk/sdk/1806/ramips/staging_dir/toolchain-mipsel_24kc_gcc-7.3.0_musl/lib -znow -zrelro "   ./configure --target=mipsel-openwrt-linux --host=mipsel-openwrt-linux --build=x86_64-pc-linux-gnu --program-prefix="" --program-suffix="" --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --libexecdir=/usr/lib --sysconfdir=/etc --datadir=/usr/share --localstatedir=/var --mandir=/usr/man --infodir=/usr/info --disable-nls  ; fi; )
configure: error: 'cat' utility not found in 'PATH'. Can not continue.
make[2]: *** [Makefile:58: /mnt/e/Win10/Projects/WSL/gl-sdk/sdk/1806/ramips/build_dir/target-mipsel_24kc_musl/c-ares-1.13.0/.configured_68b329da9893e34099c7d8ad5cb9c940] Error 1
make[2]: Leaving directory '/mnt/e/Win10/Projects/WSL/gl-sdk/sdk/1806/ramips/feeds/gli_pub/c-ares'
Command exited with non-zero status 2

It says “cat utility not found in PATH”, but I do have /usr/bin/cat in the path. I am using a newly cloned sdk from GitHub. My Ubuntu version is as follows:

$ cat /etc/os-release
NAME="Ubuntu"
VERSION="20.04.1 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.1 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal

The SDK GitHub page mentions Ubuntu 18.04, but is Ubuntu 20.04 also supported?

If you look at the WSL instructions again you will see that it’s not possible to compile anything on a windows disk. I see you are using /mnt/e/. You need to move all your files to the /home/your_user/ directory and try again.

1 Like

Yes I missed the about Windows drives. Your solution works. Thanks a lot!

1 Like

PROBLEM:
I was having the same problem…
'cat' utility not found in 'PATH'
…when trying to build Curl on WSL2.

CAUSE:
For me it was caused by my value of TMPDIR environment variable. In order to solve some other unrelated issue (in fact related to to BeyondCompare and git mergetool), I had set TMPDIR to point to a folder somewhere on my C Drive - specifically /mnt/c/Users/<username>/AppData/Local/Temp.
An undesired side effect of this is that calling cat with a temporary file fails (i.e. it is not that cat cannot be found, it is that cat cannot find the temporary file).

In the case of Curl: Curl’s “configure” contains the following code…

xc_space=' '
xc_tab='	' 

#
# Verify that 'cat' utility is found within 'PATH', otherwise abort.
#

xc_tst_str='unknown'
xc_tst_str=`cat <<_EOT 2>/dev/null \
  | wc -l 2>/dev/null | tr -d "$xc_space$xc_tab" 2>/dev/null
unknown
unknown
unknown
_EOT`
case "x$xc_tst_str" in # ((
  x3)
    :
    ;;
  *)
    echo "$xc_msg_err 'cat' utility not found in 'PATH'. $xc_msg_abrt" >&2
    exit 1
    ;;
esac

In essence, WSL2 fails to run the following…

cat <<SOME_END_MARKER
Some text
Some more text
Last line of text
SOME_END_MARKER

$ cat <<SOME_END_MARKER

Some text
Some more text
Last line of text
SOME_END_MARKER
cat: -: No such file or directory <==== cat cannot find a a file called “-”
$

i.e. The intention was to check for the presence of cat, but instead it failed because the test was using a temporary file. Cat is fine.

SOLUTION
I fixed it by not overriding the default TMPDIR variable in my ~/.bashrc

I hope this helps someone.

1 Like