Mkapp: command not found

I get the below error

sasurend@sagar-ubuntu-desktop:~/legato_framework/legato/apps/sample/helloWorld$ mkapp -t wp76xx helloWorld.adef

mkapp: command not found

I tried running bin/legs. but that did not solve the problem as well.

you need to run mkapp inside “leaf shell” …

Interesting. I’m hitting the same problem in my intro to Legato. There’s no mention of the Leaf shell here:

<<
mkapp is the tool that is used to build the app into a binary package that can then be installed on your target. <…>

From the helloWorld directory run the following command (the target in this example is the wp85):

$ mkapp -t helloWorld.adef

you can see here:

If you don’t use leaf shell, you need to do " source bin/configlegatoenv"

Thanks for the advice. I have spent quite a few days so far, just trying to get the tools working. Installed VirtualBox and mangOH Development Ubuntu 18.04, with Leaf. So far, I have tried following several different sets of instructions, but they all hit obstacles:

  1. mangOH™ Red Getting Started Guide (Windows) ‘cfglegato’ : command not found
  2. mangOH® Red Getting Started Guide (non-Octave) - Does loads of stuff, fails to finish
    Sub command failed: ‘leaf profile sync WP76xx_profile’
    …“try leaf profile sync to resume” Didn’t work
  3. 01 Installing Legato and mangOH on Device - YouTube " 01 Installing Legato and mangOH on Device"
    URLs referenced no longer exist. Documents referenced don’t contain the instructions as in video
  4. helloWorld - Legato Docs That’s where I am now, still trying to run “Hello world”

That, and the VM which times out and disappears after only a few minutes of inactivity! Also, 5 times out of 10, the VM starts without the left-hand buttons, so can’t run anything.

I’m an elec-eng by trade, and a software newbie, but I thought I could follow instructions.

What is the error message in point2?

Following setup instructions for the VM, following “mangOH® Red Getting Started Guide (non-Octave)”:
Note: I have deliberately broken some of the URLs, just to allow this message to get posted. There’s a limit of two URLs from beginners.

$ leaf search -t mangOH -t red -t wp76xx

mangoh@mangoh-dev:~/myWorkspace$ leaf setup WP76xx_profile -p mangoh-red-wp76xx_0.6.0
Y

Cannot find workspace, initialize one in /home/mangoh/myWorkspace? (Y/n)
Y
→ Execute: leaf init
Workspace initialized /home/mangoh/myWorkspace
→ Execute: leaf profile create WP76xx_profile
Current profile is now WP76xx_profile
Profile WP76xx_profile created
→ Execute: leaf profile config WP76xx_profile -p mangoh-red-wp76xx_0.6.0
→ Execute: leaf profile sync WP76xx_profile
Profile is out of sync
Packages to install: wp76-legato_20.04.0-202004151904, wp76-toolchain_SWI9X07Y_02.28.03.05-linux64, wp76-modem-image_13.3, wp76-legato-image_20.04.0-202004151904, wp76-linux-image_SWI9X07Y_02.28.03.05, wp76-image_4.7.0, swi-legato_1.4.191225, swi-vscode-support_200624, swi-wp76_4.7.0, Octave-mangOH-red-wp76xx_3.0.0-pre23April2020-mangOH-0, mangoh-red-wp76xx_0.6.0
Total size: 540.9 MB
Do you want to continue? (Y/n)
Y
[100%] Downloading 99026f4-swi-license_1.2.leaf
Run install steps for swi-license_1.2
<…more…>
Checking required apt packages…swicwe
.swiflash

You need to install some missing packages with command:
sudo apt-get update && sudo apt-get install swiflash swicwe

Do you want to execute this command (Y/n)? Y
Get:1 ht tp:// Index of /ubuntu bionic-security InRelease [88.7 kB]
Hit:2 ht tps: //downloads.sierrawireless.com/tools/debian release/ InRelease
<…more stuff…>
Get:30 ht tp://ca.archive.ubuntu.com/ubuntu bionic-backports/universe amd64 DEP-11 Metadata [10.0 kB]
Fetched 17.5 MB in 32s (542 kB/s)
Reading package lists… Done
E: dpkg was interrupted, you must manually run ‘sudo dpkg --configure -a’ to correct the problem.
ERROR:
Profile provisioning interrupted
CAUSED BY:
Error while installing required packages (Error during sync step for swi-verify-aptdeps_1.7.210909 (command returned 100))
HINT:
try leaf profile sync to resume
Command exited with 2
ERROR:
Sub command failed: ‘leaf profile sync WP76xx_profile’

