From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Binary differences occur in the exe generated by building the same code

Solved!
Go to solution

Binary differences occur in the exe file generated by building the same code.

I want to make sure the generated exe file is the one build with the specified code.

Is there a good way?

0 Kudos
Message 1 of 7
(1,581 Views)

I wouldn't mind being told I'm wrong, but AFAIK there aren't any settings to make LabVIEW generate deterministic builds. (i.e.; the ability to produce byte to byte identical binary output across compilations from identical inputs.)

0 Kudos
Message 2 of 7
(1,539 Views)

One thing that definitely would cause binary differences is if you have the default behaviour of autoincrementing the version number on each build. The version resource is part of the binary file, so will always cause a change in the executable if it changes.

 

Aside from that there is always the chance that something in the executable gets compiled slightly different depending on your current system configuration. But that is not really much different in other build environments.

Rolf Kalbermatter
My Blog
0 Kudos
Message 3 of 7
(1,535 Views)

@rolfk wrote:

One thing that definitely would cause binary differences is if you have the default behavior of autoincrementing the version number on each build. The version resource is part of the binary file, so will always cause a change in the executable if it changes.


There are also timestamps inside of the executable, I believe for when the VIs were built into the executable.  In the past, we have also observed this and other unknown differences with other software compilers.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 7
(1,526 Views)

@crossrulz wrote:


There are also timestamps inside of the executable, I believe for when the VIs were built into the executable.  In the past, we have also observed this and other unknown differences with other software compilers.


That's because the VIs inside an executable (without the diagram and other unnecessary overhead) are stored in a ZIP archive structure. And each ZIP archive file entry also contains a DOS time for the file creation date, and potentially extra data per file entry that also stores the creation date, modification date and last access date in unix time format. That's a by product of using the zlib library with the ZIP extension library for packing everything into the exe. In old times LabVIEW put an LLB into the exe which also stored timestamps for file entries but only supported one directory level. So, no, the binary code does not contain timestamps, but yes the file structure does as it uses the ZIP archive format to store the VI resources.

Rolf Kalbermatter
My Blog
Message 5 of 7
(1,511 Views)

Thank you for answering.
I understand why Binary makes a difference.
Is there a way to prove that the exe file was generated from the same code?

0 Kudos
Message 6 of 7
(1,461 Views)
Solution
Accepted by kthirano123

@kthirano123 wrote:

Thank you for answering.
I understand why Binary makes a difference.
Is there a way to prove that the exe file was generated from the same code?


Not easily. There is a private VI Server method that returns a UID for a VI. This is just a number generated as hash from all the relevant binary information in a VI. NI uses that internally in some tools to determine if a VI has changed and the entire build product may require rebuilding.

 

You could write a tool that calculates this UID for each VI in your Build target and stores it somewhere. However this is serious work to do and there are many difficulties in writing this. The first one would be to use VI server to enumerate all the files in your build target and then their dependencies. Then run through each with this method and store all the UIDs somewhere. Then you can run through it again and compare the stored UIDs with the one returned by this node.

Get VI Signature.png

Rolf Kalbermatter
My Blog
Message 7 of 7
(1,449 Views)