Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

binary object file changing in each build

Tags:

c++

g++

When compiling using G++ GNU compiler every time I do a build, without changing source code I get a different binary object file. Is there a compile option that will give me the same binary each time.

like image 911
user502603 Avatar asked Nov 10 '10 01:11

user502603


1 Answers

Copied from the GCC man-page:

-frandom-seed=string
This option provides a seed that GCC uses when it would otherwise use random numbers. It is used to generate certain symbol names that have to be different in every compiled file. It is also used to place unique stamps in coverage data files and the object files that produce them. You can use the -frandom-seed option to produce reproducibly identical object files.

The string should be different for every file you compile.

like image 160
Zan Lynx Avatar answered Oct 07 '22 23:10

Zan Lynx