Cannot build legacy 'useLegatoApi' app


#1

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


#2

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


#3

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


#4

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]


#5

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


#6

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