1

I'm writing code for a project with Arduino Yun. My project is quite simple: it takes a picture with a webcam and saves it in a PNG or JPEG file format. I've already installed the uvc driver for Arduino Yun and tested it with my webcam and the fswebcam application. The application saved pictures both in PNG and JPEG format successfully, so I went on and installed the C compiler, make and binutils for Arduino Yun and started to write my own application that would do the same thing (just taking a picture and saving it in PNG format). After writing the code to capture the pixels of the image, I decided to write them down in a PNG file format by using the libpng library available for Arduino Yun through luci web control panel. After installing the package, I included the png.h (using #include png.h) in my source code and wrote the code to write those pixels down in a simple PNG file (thanks to this tutorial: http://www.labbookpages.co.uk/software/imgProc/libPNG.html). What's the problem? It just won't compile! I tried everything and all I got were "undefined reference to 'function name here'" errors. I thought that, maybe, libpng was buggy so I moved to libjpeg. No luck! I get the same errors over and over again. I really don't know what else I can do, I tried everything, it just seems that the Arduino Yun C compiler can't handle "external" libraries. I thank you in advance for any help you'll give me...

Here are the errors I get when I try to compile it using the libjpeg library:

/tmp/ccdzMFgN.o: In function `salvaImmagineJPEG':
    ScattaFoto.c:(.text+0x1d9c): undefined reference to `jpeg_std_error'
    ScattaFoto.c:(.text+0x1da8): undefined reference to `jpeg_std_error'
    ScattaFoto.c:(.text+0x1dc8): undefined reference to `jpeg_CreateCompress'
    ScattaFoto.c:(.text+0x1dd4): undefined reference to `jpeg_CreateCompress'
    ScattaFoto.c:(.text+0x1dec): undefined reference to `jpeg_stdio_dest'
    ScattaFoto.c:(.text+0x1df8): undefined reference to `jpeg_stdio_dest'
    ScattaFoto.c:(.text+0x1e2c): undefined reference to `jpeg_set_defaults'
    ScattaFoto.c:(.text+0x1e38): undefined reference to `jpeg_set_defaults'
    ScattaFoto.c:(.text+0x1e54): undefined reference to `jpeg_set_quality'
    ScattaFoto.c:(.text+0x1e60): undefined reference to `jpeg_set_quality'
    ScattaFoto.c:(.text+0x1e78): undefined reference to `jpeg_start_compress'
    ScattaFoto.c:(.text+0x1e84): undefined reference to `jpeg_start_compress'
    ScattaFoto.c:(.text+0x1ed8): undefined reference to `jpeg_write_scanlines'
    ScattaFoto.c:(.text+0x1ee4): undefined reference to `jpeg_write_scanlines'
    ScattaFoto.c:(.text+0x1f10): undefined reference to `jpeg_finish_compress'
    ScattaFoto.c:(.text+0x1f1c): undefined reference to `jpeg_finish_compress'
    collect2: ld returned 1 exit status
0

It's not the compiler, it's the libpng package (and other libraries too). It only contains the runtime shared library (.so) files. You can't use it for development.

I haven't yet found if it's possible to directly install a full development package or not - normally development for OpenWRT is done outside the low-powered chip using a cross-compiler environment on a PC.

  • Thanks for your reply. I actually considered the cross-compiling solution but I let it as last resort. Do you (or does anybody) know how to set up an Arduino Yun cross-compiling environment? Thanks in advance. – Nehil May 25 '15 at 16:15
  • Just follow the OpenWRT instructions for that chip. – Majenko May 25 '15 at 16:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.