How to builid application with third party static library?

i can't find a tutorial about this, i am new to openwrt
now i have the .a file mips library, how to call it by application package(ipk)
or how could i package the .a library to ipk?

Well in order to use static library in application package then you must rebuild that package with this library.

So linking is easy with gcc -lname-of-library -Lpath-to-library

You can see more information here:

Story is short - there are two types of libraries static and shared.
When you build with shared (.so) library then your linker is responsible to making code that link your exec with library. And when exec is started OS loader load library and make magic. Of course this make your exec slimmer, but dependent from external libraries.
But when you build with static (.a) library then your linker get this library and put it on executable. This make your exec bigger, but now doesn't dependent from 3rd party external libraries.

1 Like

You can make static library as an openwrt package, and let application package depend on it.
To save router storage space, you can install nothing of static library package on router.

define Package/lzlib/install
	$(INSTALL_DIR) $(1)/tmp
	touch $(1)/tmp/.lzlib-placeholder

static library package

application package
1 Like