Hi,
What Sergio gave though for arm can be used exactly to compile for Linux for Quark.
If you have an LSB image then you do not need to cross-compile (although it will be really slow).
gcc *should* be installed on the galileo - meaning you can run gcc on the galileo.
Since the openCV libraries are already present, I think, and if you have the headers then you can easily compile on the galileo. It might take 10x longer but it still is easy if you do not want to cross-compile.
As a test,
Log in to your galileo
type echo "main(){}" > a.c
gcc a.c
readelf -f a.out | grep interpreter
you should get some output like {Requesting program interpretor *blah blah* /ld}
OR
cat > a.c << "EOF"
#include<stdio.h>
main()
{
printf("Hi I compiled this on the galileo\n");
return 0;
}
EOF
gcc a.c
./a.out {The output should be the evident}