>Is there any way to create binaries that work for all distributions?
No, clearly :)
>Because I have a shared web hosting and have no direct access to compile
can you trygcc -o a.cgi a.c
to create your own a.cgi. maybe most shared web hosting provide gcc nowadays?