Profile is out of sync
Packages to install: wp76-legato_20.04.0-202004151904, wp76-toolchain_SWI9X07Y_02.28.03.05-linux64, wp76-modem-image_13.3, wp76-legato-image_20.04.0-202004151904, wp76-linux-image_SWI9X07Y_02.28.03.05, wp76-image_4.7.0, swi-legato_1.4.191225, swi-vscode-support_200624, swi-wp76_4.7.0, Octave-mangOH-red-wp76xx_3.0.0-pre23April2020-mangOH-0, mangoh-red-wp76xx_0.6.0
Total size: 540.9 MB
Do you want to continue? (Y/n)
Y
Run sync steps for swi-aptdeps-image_1.0
Run sync steps for swi-aptdeps-legato_1.0
Run sync steps for swi-license_1.2
Run sync steps for swi-verify-aptdeps_1.7.210909
Checking required apt packages…swicwe
.swiflash

You need to install some missing packages with command:
sudo apt-get update && sudo apt-get install swiflash swicwe

Do you want to execute this command (Y/n)? Y
Hit:1 ht tps://downloads.sierrawireless.com/tools/debian release/ InRelease
Hit:2 ht tp://ca.archive.ubuntu.com/ubuntu bionic InRelease
Hit:3 ht tp://security.ubuntu.com/ubuntu bionic-security InRelease
Hit:4 ht tp://ca.archive.ubuntu.com/ubuntu bionic-updates InRelease
Hit:5 ht tp://ca.archive.ubuntu.com/ubuntu bionic-backports InRelease
Reading package lists… Done
E: dpkg was interrupted, you must manually run ‘sudo dpkg --configure -a’ to correct the problem.
ERROR:
Profile provisioning interrupted
CAUSED BY:
Error while installing required packages (Error during sync step for swi-verify-aptdeps_1.7.210909 (command returned 100))
HINT:
try leaf profile sync to resume
** Already tried that - didn’t work. Going round in circles!

Does this help?

Here says reinstalling Ubuntu 16 can resolve the problem:

Other user says it is ok on ubuntu 18 on virtual machine:

Just working through the suggestions given.
$ leaf shell
(lsh) mangoh@mangoh-dev:~/legato/packages/legato.framework.19.2.0.wp76xx-201906171244/resources/legato/apps/sample/helloWorld$ mkapp -t wp76xx helloWorld.adef
mkapp: command not found
No progress in that direction. It looks like the directory structure has been created and populated, but there’s always something missing.

I don’t see problem with same package swi-wp76_4.7.0, the leaf shell should configure the correct paths :

owner@ubuntu:~/leaf$ leaf shell
Leaf Shell /bin/bash started in Leaf environment.

(lsh:swi-wp76_4.7.0) owner@ubuntu:~/leaf$ mkapp
** ERROR:
Bad configuration environment file path '/home/owner/leaf/leaf-data/swi-wp76_4.7.0/wp76-legato/build/localhost/config.sh'.
(lsh:swi-wp76_4.7.0) owner@ubuntu:~/leaf$ pwd
/home/owner/leaf
(lsh:swi-wp76_4.7.0) owner@ubuntu:~/leaf$ cd apps/
ls
(lsh:swi-wp76_4.7.0) owner@ubuntu:~/leaf/apps$ ls
_build_hello1  c++  Demo  hello1.wp76xx.update  hello.adef  helloWorld.adef
(lsh:swi-wp76_4.7.0) owner@ubuntu:~/leaf/apps$ cd Demo
(lsh:swi-wp76_4.7.0) owner@ubuntu:~/leaf/apps/Demo$ cd hello1
ls
(lsh:swi-wp76_4.7.0) owner@ubuntu:~/leaf/apps/Demo/hello1$ ls
_build_hello1  hello1.adef  hello1Component  hello1.wp76xx.update
(lsh:swi-wp76_4.7.0) owner@ubuntu:~/leaf/apps/Demo/hello1$ mkapp -t wp76xx hello1.adef
** WARNING: File system size limit being ignored for unsandboxed application 'hello1'.
[9/9] Packaging app
(lsh:swi-wp76_4.7.0) owner@ubuntu:~/leaf/apps/Demo/hello1$ export | grep LEGATO
declare -x LEGATO_CONFIG_SCRIPT="/home/owner/.leaf/wp76-legato_20.04.0-202004151904/build/wp76xx/config.sh"
declare -x LEGATO_DEF_FILE="/home/owner/leaf/apps/Demo/hello1/hello1.adef"
declare -x LEGATO_LANGUAGE_SERVER="/home/owner/leaf/leaf-data/swi-wp76_4.7.0/swi-vscode-support/languageServer/languageServer.js"
declare -x LEGATO_OBJECT_DIR="./_build_hello1/wp76xx"
declare -x LEGATO_OUTPUT_DIR="."
declare -x LEGATO_ROOT="/home/owner/leaf/leaf-data/swi-wp76_4.7.0/wp76-legato"
declare -x LEGATO_SNIPPETS=":/home/owner/leaf/leaf-data/swi-wp76_4.7.0/swi-vscode-support/snippets"
declare -x LEGATO_SYSROOT="/home/owner/leaf/leaf-data/swi-wp76_4.7.0/wp76-toolchain/sysroots/armv7a-neon-poky-linux-gnueabi"
declare -x LEGATO_TARGET="wp76xx"
declare -x LEGATO_TOOLCHAIN_FULL_PREFIX="/home/owner/leaf/leaf-data/swi-wp76_4.7.0/wp76-toolchain/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-"
declare -x LEGATO_UPDATE_FILE="./hello1.wp76xx.update"
declare -x WP76XX_LEGATO_IMAGES="/home/owner/leaf/leaf-data/swi-wp76_4.7.0/wp76-legato-image"

