Question: I was wondering why executables (written in c++) have to be recompiled from sources on every linux machine, even if the machines are software and hardware the same?

I had a search engine, written in c++, and I have to recompile it every time I want to move it on a new linux machine to make it work.

Any ideas?

Answer: 
If you are asking why an executable compiled on Linux-X won't run on Linux-Y, then the reason is probably that dynamic libraries (.so) are missing or could not be found. 

EDIT: oh sorry, looks like I didn't read your question well enough. Removed the sarcasm.
This is not necessarily the case. Consider how Ubuntu packages are installed for example - <https://askubuntu.com/questions/162477/how-are-packages-actually-installed-via-apt-get-install> 

Apparently these are not compiled from source on the destination machine, but installed as pre-built binaries. Having said that, it is generally a good idea to build binaries from source on the machine that they will run on as you will avoid potential problems such having incompatible shared libraries (such as libc) which can occur when building something on Linux X and running on Linux Y.