How to compare binaries

I have the same two source files. They MUST be compiled with -g debugger option. The binaries are different. But in fact the binaries work the same. How to compare them to know the are compiled using the same source code. In Linux it is enough to: strip --strip-all <file> and diff shows no difference between binaries, what is what I need. It seems stripping in Solaris does not work for me.

Regards,
Mariusz

Why are the binaries different if the same source code is compiled with the same compiler options ?

Hopefully !

Did you try "gstrip --strip-all" with Solaris ?

When compiled with "-g" option, binaries are different because they contain e.g. paths to the source. So if the code is compiled in two different directories, the binaries differ.

The system does not have gstrip.

So my question is how to find out that the binaries are created from the same source.