# Cannot build legacy 'useLegatoApi' app

**URL:** <https://forum.legato.io/t/cannot-build-legacy-uselegatoapi-app/147>\
**Category:** Legato Application Framework\
**Created:** [June 11, 2015, 6:52pm UTC](https://forum.legato.io/t/cannot-build-legacy-uselegatoapi-app/147 "2015-06-11T18:52:29Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![pivaz](https://avatars.discourse-cdn.com/v4/letter/p/8baadc/32.png) [@pivaz](https://forum.legato.io/u/pivaz)\
**Post date:** [June 11, 2015, 6:52pm UTC](https://forum.legato.io/t/cannot-build-legacy-uselegatoapi-app/147/1 "2015-06-11T18:52:29Z")

</div>

I am trying to compile sample app ‘useLegatoApi’, but I am running into the following two errors:

$ cd /legato-af/apps/samples/legace/useLegatoApi  
$ make wp85  
mkcomp --stand-alone -t wp85 -i /home/pivaz/Legato/legato-af/interfaces/modemServices api\_client  
[3/3] /opt/swi/y16-ext/sysroots/x86\_64-pokysdk-linux/usr/bin/arm-poky-linux-…6de55acfa7a2f/client/le\_info\_client.c.o -Wall -fPIC -Werror -DMK\_TOOLS\_BUIL  
/opt/swi/y16-ext/sysroots/x86\_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc -c main.c -I\_build -I/home/pivaz/Legato/legato-af/framework/c/inc  
main.c:3:24: fatal error: interfaces.h: No such file or directory  
compilation terminated.  
make: \*\*\* [main.o] Error 1

‘mkcomp …’ creates the ‘\_build’ folder. “interfaces.h” is inside folder, but its path is '\_build/component/api\_client/src/interfaces.h", looking at the makefile the expected location should be “\_build/interfaces.h”. Similar thing for “le\_info\_interfaces.h”, its actual location is “\_build/api/ec20858f80d55f58b606de55acfa7a2f/client/le\_info\_interface.h”, not “\_build/le\_info\_interfaces.h”

Attempted solution:

I modified the makefile to include ‘-I \_build/api/ec20858f80d55f58b606de55acfa7a2f/client/’ and ‘-I \_build/component/api\_client/src’, and that gets me past the ‘interfaces.h: no such file or directory’ problem…but then the make can’t find libIF\_le\_info\_client.so.

$ make wp85  
mkcomp --stand-alone -t wp85 -i /home/pivaz/Legato/legato-af/interfaces/modemServices api\_client  
[3/3] /opt/swi/y16-ext/sysroots/x86\_64-pokysdk-linux/usr/bin/arm-poky-linux-…6de55acfa7a2f/client/le\_info\_client.c.o -Wall -fPIC -Werror -DMK\_TOOLS\_BUIL  
/opt/swi/y16-ext/sysroots/x86\_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc -c main.c -I\_build -I\_build/component/api\_client/src -I\_build/api/ec20858f80d55f58b606de55acfa7a2f/client -I/home/pivaz/Legato/legato-af/framework/c/inc  
/opt/swi/y16-ext/sysroots/x86\_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc -o legacy main.o libIF\_le\_info\_client.so -L/home/pivaz/Legato/legato-af/build/wp85/bin/lib -llegato  
arm-poky-linux-gnueabi-gcc: error: libIF\_le\_info\_client.so: No such file or directory  
make: \*\*\* [legacy] Error 1

I checked $LEGATO\_ROOT/build/wp85/bin/lib, could not find the .so file there.

Note: I have ninja-build installed.

Host: Ubuntu 14.04 x64  
Modem: WP85  
Legato: 15.05 Beta

---

<div class="post-metadata">

**Author:** ![davidc](https://avatars.discourse-cdn.com/v4/letter/d/a183cd/32.png) [@davidc](https://forum.legato.io/u/davidc)\
**Post date:** [June 11, 2015, 10:11pm UTC](https://forum.legato.io/t/cannot-build-legacy-uselegatoapi-app/147/2 "2015-06-11T22:11:04Z")

</div>

Hiya,

interfaces.h is built from your component, rather than being a system header file.

As a first thought, check that your cdef and adef files are correct.

This is all pretty new to us!

ciao, Dave

---

<div class="post-metadata">

**Author:** ![pivaz](https://avatars.discourse-cdn.com/v4/letter/p/8baadc/32.png) [@pivaz](https://forum.legato.io/u/pivaz)\
**Post date:** [June 11, 2015, 10:44pm UTC](https://forum.legato.io/t/cannot-build-legacy-uselegatoapi-app/147/3 "2015-06-11T22:44:20Z")

</div>

The api\_client/Component.cdef file is directly from the repository, I have not made any modifications to it.

---

<div class="post-metadata">

**Author:** ![kmurphy](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/kmurphy/32/65_2.png) [@kmurphy](https://forum.legato.io/u/kmurphy)\
**Post date:** [June 17, 2015, 11:44pm UTC](https://forum.legato.io/t/cannot-build-legacy-uselegatoapi-app/147/4 "2015-06-17T23:44:42Z")

</div>

Hello,

The sample required some updates, which should be uploaded to GitHub soon. In the mean time, I’m including the code here.

The changes include:

- Changing main.c to include le\_info\_interface.h directly instead of through interfaces.h
- Adding code to the component to auto initialize the client interface.
- Change to the makefile to autocratically find the generated interface directory.
- Change to the makefile to specify an output file for the component build.

[attachment=0]useLegatoApi.tar.gz[/attachment]

---

<div class="post-metadata">

**Author:** ![kmurphy](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/kmurphy/32/65_2.png) [@kmurphy](https://forum.legato.io/u/kmurphy)\
**Post date:** [June 18, 2015, 12:01am UTC](https://forum.legato.io/t/cannot-build-legacy-uselegatoapi-app/147/5 "2015-06-18T00:01:52Z")

</div>

Sorry the forum seems to be having problems with attachments. If you want, you can PM me with an email address I can directly email the code to.

-Kelly

---

<div class="post-metadata">

**Author:** ![dsnedigar](https://avatars.discourse-cdn.com/v4/letter/d/7ba0ec/32.png) [@dsnedigar](https://forum.legato.io/u/dsnedigar)\
**Post date:** [April 20, 2017, 6:52pm UTC](https://forum.legato.io/t/cannot-build-legacy-uselegatoapi-app/147/6 "2017-04-20T18:52:35Z")

</div>

Did this ever get resolved ? I too am having trouble building the sample app, but getting missing library errors with 16.10.1.

Ouput:  
mangoh@mangoh-virtualbox:~/legato/workspace/UplinkTestFile4$ make wp750x  
mkdir -p \_build/wp750x  
make legacy.wp750x TARGET=wp750x  
make[1]: Entering directory ‘/home/mangoh/legato/workspace/UplinkTestFile4’  
/home/mangoh/legato/packages/legato.toolchain.1.7.3.SWI9X15Y\_07112100-wp85-wp750x-native-x86\_64-201701091132/resources/native/sysroots/x86\_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc -o \_build/wp750x/legacy \_build/wp750x/main.o \_build/wp750x/le\_info\_client.o   
-L/home/mangoh/legato/packages/legato.framework.16.10.1.wp85-wp750x-201701111029/resources/legato/build/wp750x/framework/lib -llegato #-lpthread -lrt  
/home/mangoh/legato/packages/legato.toolchain.1.7.3.SWI9X15Y\_07112100-wp85-wp750x-native-x86\_64-201701091132/resources/native/sysroots/x86\_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/…/…/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/4.9.1/ld: cannot find crt1.o: No such file or directory  
/home/mangoh/legato/packages/legato.toolchain.1.7.3.SWI9X15Y\_07112100-wp85-wp750x-native-x86\_64-201701091132/resources/native/sysroots/x86\_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/…/…/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/4.9.1/ld: cannot find crti.o: No such file or directory  
/home/mangoh/legato/packages/legato.toolchain.1.7.3.SWI9X15Y\_07112100-wp85-wp750x-native-x86\_64-201701091132/resources/native/sysroots/x86\_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/…/…/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/4.9.1/ld: cannot find crtbegin.o: No such file or directory  
/home/mangoh/legato/packages/legato.toolchain.1.7.3.SWI9X15Y\_07112100-wp85-wp750x-native-x86\_64-201701091132/resources/native/sysroots/x86\_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/…/…/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/4.9.1/ld: cannot find -lgcc  
/home/mangoh/legato/packages/legato.toolchain.1.7.3.SWI9X15Y\_07112100-wp85-wp750x-native-x86\_64-201701091132/resources/native/sysroots/x86\_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/…/…/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/4.9.1/ld: cannot find -lgcc\_s  
/home/mangoh/legato/packages/legato.toolchain.1.7.3.SWI9X15Y\_07112100-wp85-wp750x-native-x86\_64-201701091132/resources/native/sysroots/x86\_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/…/…/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/4.9.1/ld: cannot find -lc  
/home/mangoh/legato/packages/legato.toolchain.1.7.3.SWI9X15Y\_07112100-wp85-wp750x-native-x86\_64-201701091132/resources/native/sysroots/x86\_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/…/…/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/4.9.1/ld: cannot find -lgcc  
/home/mangoh/legato/packages/legato.toolchain.1.7.3.SWI9X15Y\_07112100-wp85-wp750x-native-x86\_64-201701091132/resources/native/sysroots/x86\_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/…/…/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/4.9.1/ld: cannot find -lgcc\_s  
/home/mangoh/legato/packages/legato.toolchain.1.7.3.SWI9X15Y\_07112100-wp85-wp750x-native-x86\_64-201701091132/resources/native/sysroots/x86\_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/…/…/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/4.9.1/ld: cannot find crtend.o: No such file or directory  
/home/mangoh/legato/packages/legato.toolchain.1.7.3.SWI9X15Y\_07112100-wp85-wp750x-native-x86\_64-201701091132/resources/native/sysroots/x86\_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/…/…/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/4.9.1/ld: cannot find crtn.o: No such file or directory
