-1

I am working on a project where in I create a C library(compiled through Makefile), then I write another C program (that uses the above C library ) and compile. I did all the above in a linux x86_64 system and it worked. Unfortunately I had to do all these things in a device that uses openwrt environment.Having not been too familiar with openwrt, what I did is placed the library that i created in linux, in openwrt's lib folder and tried to compile it, but because the architecture of linux of openwrt is not same, it threw the following error

could not read symbols: File format not recognized

Now, my question is. How can i create the above library for openwrt environment. Do I need to use a makefile, a cross compiler(if yes, which one) or use some other option?

kewal
  • 39
  • 9

1 Answers1

0

From the wikipedia page of OpenWrt (https://en.wikipedia.org/wiki/OpenWrt):

The OpenWrt build system ...

Provides an integrated cross-compiler toolchain (gcc, ld, uClibc etc.)

so yes, you need to cross compile, please follow the instructions at:

https://wiki.openwrt.org/doc/devel/crosscompile

However, You will need to know the architecture of your OpenWrt box ...

Ferenc Deak
  • 34,348
  • 17
  • 99
  • 167
  • I tried using a cross compiler, but it's not apparently recognizing the makefile that I have written to compile the library. Is there any specific way to write makefile for openwrt cross compilers? – kewal Apr 14 '16 at 10:25
  • @kewal please share with us the makefile and how you are trying to use it on the more eyes see more principle ... – Ferenc Deak Apr 14 '16 at 10:40
  • I am using a device cloudgate that has openwrt. The device comes with an sdk, that cross compiles my code for the device.I simply placed my makefile and other relevant codes in that sdk.When i tried running make menuconfig, my package was not in the list of options(this is how i guessed it might not be recognizing my makefile) I am not at liberty to share the makefile yet, isn't there any generic way (set of instructions or rule) to write makefile for openwrt? – kewal Apr 14 '16 at 10:52