And, if it is possible, can you please point me to an example of this?
What you are looking for is cross compilation. http://en.wikipedia.org/wiki/Cross_compiler#GCC_and_cross_compilation
As Tomas said, you need the libs of the target machine installed and assuming you are using gcc you will need to use the "-b machine" option, and probably a few other options also (man gcc, and spend a lot of time reading!).
This can be a real pain to get right, so i would ask whether it is really necessary?