Search code examples
makefilecross-compilingyoctoopenembeddedlinux-toolchain

If the same code is built at different folders using arm-poky-linux-gnueabi-gcc, the resulting binary will have different contents


I have a source code and I am trying to cross compile for armv7 architecture it is getting compiled and generating binary file. When I compile the same code in a different directory then generated binaries are different from the previous one. Why I am getting this difference?. Not only binary, object file also getting changed. I am using arm-poky-linux-gnueabi-gcc. The tool chain I am creating using following command "source /opt/fsl-imx-x11/4.1.15.1.1/environment...." etc. Tool chain is exporting compiler setting also (CLFAGS, LDFLAGS) .


Solution

  • This is nothing to do with cross compilation or Yocto, but simply because the binaries will embed the build path, timestamps, and other things that change. If you want binaries that are identical then you'll need to read up on reproducible builds:

    https://reproducible-builds.org https://wiki.yoctoproject.org/wiki/Reproducible_Builds