Hi,
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 :
[quote]
executables:
sms ( ReceiveComponent
/home/jeremy/Documents/LEGATO_Apps/SMS/build_sms/ar7/staging/lib/libsmsDefault.so
/home/jeremy/Documents/LEGATO_Apps/SMS/build_sms/ar7/staging/lib/libReceiveComponent.so )
processes:
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
ar7:
mkapp sms.adef -t $@ $(sources) $(includes) -v
[/code]
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 ?
Regards,