Legato Libraries


I have some trouble understanding the functionment of Legato’s libraries.

I’ll take an exemple of an application which receive SMS and display them on the terminal with LE_INFO macro.
The application architecture is :
- ./ReceiveComponent/receive_sms.c (which includes “legato.h” “le_sms.h”)
- ./ReceiveComponent/Component.cdef :[quote]sources: r_sms.c[/quote]
- ./sms.adef :

sms ( ReceiveComponent
/home/jeremy/Documents/LEGATO_Apps/SMS/build_sms/ar7/staging/lib/libReceiveComponent.so )
run: (sms)[/quote]

So when i run the compiler : (with make ar7)

[code]# Location of legato.h and le_sms.h
includes := -i ~/Documents/LEGATO/legato-AlphaB-r1/interfaces/modemServices/c
includes += -i ~/Documents/LEGATO/legato-AlphaB-r1/framework/c/inc

Path to le_sms.c and le_pos.c (I use le_pos.c function, le_pos_get2DLocation)

sources := -c ~/Documents/LEGATO/legato-AlphaB-r1/components/modemServices/implementation/src/le_sms.c
sources += -c ~/Documents/LEGATO/legato-AlphaB-r1/components/positioning/implementation/src/le_pos.c

mkapp sms.adef -t $@ $(sources) $(includes) -v

I got this as a response :

