0

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) .

  • If you generate the sdk using yocto and install it as expected, you should be able to cross compile your sources. when you said `in a different directory`, it implies different terminal too ? – ogs May 04 '18 at 12:54
  • Yes. Different terminal. If I try compile the same code in different folder binaries are getting generated but if I compare the binaries both are different. Why these are getting different? – Anil Antony May 04 '18 at 13:11
  • Because when you source the environment, you can cross compile only in the terminal in which you executed the command. In case you switch to another terminal, you have to execute the command again. Otherwise, you compile source for your host machine. – ogs May 04 '18 at 13:32
  • Yes you are correct and I am doing the same also. – Anil Antony May 04 '18 at 13:43
  • Using readelf,(readlef -a -W) I created a report listing content of both builds and compared the (using Beyond compare). This showed that build id for both binaries (ELF format) are different. Why these Build -ID are getting different when I do cross compilation. – Anil Antony May 09 '18 at 10:51

1 Answers1

0

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

Ross Burton
  • 3,516
  • 13
  • 12