Poky ARM GCC toolchain segfaults in Bash on Ubuntu on Windows

I use a Windows 10 computer with the Bash on Ubuntu on Windows feature to run a Linux command line. I wanted to try to build Legato apps from the command line using this tool, but after installing the Legato toolchain I am met with this unexpected result:

/opt/swi/y17-ext/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-g++ --version
Segmentation fault (core dumped)

As far as I can tell this is a problem with the toolchain version (1.7.3) that is distributed with Legato. Using the official Poky toolchain version 1.8 or later does not cause the same issue:

/arm-poky-linux-gnueabi-g++ --version
arm-poky-linux-gnueabi-g++ (GCC) 4.9.2
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO

Has anyone tried to use Bash on Ubuntu on Windows with Legato before and made it work?

If I cannot get the version 1.7.3 toolchain to work, is there a way to use the version 1.8 to build Legato apps? Can I change the toolchain or will this not work?

1 Like

Hi @apadin

We did a try some time ago (as it would be a great way to build Legato software on Windows!).
But we fell into the same conclusion :frowning:

Toolchains for Sierra Wireless products are built using Yocto, and it seems that Yocto over WSL is not supported (yet?).

That’s why we’re using the Docker containers technology to support “native” Windows.
(cf: https://source.sierrawireless.com/resources/airprime/software/legato_application_development_kit_windows/)

Please note that by default it is using a VirtualBox VM to handle Docker, but as you’re running Windows 10, we do have an alternative solution using Docker for Windows (based on Hyper-V, only for Windows 10).
If you want to give a try, I can give you some instructions :wink:

Thanks @daav,

I’m glad I’m not the only person who has tried this.

What is the likelihood that I could use a different Yocto/Poky toolchain version with Legato? I have already tried successfully to build normal applications with the poky 1.8 version of the toolchain from WSL.

I tried this hack to see if it would work:

ln  -s  /opt/poky/1.8  /opt/swi/y17-ext

Since this puts the toolchain in the same place as the official Sierra Wireless toolchain, I would have expected it to work similarly. But when I try to build I get errors such as "fatal error: unistd.h: No such file or directory" which indicates to me that it is not using the correct sysroot.

I understand that Legato has been used on Raspberry Pi. If this is possible, could you not potentially use any toolchain to build Legato framework apps?

Very interesting!
I will check with the team if we have plans to migrate to Yocto 1.8

You can’t link an installed Yocto toolchain to somewhere else and use it as is, because some path references are “recorded” in the installed toolchain, and it really expects to be executed from where it has been installed.
That said, what you could try is:

  • set the WP85_TOOLCHAIN_DIR env var to the location where you have your ARM gcc installed
    (my guess in your case would be /opt/poky/1.8/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi)
  • set the WP85_TOOLCHAIN_PREFIX env var to the gcc prefix (should still be arm-poky-linux-gnueabi-)
  • set the LEGATO_SYSROOT to the target sysroot
    (my guess in your case would be /opt/poky/1.8/sysroots/armv7a-vfp-neon-poky-linux-gnueabi)

Then you should be able to build the Legato Framework, and then Legato apps with this configuration.
But I’m afraid this won’t run until you’ll have a running Linux on the device built with this same configuration.
Did you try to run a simple C program built with your 1.8 toolchain on a Sierra Wireless device (using 1.7)?

Hi @apadin

Got some additional information.
We should support a more recent Yocto version by the end of this year.
Please be sure that we’ll carefully benchmark a WSL based solution to evaluate if it’s worth doing it.

I will try your suggestions regarding these environment variables.

To answer your question, yes I have run C programs built with the 1.8 toolchain on the wp76. The only thing I have been unable to do is build a Legato app.

I have actually tested many different variations of the Yocto toolchain from 1.7 all the way to 2.2 to see if the compiled programs run properly on the wp76. The limiting factor that I saw is the version of glibc that is used - toolchain version 1.9 and greater use a more recent version of glibc that is not supported on the device, which is why I stuck with 1.8.

I am looking forward to full WSL support! This would be a great improvement over my current workflow.

If anyone else is interested or has the same problem, I was finally able to install and build Legato 17.11.0 using the Release 7 toolchain (based on Yocto 2.2) available on this site: https://source.sierrawireless.com/resources/airprime/software/wp76xx/wp76xx-firmware-release-7-components/

I successfully built the helloWorld app from WSL and tested it on my device, no issues.

Thanks for the help!

Hi @apadin

Indeed, I can confirm that now that we start having products based on Yocto 2.2, we’re currently working on making a WSL based solution available (for both Developer Studio and command line).
It should happen before the summer, this year :wink: