Cannot build legacy 'useLegatoApi' app

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

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

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

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]

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