# Fix mangOH build error with variable LEGATO=1

**URL:** <https://mangoh.discourse.group/t/fix-mangoh-build-error-with-variable-legato-1/1591>\
**Category:** mangOH Red\
**Created:** [June 21, 2018, 3:30am UTC](https://mangoh.discourse.group/t/fix-mangoh-build-error-with-variable-legato-1/1591 "2018-06-21T03:30:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![harry](https://avatars.discourse-cdn.com/v4/letter/h/f6c823/32.png) [@harry](https://mangoh.discourse.group/u/harry)\
**Post date:** [June 21, 2018, 3:30am UTC](https://mangoh.discourse.group/t/fix-mangoh-build-error-with-variable-legato-1/1591/1 "2018-06-21T03:30:37Z")

</div>

I downloaded the mangOH and Legato source and configured the environment to build with:  
 make red\_wp76xx LEGATO=1 or make red\_wp76xx /_LEGATO=1 by default in Makefile_/

error coming out:  
…  
legatoAF/legato/framework/include/legato.h:146:20: fatal error: unistd.h: No such file or directory  
…

The root cause is that the LEGATO\_SYSROOT was not set during building legato project, e.g my project is: WP76XX\_SYSROOT variable, the LEGATO\_SYSROOT=WP76XX\_SYSROOT, the LEGATO\_ROOT and WP76XX\_SYSROOT were set in your ~/.bashrc according to the doc.  
Note: XXXX\_SYSROOT should be the project that the one your are developing.

The following patch can fix the above error and build legato + mangoOH successfully.  
/your\_project\_path/mangOH/Makefile  
=====================================================================

 ![mangOH](https://us1.discourse-cdn.com/flex016/uploads/mangoh/original/1X/a348bae89e889b8c9267badfc5673f7483e34e0c.png)

---

<div class="post-metadata">

**Author:** ![dfrey](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/dfrey/32/303_2.png) [@dfrey](https://mangoh.discourse.group/u/dfrey)\
**Post date:** [June 21, 2018, 9:48pm UTC](https://mangoh.discourse.group/t/fix-mangoh-build-error-with-variable-legato-1/1591/2 "2018-06-21T21:48:31Z")

</div>

Are you trying to build against a Legato version \<= 18.02.0?

---

<div class="post-metadata">

**Author:** ![harry](https://avatars.discourse-cdn.com/v4/letter/h/f6c823/32.png) [@harry](https://mangoh.discourse.group/u/harry)\
**Post date:** [June 22, 2018, 3:08am UTC](https://mangoh.discourse.group/t/fix-mangoh-build-error-with-variable-legato-1/1591/3 "2018-06-22T03:08:28Z")

</div>

## According to the mangOH git submit log:

Use sdef “componentSearch” feature

```
By using the componentSearch feature, more of the build requirements can
be specified in the SDEF instead of the Makefile. componentSearch is a
Legato 18.04.0 feature.

```

* * *

which means the master branch of mangOH requires that the Legato should be 18.04.0 above.

If you wanna use the Legato whose version is below 18.04.0, you should back the mangOH to the git head before the submit of “Use sdef “componentSearch” feature”
