Using po-util with WSL

I have been transitioning away from Cygwin and onto Ubuntu via WSL (https://en.wikipedia.org/wiki/Windows_Subsystem_for_Linux) and getting po-util to work was next on the checklist. However, WSL only initially supports 64-bit inside the subsystem. So, any time I would run po photon build, an error was thrown: Syntax error: word unexpected (expecting ")"). Taking a bit of time to figure out the underlying cause, it was from running .po-util/bin/gcc-arm-embedded/gcc-arm-none-eabi-5_3-2016q1/bin/arm-none-eabi-gcc during the build which couldn’t even run and the command would return Exec format error. This has been an ongoing feature-request with WSL and someone figured out how to get 32-bit programs to work: https://github.com/microsoft/wsl/issues/2468#issuecomment-374904520.

The process consists of running the following:

sudo apt install qemu-user-static
sudo update-binfmts --install i386 /usr/bin/qemu-i386-static --magic '\x7fELF\x01\x01\x01\x03\x00\x00\x00\x00\x00\x00\x00\x00\x03\x00\x03\x00\x01\x00\x00\x00' --mask '\xff\xff\xff\xff\xff\xff\xff\xfc\xff\xff\xff\xff\xff\xff\xff\xff\xf8\xff\xff\xff\xff\xff\xff\xff'
sudo service binfmt-support start

It’s noted that for the time-being, the last line has to run each time the WSL environment is initialized. But, it’s pretty cool that it works and now I can move onto trying https://github.com/brewskey/spark-server.

2 Likes

@nrobinson2000 here, creator of po-util.

I haven’t used WSL much (because I don’t use Windows at all), but I’d gladly help make any modifications necessary for po-util to work well within it.

I’d put the modifications into po, the next generation of po-util.