How to cross-compile libconfig for OpenWrt?

I'm doing cross-compilation for an OpenWrt system. To this system I can trasnfer an executable file (a .exe from a C compiling). Anyway in this .c file I use libconfig, so, when I do cross-compilation, the libconfig function are not recognized. Obviously, I can't install libconfig on the target system beacause of memory problema. Can you help me? Is there any guide or any thread reguarding this problem? Thank you so much!

OpenWrt has a libconfig library, https://openwrt.org/packages/pkgdata/libconfig11 it is just 15kb, it should fit in most devices

Are you using OpenWrt's libconfig?

2 Likes

I apologize, I explained the problem incorrectly. the problem is that I can't compile the program to be transferred to the target system if I don't have libconfig inside the toolchain. Even if I installed libconfig for the target system, I still would not be able to compile the .exe to transfer to the target system.

are you using OpenWrt build system (and toolchain)?

If you are using your own toolchain I have no idea.

If you are using OpenWrt build system and make a package that needs libconfig, that library will be downloaded, crosscompiled and used for crosscompile your package.

see here a tutorial to set up the build system and create a package for your program so that the OpenWrt toolchain will pull down dependencies and use them to cross-compile

in the package makefile where the guide writes

define Package/helloworld
  SECTION:=examples
  CATEGORY:=Examples
  TITLE:=Hello, World!
endef

you should modify to

define Package/helloworld
  SECTION:=examples
  CATEGORY:=Examples
  TITLE:=Hello, World!
  DEPENDS:=+libconfig 
endef

or

define Package/helloworld
  SECTION:=examples
  CATEGORY:=Examples
  TITLE:=Hello, World!
  DEPENDS:=+libconfig11 
endef

depending on what libconfig package has the right library