# Undefined reference when using mksys, but not mkapp

**URL:** <https://forum.legato.io/t/undefined-reference-when-using-mksys-but-not-mkapp/6550>\
**Category:** Uncategorized\
**Created:** [July 13, 2023, 1:59pm UTC](https://forum.legato.io/t/undefined-reference-when-using-mksys-but-not-mkapp/6550 "2023-07-13T13:59:08Z")\
**Posts on this page:** 1\
**Showing post:** 21

<div class="post-metadata">

**Author:** ![jyijyi](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/jyijyi/32/822_2.png) [@jyijyi](https://forum.legato.io/u/jyijyi)\
**Post date:** [July 17, 2023, 11:26am UTC](https://forum.legato.io/t/undefined-reference-when-using-mksys-but-not-mkapp/6550/21 "2023-07-17T11:26:54Z")

</div>

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

```auto
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:

```auto
.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.

---

_[View the full topic](https://forum.legato.io/t/undefined-reference-when-using-mksys-but-not-mkapp/6550)._
