Undefined reference when using mksys, but not mkapp

I found that the problem is in .cdef, you cannot add

requires:
{
   lib:
    {
       ../third-party/lib/libsqlite3.so

    }
} 

Otherwise, it will have multiple definition problem during compilation in R16 package.
(not quite understand the root cause as no problem is found for compilation in R13 package)

As you mentioned above, you need to add “-L $(CURDIR)/…/third-party/lib/libsqlite3.so” in Makefile for mkapp.

However, for mksys, I don’t know where to add such “-L $(CURDIR)/…/third-party/lib/libsqlite3.so”…

But on my side, I can modify the .cdef file and .adef file to add the following:

.cdef:
requires:
{
 lib:
    {
 
	sqlite3
    }
}
	
.adef:
bundles:
{
	file:
	{
	/home/owner/leaf/leaf-data/wp76/wp76-toolchain/sysroots/armv7a-neon-poky-linux-gnueabi/usr/lib/libsqlite3.so  /lib/
  /home/owner/leaf/leaf-data/wp76/wp76-toolchain/sysroots/armv7a-neon-poky-linux-gnueabi/usr/lib/libsqlite3.so.0  /lib/


	}
}
	

It will use the libsqlite3.so in toolchain.
And it works for me to embed this testsql application in legato.cwe by adding the application in wifi.sdef.

By using the libsqlite3.so already in toolchain and following your example of .cdef and .adef, I dont have to include the libsqlite3 path in the makefiles. This actually made mksys work aswell. Did not know about the sqlite3 library in toolchain, thank you so much for your help!

When I am using the method which worked with mksys, it seems like I cant update the target. It tries several times but rolls back to last “good version”. Sometimes it seems like the target is updated, but the behavior doesnt work and and commands like “cm info” makes broken pipe. I cant even update with the main app (mkapp), which actually worked with my first way of adding sqlite3. Do you know why it behaves like this?

you can build it without this app (i.e. sqlite3 app)
this can confirm if problem is coming from your new application

I am able to build the other apps and also an older version (which does not contain sqlite) of the app which now contains sqlite. So it seems like the problem is coming from sqlite.

then next step you can set
“start:manual” in adef
This will not auto start the application when power on
See if this is ok

You can also try my legato.cwe on top of WP76xx R16.
It will integrate the testsql application which contains sqlite3:
legato_19.11.2_testsql.cwe.7z (5.6 MB)

I tried “start: manual”. I can now see that the app is stopped so it seems like it updated. The commands are also working. Legato status gives good and tried 1, but this is should be ok, or? Legato framework is running.

Lost connection when I tried to start the app, broken pipe. It goes back to the version where the app is stopped. I will try your cwe soon.

Your legato.cwe works fine, and testsql runs when I started it manually. How do you include sqlite3 (.cdef, .adef…)?

here is my application:
testsql.7z (3.8 KB)

Hmm, mine looks basically the same. What command did you use to make the cwe file? I am using systocwe on a system that consists of 3 apps.

i modify the wifi.sdef to add the application.

For compilation, i just type “make wp76xx” in leaf shell

I will try to add the application to wifi.sdef then, I am using a custom sdef. If I add the application in wifi.sinc, will the result be the same? wifi.sinc is included in wifi.sdef. It still disconnects, “broken pipe”, when I start the app.

I modify wifi.sdef to add testsql application
i don’t know if it is the same for wifi.sinc, you need to make some test

Here is the script I try to use to build my system which consists of three custom apps.

#App .zip
make clean
make wp76xx
av-pack -u sqliteCode.wp76xx.update -b _build_sqliteCode/wp76xx -t ew.nah.sqliteCode
cd ~/workspace/apps/webhost-app
make clean
make wp76xx
av-pack -u webhost.wp76xx.update -b _build_webhost/wp76xx -t ew.nah.webhost
cd ~/workspace/apps/avccontrol
make clean
make wp76xx
av-pack -u avcControl.wp76xx.update -b _build_avcControl/wp76xx -t ew.nah.avcControl
pause "Apps ready. Upload to airvantage (Press ENTER to continue)"

#update file
cd ~/workspace/system
make clean
make system_wp76xx
pause "Upload system.wp76xx.update to local gateway to test (Press ENTER to continue)"
update system.wp76xx.update 192.168.2.2

#.spk
systocwe wp76xx system.wp76xx.update build_system_"$version"_"$FW"_"$LE"
mv ~/workspace/system/system.wp76xx.update ~/workspace/system/$module/"$FW"/system_"$FW"_"$LE".wp76xx.update
mv build_system_"$version"_"$FW"_$LE/legato-squashfs.ubi.cwe $module/"$FW"/legato-squashfs.ubi.cwe
cd $module/$FW
ModemFW=`ls 99*.spk`
LinuxDist=`ls linux*.cwe`
swicwe -o system_"$FW"_"$version".spk -c $ModemFW $LinuxDist legato-squashfs.ubi.cwe

#Baseline legato system for AV
mv ~/workspace/system/$module/"$FW"/legato-squashfs.ubi.cwe ~/workspace/system/$module/"$FW"/main/legato.cwe
myfilesize=$(wc -c ~/workspace/system/$module/"$FW"/main/legato.cwe | awk '{print $1}')
MAXFILESIZE=8700000
if ((myfilesize > MAXFILESIZE))
then 
   printf "legato.csw bigger than %d bytes!!\n" $MAXFILESIZE
fi
printf "legato.csw is %d bytes\n" "$myfilesize"
sed "s/project/$name/g; s/GW/$FW/g; s/appversion/$LE/g; s/firmwareversion/"$FW"_"$name"/g; s/legatoversion/"$LE"/g" ~/workspace/system/$module/"$FW"/manifest.app > ~/workspace/system/$module/"$FW"/main/manifest.app
zip -r system_"$FW"_"$version"_"$LE".zip main 
sed "s/GW/$FW/g; s/legatoversion/"$LE"/g" ~/workspace/system/$module/"$FW"/model.app > ~/workspace/system/$module/"$FW"/firmware_definition/model.app
zip -r firmware_definition_"$FW"_"$version""$LE".zip firmware_definition 

what is the problem then?
Have you tried to modify wifi.sdef to add testsql application?

Im not sure, yes I have tried that. Thanks for all the help, I will keep trying