Reproducible build


I want to achieve reproducible builds on my development machine and a gitlab CI/CD server. So far the generated binary differs if I build locally (VS Code + NRFConnect SDK v2.0.0) and remotely (gitlab CI/CD).

I added the GNU Build ID to verify easily if the builds are the same. I made an example which can be used to test this problem.

How to reproduce

Build with West

git clone https://git.fh-aachen.de/vc9917e/build_id_test.git
west init -m github.com/.../sdk-nrf --mr v2.0.0
west update --narrow -o=--depth=1
west build build_id_test --board nrf52833dk_nrf52833 -- --preset test
arm-zephyr-eabi-readelf -n build/zephyr/zephyr.elf


Build with VScode

1. Clone repo https://git.fh-aachen.de/vc9917e/build_id_test.git
2. Install NRF connect plugin
3. Install NRF Connect SDK v2.0.0
4. Open the NRF connect plugin and select: + Add an existing application
5. Locate the folder where you cloned the repo (step 1)
6. In the "Applications" category of the NRF connect plugin look for the "build_id_test" project and click Add Build Configurtion.
7. Select the CMake presets "test"
9. Click "Build Configuration"  
10. Execute  the following to get the build_id:
       arm-zephyr-eabi-readelf -n build/zephyr/zephyr.elf

After building either with West or VScode and retrieving the GNU Build ID, you will notice it is not the same as the one I automatically generate in the CI/CD in gitlab

https://git.fh-aachen.de/vc9917e/build_id_test/-/jobs/298374


Build ID generated Locally in VSCode:

b559f914e2bcf6b2db403269e121d78cc3c585f0



Build ID generated in Gitlab

8583c3c699d3a160d4fb88b8d71246b31ee69742

You can also download the build files from the GItlab job here

https://git.fh-aachen.de/vc9917e/build_id_test/-/jobs/298374/artifacts/download

About the Gitlab CI/CD

The build process is done based on the docker image from

https://github.com/NordicPlayground/nrf-docker

Which I have modified to install the specific NRF Connect SDK version 2.0.0 and zephyr toolchain SDK v0.14.1 after a discussion over here

https://github.com/NordicPlayground/nrf-docker/discussions/34

In case you want to check what I modified I built the docker image in gitlab and is hosted here

https://git.fh-aachen.de/embeddedtools/nrf-docker/container_registry/1286

Parents Reply Children
No Data
Related