title: glib in cross compiling for raspberry pi c
body: <p>I'm trying to compile a program with glib. I set up all the include paths so compilation goes through without errors but linker can't find glib.</p>
  
  <pre><code>Invoking: Cross GCC Linker
  arm-linux-gnueabihf-gcc -L/home/ja/raspberrypi/rootfs/usr/local/lib -L/home/ja/raspberrypi/rootfs/lib/arm-linux-gnueabihf  -o "daemon_test"  ./src/gpio/gpio.o  ./src/can/can_stuff.o ./src/can/libsocketcan.o  ./src/daemon_test.o   -lglib-2.0 -lwiringPi
  /home/ja/raspberrypi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/../lib/gcc/arm-linux-gnueabihf/4.8.3/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lglib-2.0
  makefile:32: recipe for target 'daemon_test' failed
  collect2: error: ld returned 1 exit status
  make: *** [daemon_test] Error 1
  </code></pre>
  
  <p>I have a cross compiler set up for my raspberry pi. it's composed of eclipse and a gcc compiler running on debian.</p>
  
  <p>it seems obvious that the linker can't find the proper file.
  On my target raspberry pi I've installed libglib2.0-dev and a test program builds fine. So I used rsync to update my cross compiler's rootfs</p>
  
  <pre><code>rsync -rl --delete-after --safe-links pi@192.168.2.160:/{lib,usr,opt} $HOME/raspberrypi/rootfs
  </code></pre>
  
  <p>my include paths are set to the same values as come out from pkg-config on my rpi(adjusted for rootfs location)</p>
  
  <pre><code>pkg-config --libs --cflags glib-2.0
  </code></pre>
  
  <p>as I was writing this I did a search for "libglib" on both rpi and my cross compiler. there's a libglib-2.0.so on my rpi, but in my crosscompiler it's a libglib-2.0.so.0, they are both same size.</p>
  
  <p>I removed the ".0" and got a new error</p>
  
  <pre><code>warning: libpcre.so.3, needed by /home/ja/raspberrypi/rootfs/lib/arm-linux-gnueabihf/libglib-2.0.so, not found (try using -rpath or -rpath-link)
  </code></pre>
  
  <p>and a bunch of undefined refferences. the thing is, that file exists in the same location as libglib-2.0.so(renamed form libglib-2.0.so.0) </p>
  
  <pre><code>-L/home/ja/raspberrypi/rootfs/lib/arm-linux-gnueabihf 
  </code></pre>
  
  <p>anyone has any ideas what to do? I spent my whole day on this..</p>