Thanks zo0ok, your reply made the solution clearer.
Anyway, today I ran the "make menuconfig" and added the following packages to the cross-compiling environment:
Libraries -> I selected libpng;
Kernel Modules -> Libraries -> I selected kmod-lib-zlib;
Video Support -> kmod-video-core -> kmod-video-uvc.
I tried to cross-compile my application again since now I added libpng to the cross-compiling environment, and this is what happened:
daniele@debian:~/Scaricati$ mips-openwrt-linux-uclibc-gcc ScattaFoto.c
ScattaFoto.c:19:17: fatal error: png.h: No such file or directory
compilation terminated.
So I decided to search for the png.h file and include its directory with the -I option. First, I searched for it:
daniele@debian:~/Scaricati$ sudo find / -name 'png.h'
[sudo] password for daniele:
/usr/local/include/png.h
/usr/local/include/libpng12/png.h
/usr/include/png.h
/usr/include/libpng12/png.h
/home/daniele/.local/share/Trash/files/png.h
/home/daniele/openwrt/openwrt/build_dir/target-mips_r2_uClibc-0.9.33.2/libpng-1.2.46/ipkg-install/usr/include/ png.h
/home/daniele/openwrt/openwrt/build_dir/target-mips_r2_uClibc-0.9.33.2/libpng-1.2.46/ipkg-install/usr/include/libpng12/png.h
/home/daniele/openwrt/openwrt/build_dir/target-mips_r2_uClibc-0.9.33.2/libpng-1.2.46/png.h
/home/daniele/openwrt/openwrt/staging_dir/target-mips_r2_uClibc-0.9.33.2/usr/include/png.h <--- Here it is.
/home/daniele/openwrt/openwrt/staging_dir/target-mips_r2_uClibc-0.9.33.2/usr/include/libpng12/png.h
/home/daniele/Scaricati/libpng-1.2.52/png.h
Then I added it in the -I option and:
daniele@debian:~/Scaricati$ mips-openwrt-linux-uclibc-gcc -I/home/daniele/openwrt/openwrt/staging_dir/target-mips_r2_uClibc-0.9.33.2/usr/include ScattaFoto.c
/tmp/ccbQj34c.o: In function `salvaImmaginePNG':
ScattaFoto.c:(.text+0x1544): undefined reference to `png_create_write_struct'
ScattaFoto.c:(.text+0x1590): undefined reference to `png_create_info_struct'
ScattaFoto.c:(.text+0x15c8): undefined reference to `png_destroy_write_struct'
ScattaFoto.c:(.text+0x1634): undefined reference to `png_destroy_write_struct'
ScattaFoto.c:(.text+0x1654): undefined reference to `png_free_data'
ScattaFoto.c:(.text+0x1680): undefined reference to `png_init_io'
ScattaFoto.c:(.text+0x16d8): undefined reference to `png_destroy_write_struct'
ScattaFoto.c:(.text+0x16f8): undefined reference to `png_free_data'
ScattaFoto.c:(.text+0x1744): undefined reference to `png_set_IHDR'
ScattaFoto.c:(.text+0x179c): undefined reference to `png_destroy_write_struct'
ScattaFoto.c:(.text+0x17bc): undefined reference to `png_free_data'
ScattaFoto.c:(.text+0x17e8): undefined reference to `png_write_info'
ScattaFoto.c:(.text+0x1844): undefined reference to `png_destroy_write_struct'
ScattaFoto.c:(.text+0x1864): undefined reference to `png_free_data'
ScattaFoto.c:(.text+0x1954): undefined reference to `png_destroy_write_struct'
ScattaFoto.c:(.text+0x1974): undefined reference to `png_free_data'
ScattaFoto.c:(.text+0x19ac): undefined reference to `png_write_row'
ScattaFoto.c:(.text+0x1a28): undefined reference to `png_destroy_write_struct'
ScattaFoto.c:(.text+0x1a48): undefined reference to `png_free_data'
ScattaFoto.c:(.text+0x1a80): undefined reference to `png_write_end'
ScattaFoto.c:(.text+0x1a94): undefined reference to `png_destroy_write_struct'
ScattaFoto.c:(.text+0x1ab4): undefined reference to `png_free_data'
collect2: ld returned 1 exit status
This is the same error I got when I tried to compile my application with Debian's gcc. So it is not a problem: I can solve it just adding the -L option to the cross-compiler:
4)daniele@debian:~/Scaricati$ mips-openwrt-linux-uclibc-gcc -I/home/daniele/openwrt/openwrt/staging_dir/target-mips_r2_uClibc-0.9.33.2/usr/include -L/home/daniele/openwrt/openwrt/staging_dir/target-mips_r2_uClibc-0.9.33.2/usr/lib -lpng ScattaFoto.c
/home/daniele/openwrt/openwrt/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/lib/gcc/mips-openwrt-linux-uclibc/4.6.3/../../../../mips-openwrt-linux-uclibc/bin/ld: warning: libz.so.1, needed by /home/daniele/openwrt/openwrt/staging_dir/target-mips_r2_uClibc-0.9.33.2/usr/lib/libpng.so, not found (try using -rpath or -rpath-link)
/home/daniele/openwrt/openwrt/staging_dir/target-mips_r2_uClibc-0.9.33.2/usr/lib/libpng.so: undefined reference to `deflate'
/home/daniele/openwrt/openwrt/staging_dir/target-mips_r2_uClibc-0.9.33.2/usr/lib/libpng.so: undefined reference to `inflate'
/home/daniele/openwrt/openwrt/staging_dir/target-mips_r2_uClibc-0.9.33.2/usr/lib/libpng.so: undefined reference to `inflateInit_'
/home/daniele/openwrt/openwrt/staging_dir/target-mips_r2_uClibc-0.9.33.2/usr/lib/libpng.so: undefined reference to `crc32'
/home/daniele/openwrt/openwrt/staging_dir/target-mips_r2_uClibc-0.9.33.2/usr/lib/libpng.so: undefined reference to `deflateInit2_'
/home/daniele/openwrt/openwrt/staging_dir/target-mips_r2_uClibc-0.9.33.2/usr/lib/libpng.so: undefined reference to `inflateReset'
/home/daniele/openwrt/openwrt/staging_dir/target-mips_r2_uClibc-0.9.33.2/usr/lib/libpng.so: undefined reference to `deflateReset'
/home/daniele/openwrt/openwrt/staging_dir/target-mips_r2_uClibc-0.9.33.2/usr/lib/libpng.so: undefined reference to `inflateEnd'
/home/daniele/openwrt/openwrt/staging_dir/target-mips_r2_uClibc-0.9.33.2/usr/lib/libpng.so: undefined reference to `deflateEnd'
collect2: ld returned 1 exit status
This is weird, it never happens when I try to compile the application with gcc...
So I searched for libz.so.1:
daniele@debian:~/Scaricati$ sudo find / -name 'libz.so.1'
/usr/local/lib/libz.so.1
/lib/i386-linux-gnu/libz.so.1
/home/daniele/openwrt/openwrt/build_dir/target-mips_r2_uClibc-0.9.33.2/root-ar71xx/usr/lib/libz.so.1
/home/daniele/openwrt/openwrt/build_dir/target-mips_r2_uClibc-0.9.33.2/zlib-1.2.7/ipkg-install/usr/lib/libz.so.1
/home/daniele/openwrt/openwrt/build_dir/target-mips_r2_uClibc-0.9.33.2/zlib-1.2.7/ipkg-ar71xx/zlib/usr/lib/libz.so.1
/home/daniele/openwrt/openwrt/build_dir/target-mips_r2_uClibc-0.9.33.2/zlib-1.2.7/libz.so.1
/home/daniele/openwrt/openwrt/staging_dir/target-mips_r2_uClibc-0.9.33.2/usr/lib/libz.so.1 <---Maybe this one?
/home/daniele/openwrt/openwrt/staging_dir/target-mips_r2_uClibc-0.9.33.2/root-ar71xx/usr/lib/libz.so.1
/home/daniele/Scaricati/zlib-1.2.8/libz.so.1
How could the cross-compiler not find it? I wonder where does the cross-compiler search for the libraries and header files...