How to add a library to Arduino Yun cross-compiling environment?

Hi everybody, I'm writing a simple application for Arduino Yun which captures a picture with a USB Webcam (using the UVC driver) and saves it in a microSD memory in PNG or JPEG file format (using libpng or libjpeg). I've set up a cross compile environment for Yun by following this guide. I've created a virtual machine with virtualbox and installed Debian 8.0 on it. I installed all the software required to download and compile the OpenWRT-Attitude Adjustment version (which, I think, is the version used by Arduino Yun) on Debian. So, I've downloaded the OpenWRT source code, downloaded its packages feed (with "git clone git://git.openwrt.org/12.09/packages.git"), downloaded and installed all available "feeds" (with: "./scripts/feeds update -a" "./scripts/feeds install -a") and then compiled it with: "make defconfig" "make prereq" and "make menuconfig". When I typed in "make menuconfig", a graphical interface prompted. In that interface I selected: Target System: (Atheros AR7xx/AR9xx); Base System: I selected libc, libcc and marked as package libpthread and librt. I left any other option as default. Then I compiled all with "time make V=99" command. After about 2 hours, the compiling finished and I set the environment variables as the above mentioned guide described. Looks like now I can compile any C code with this cross-compiler. Anyway, my application includes the png.h header in order to use the libpng library, and every time I try to cross-compile it, a "png.h not found" error pops up during the process. So I tried to cross-compile the libpng library but when I ran "./configure" with the options for cross-compiling, it failed saying that zlib wasn't installed. So I downloaded the zlib library source code but looks like I can't cross-compile it. Eventually I compiled zlib and libpng normally on Debian and now, when I try to cross-compile my application, it still says that it can't find png.h... So, how can I "integrate" the libpng library to the cross-compiling environment? Sorry for this long question, but it is all I've done today. As always, I thank you for any help you can give me.

Hey…I saw your post because I'm trying to cross-compile a library that isn't available in

opkg list

.

But if you ssh into your Yun and type

opkg list | grep "libjpeg"

You will get the satisfying result:

libjpeg - 6b-1 - The Independent JPEG Group's JPEG runtime library

Similarly for

opkg list | grep "libpng"

you will find that:

libpng - 1.2.46-2 - A PNG format files handling library

So you can install both of these with the Yun Package manager.

Save image without cross-compiling:

  1. Use fswebcam to save jpeg/png file:

http://forum.arduino.cc/index.php?topic=253571.0

fswebcam  -i 0 -d v4l2:/dev/video0  --jpeg 95  --save test.jpg -S 20 -r 640x480
  1. "mjpg-streamer + output_file.so" Save jpeg file at SD card:

http://forum.arduino.cc/index.php?topic=305773.msg2177034#msg2177034