I notice that my prompt isn’t the same as yours, after the ‘leaf shell’ command (ignoring the directory path).
Yours:
(lsh:swi-wp76_4.7.0) owner@ubuntu:~/leaf$
Mine:
(lsh) mangoh@mangoh-dev:~/legato/packages/legato.framework.19.2.0.wp76xx-201906171244/resources/legato/apps/sample/helloWorld$

Could you possibly say what series of steps you used to set up your VM, please?
I probably need to start my VM again, using the original file
(mangOH a Ubuntu 18.04 - 20200330.ova). I’ve had to start & stop the VM many times during this process, mostly because of its annoying time-out, which I haven’t found how to prevent.

Seems your path is not correct (~/legato/packages/legato.framework.19.2.0.wp76xx-201906171244/resources/legato/apps/sample/helloWorld).

are you doing this in vscode?

I’m not using VSCode. There is no mention of it in the MangOH Getting Started Guide.
I did see it on the page you referenced, but I wasn’t instructed to use it. Is this part of a different set of setup instructions?

it should be easier for downloading package as there is a UI to show.
It is up to you to use it or not.
You can still use LEAF to download package.

Well, not knowing how to use Leaf to do anything, I downloaded the .deb version of VSCode, stuck it in a shared folder and ran it from inside the VM. The installation actually worked (although it’s easier to navigate to some parts of the file system using the plain terminal & command-line).

I have a related question: At what step in the setup process does the mkapp command get created? Assuming it’s not part of Legato itself, but something which should have been added (but wasn’t). E.g. should this be enough? -
ht tps://docs.legato.io/latest/getStartedHW.html
Thanks for the support.

it is in here:


(lsh:swi-wp76_4.7.0) owner@ubuntu:~/leaf/leaf-data/current/wp76-legato$ ls
3rdParty        CODE_OF_CONDUCT.md     default.sdef         legato.kconfig           Makefile.hostTools    platformBuildVars.sinc  sources.md5
apps            components             drivers              legatoTargetConfig.sinc  Makefile.targetTools  proprietary             targetFiles
bin             conftest.py            framework            LICENSE.md               manifest.json         __pycache__             targets
build           CONTRIB_COMPANY.md     interfaces           localhost.sdef           modules               pytest.ini              tools
cmake           CONTRIB_INDIVIDUAL.md  KConfig              Makefile                 package.properties    README.md               utils.mk
CMakeLists.txt  default_readonly.sdef  kconfigfunctions.py  Makefile.framework       platformAdaptor       run-tests               version
(lsh:swi-wp76_4.7.0) owner@ubuntu:~/leaf/leaf-data/current/wp76-legato$ find ./ -name "mkapp"
./bin/mkapp

I did a similar search for “mkapp” and got four hits:
mangoh@mangoh-dev:~$ find ./ -name “mkapp”
./.leaf/wp76-legato_20.04.0-202004151904/bin/mkapp
./.leaf/wp76-legato_18.03.0-201804102300/build/tools/mkapp
./.leaf/wp76-legato_18.03.0-201804102300/bin/mkapp
./legato/packages/legato.framework.19.2.0.wp76xx-201906171244/resources/legato/bin/mkapp

I notice that my paths start from “.leaf” and not “leaf”
I also seem to have multiple versions, possibly from multiple attempts to install.

Permissions for mkapp are lrwxrwxrwx, but I still get a “not found” when I try executing from inside its dir. (Tried all four of them)

So, where to go? Wipe the VM and start again with the original .ova file or is this fixable? Follow a different set of instructions?
Thanks

did you do mkapp inside “leaf shell”?
You can see in my example, after leaf shell, it will show “(lsh:swi-wp76_4.7.0)”

When I run “leaf shell” I only get (lsh) and not “(lsh:swi-wp76_4.7.0)” in front of the prompt. Maybe that’s the problem - something didn’t install?

With or without leaf shell, mkapp always gives “command not found”

Thanks

Did you use the UI in vscode to install package?
Which package have you installed?