# How to link third-party static library

**URL:** <https://forum.legato.io/t/how-to-link-third-party-static-library/4142>\
**Category:** Uncategorized\
**Created:** [February 25, 2019, 6:28pm UTC](https://forum.legato.io/t/how-to-link-third-party-static-library/4142 "2019-02-25T18:28:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![nicolaas](https://avatars.discourse-cdn.com/v4/letter/n/db5fbb/32.png) [@nicolaas](https://forum.legato.io/u/nicolaas)\
**Post date:** [February 25, 2019, 6:28pm UTC](https://forum.legato.io/t/how-to-link-third-party-static-library/4142/1 "2019-02-25T18:28:06Z")

</div>

I have searched Hi and Low and cannot find a example of how to link a third-party static library in a legato application , the reason I am in this scenario is because the only library I do have and can compile is a static library. Any Help or advice would be appreciated .

---

<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:** [February 26, 2019, 1:24am UTC](https://forum.legato.io/t/how-to-link-third-party-static-library/4142/2 "2019-02-26T01:24:14Z")

</div>

Did you try adding the following in .cdef file:

* * *

bundles:  
{  
file:  
{  
[rx] /home/owner/Downloads/libmodule.so /lib/  
}  
}  
requires: {  
lib: {  
/home/owner/Downloads/libmodule.so  
}

* * *

For more information, please see:

> [@How to link an .so to a legato project](https://forum.legato.io/t/how-to-link-an-so-to-a-legato-project/2597/10):
>
> Hi @karlkuhn Just made the test. Sounds like it comes from the “.1.0” extension suffix… GCC (at least the version embedded in the Legato toolchain) apparently requires simple .so files (without extra extension) when working with -l option. Could you give a try by renaming the .so.1.0 file to a simple .so? Another possibility (if you don’t want to rename the file) would be to specify the full file name in an ldflags section, without any option, so than ld takes it directly as an input. ldfl…

---

<div class="post-metadata">

**Author:** ![nicolaas](https://avatars.discourse-cdn.com/v4/letter/n/db5fbb/32.png) [@nicolaas](https://forum.legato.io/u/nicolaas)\
**Post date:** [February 26, 2019, 9:24am UTC](https://forum.legato.io/t/how-to-link-third-party-static-library/4142/3 "2019-02-26T09:24:18Z")

</div>

Hi Guys thanks for the reply but it was quite simple linking a third party static library eg. azure iot client.

ldflags:  
{  
-lssl → shared library  
-lcrypto → shared library  
-L $CURDIR/third-party/lib → PATH of static third party libs  
-liothub\_client → static  
-liothub\_client\_mqtt\_transport → static  
-liothub\_client\_mqtt\_ws\_transport – static  
-laziotsharedutil – static  
-lserializer – static  
-lumqtt – static  
}