VirtualBox:~/Documents/LEGATO_Apps/SMS$ make ar7 mkapp sms.adef -t ar7 -c ~/Documents/LEGATO/legato-AlphaB-r1/components/modemServices/implementation/src/le_sms.c -c ~/Documents/LEGATO/legato-AlphaB-r1/components/positioning/implementation/src/le_pos.c -i ~/Documents/LEGATO/legato-AlphaB-r1/interfaces/modemServices/c -i ~/Documents/LEGATO/legato-AlphaB-r1/interfaces/positioning/c -i ~/Documents/LEGATO/legato-AlphaB-r1/framework/c/inc -v Creating executable 'sms'. Default component for 'sms' is 'smsDefault'. Parsing './ReceiveComponent/Component.cdef' Added 'ReceiveComponent' (component) to executable 'sms'. Added '~/Documents/LEGATO_Apps/SMS/build_sms/ar7/staging/lib/libsmsDefault.so' (library) to executable 'sms'. Added '~/Documents/LEGATO_Apps/SMS/build_sms/ar7/staging/lib/libReceiveComponent.so' (library) to executable 'sms'. -- start of processes section -- Will start process 'sms' using command line: "/bin/sms" Fault action: restart Watchdog action: restart **WARNING: Watchdog not yet implemented. -- end of processes section -- Creating working directories under './build_sms/ar7'. Generating startup code for 'sms' in './build_sms/ar7/work/_sms_main.c'. Building component library './build_sms/ar7/staging/lib/libReceiveComponent.so'. /opt/swi/y14-ext/tmp/sysroots/x86_64-linux/usr/bin/armv7a-vfp-neon-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc -o ./build_sms/ar7/staging/lib/libReceiveComponent.so -shared -fPIC -Wall -Werror -I~/Documents/LEGATO/legato-AlphaB-r1/interfaces/modemServices/c -I~/Documents/LEGATO/legato-AlphaB-r1/interfaces/positioning/c -I~/Documents/LEGATO/legato-AlphaB-r1/framework/c/inc -I. -I$LEGATO_ROOT/framework/c/inc -DLEGATO_COMPONENT=ReceiveComponent -DLE_LOG_SESSION=ReceiveComponent_LogSession -DLE_LOG_LEVEL_FILTER_PTR=ReceiveComponent_LogLevelFilterPtr "-DCOMPONENT_INIT=void _ReceiveComponent_Init_Function()" "./ReceiveComponent/receive_sms.c" Building component library './build_sms/ar7/staging/lib/libsmsDefault.so'. /opt/swi/y14-ext/tmp/sysroots/x86_64-linux/usr/bin/armv7a-vfp-neon-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc -o ./build_sms/ar7/staging/lib/libsmsDefault.so -shared -fPIC -Wall -Werror -I~/Documents/LEGATO/legato-AlphaB-r1/interfaces/modemServices/c -I~/Documents/LEGATO/legato-AlphaB-r1/interfaces/positioning/c -I~/Documents/LEGATO/legato-AlphaB-r1/framework/c/inc -I. -I$LEGATO_ROOT/framework/c/inc -DLEGATO_COMPONENT=smsDefault -DLE_LOG_SESSION=smsDefault_LogSession -DLE_LOG_LEVEL_FILTER_PTR=smsDefault_LogLevelFilterPtr "-DCOMPONENT_INIT=void _smsDefault_Init_Function()" "./build_sms/ar7/work/_sms_main.c" Linking executable './build_sms/ar7/staging/bin/sms'. /opt/swi/y14-ext/tmp/sysroots/x86_64-linux/usr/bin/armv7a-vfp-neon-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc -o ./build_sms/ar7/staging/bin/sms -L./build_sms/ar7/staging/lib -L./build_sms/ar7/staging/lib -L./build_sms/ar7/staging/lib -lsmsDefault -lReceiveComponent -L$LEGATO_ROOT/build/ar7/bin/lib -llegato ~/Documents/LEGATO_Apps/SMS/build_sms/ar7/staging/lib/libsmsDefault.so ~/Documents/LEGATO_Apps/SMS/build_sms/ar7/staging/lib/libReceiveComponent.so -lpthread -lrt ./build_sms/ar7/staging/lib/libReceiveComponent.so: undefined reference to `le_sms_msg_GetSenderTel' ./build_sms/ar7/staging/lib/libReceiveComponent.so: undefined reference to `le_pos_Get2DLocation' ./build_sms/ar7/staging/lib/libReceiveComponent.so: undefined reference to `le_sms_msg_GetFormat' ./build_sms/ar7/staging/lib/libReceiveComponent.so: undefined reference to `le_sms_msg_AddRxMessageHandler' ./build_sms/ar7/staging/lib/libReceiveComponent.so: undefined reference to `le_sms_msg_GetUserdataLen' ./build_sms/ar7/staging/lib/libReceiveComponent.so: undefined reference to `le_sms_msg_DeleteFromStorage' ./build_sms/ar7/staging/lib/libReceiveComponent.so: undefined reference to `le_sms_msg_GetText' collect2: error: ld returned 1 exit status ** ERROR: Command execution failure, exit code: 256. make: *** [ar7] Error 1

It looks like the compiler doesn’t include the source files (le_sms.c, le_pos.c)

Did anybody have the same problem ? How can I get the compiler to include the c file into the library ?


You’re not supposed to compile those modem services and positioning implementation files into your app. When you build the framework for the ar7, it will build the appropriate modem services and positioning implementation files into libraries. Those libraries then get used by the “Modem Services Daemon” and “Positioning Daemon” on-target. Those daemon processes export IPC-based APIs for you to use to talk to them, and it’s THOSE APIS that you should be using in your app. To get access to the API exported by the Modem Services Daemon you need to link your executable with two libraries: lible_mdm_client.so and lible_data_client.so.

Have a look at apps/sample/alphaBDemo for an example of how to use the APIs that the Modem Services Daemon exports to you. In fact, I recommend starting with a copy of that demo app and strip out the stuff you don’t need.

Also, BTW, you don’t need to include your own component’s libraries (/home/jeremy/Documents/LEGATO_Apps/SMS/build_sms/ar7/staging/lib/libsmsDefault.so and /home/jeremy/Documents/LEGATO_Apps/SMS/build_sms/ar7/staging/lib/libReceiveComponent.so) in the executables in your .adef file. The mkapp tool is smart enough to know what libraries get generated for your components and automatically includes them in the link stage.

Hopefully this stuff will become clearer in the Beta release. I think there are some documentation pages that will better explain how to build an application that uses modem and positioning services.


Thanks for your answer, it becomes clearer now! In fact, at first, I used the libraries like you advised me to do. But I couldn’t find any documentation on the contents of the libraries stored into [quote]~/Documents/LEGATO/legato-AlphaB-r1/build/ar7/staging/usr/local/lib[/quote]
So I don’t really know which one I have to use for a given application.

For example, I tried to use the Audio API’s (pick/hang up a call) so I added those libraries :

executables: audio ( audio.c ~/Documents/LEGATO/legato-AlphaB-r1/build/ar7/staging/usr/local/lib/lible_pa_audio.so ~/Documents/LEGATO/legato-AlphaB-r1/build/ar7/staging/usr/local/lib/lible_audio_services.so ~/Documents/LEGATO/legato-AlphaB-r1/build/ar7/staging/usr/local/lib/lible_mdm_client.so ) import: /usr/local/lib/lible_pa_audio.so /lib/ /usr/local/lib/lible_audio_services.so /lib/ /usr/local/lib/lible_mdm_client.so /lib/

The application compile with mkapp with no problem, but when I download the application on the board, I got this error message:

[quote] INFO | 70/01/01 - 00:13:34.953.115 | supervisor 893 main supervisor | proc.c proc_Start 605 | Starting process audio with pid 965

/bin/audio: error while loading shared libraries: libalsa_intf.so.1: cannot open shared object file: No such file or directory

INFO | 70/01/01 - 00:13:34.961.508 | supervisor 893 main supervisor | proc.c proc_SigChildHandler 869 | Process ‘audio’ (PID: 965) has exited with exit code 127.[/quote]

However if I search the library into legato’s framework :

VirtualBox:~/Documents/LEGATO/legato-AlphaB-r1/build/ar7/staging/usr/local/lib$ grep libalsa_intf.so.1 *.so Binary file lible_audio_services.so matches Binary file lible_mdm_services.so matches Binary file lible_pa_audio.so matches

I’m a bit lost because I included lible_audio_services.so and lible_pa_audio.so.
Did i add the correct libraries ?

Also, which libraries do i need to import if i want to use:
- the Data Connection Services API ?
- the Modem Remote Management API ?
- the Modem API’s ? (are they all contained into lible_mdm_client.so and lible_data_client.so ?)


Hello Arnaud,
Every services provided by Legato must be imported like Jen explained for the modem services.

In your audio client app, you must import the lible_audio_client.so, not the lible_pa_audio.so neither the lible_audio_services.so.

Modem Remote Management API are not yet available; I confess that there is a lack of documentation.

The Data Connection services can be imported in a User app by using lible_data_client.so.

I hope this help.



Thanks for helping me sorting this out.

Although, I can’t find any lible_audio_client in the legato framework (legato-AlphaB-r1 directory).
Can you tell me the path to this library ?

Thanks by advance,

Indeed … it appears that in the AlphaB, there is no le_audio_client.
Audio as a service will be available in the next release, but it is not available in AlphaB.

Given that, I think that if you instanciate audio services twice, by linking with the lible_audio_services.so & lible_pa_audio.so, the two instances would potentially conflict at runtime.

However, you can use this to develop your application while waiting for the next release, which should be available quite soon.
If you want to actually run the application, you can eventually run it unsandboxed or bind libraries in the sandbox (through adef) until it is able to start (from what I see, it should be only dependent on libalsa_intf.so.1). It’s possible it would be able to start, but I’m not 100% sure about that.

14.04 release is now published, and audio is supported. Associated libraries can be found in this path: