[Yocto] ERROR: The metadata is not deterministic and this needs to be fixed.
I am facing “Taskhash mismatch ” & “The metadata is not deterministic and this needs to be fixed” & “Taskhash mismatch “ errors in Yocto project build. This issue occurred without any obvious reasons. There is no change in the source code/recipe or any other build parameters.
Error log:
ERROR: When reparsing /home/Yoctos/5.10.72_2.2.0/sources/meta-imx/meta-sdk/recipes-graphics/imx-gpu-sdk/imx-gpu-sdk_5.8.0.bb:do_compile, the basehash value changed from c9a5e395231ebddcceb23cb3312e6658a038657173d8e603775fb10f6ed83395 to 98c5b2d2904c60d576ea88a2eb3a44bc8e0c61e72c15954e9ca2eee31ace0f3c. The metadata is not deterministic and this needs to be fixed.
ERROR: The following commands may help:ERROR: $ bitbake imx-gpu-sdk -cdo_compile -Snone
ERROR: Then:
ERROR: $ bitbake imx-gpu-sdk -cdo_compile -Sprintdiff
or
ERROR: When reparsing /home/nxf71573/Yoctos/5.10.72_2.2.0/sources/meta-imx/meta-sdk/recipes-graphics/imx-gpu-sdk/imx-gpu-sdk_5.8.0.bb:do_compile, the basehash value changed from c9a5e395231ebddcceb23cb3312e6658a038657173d8e603775fb10f6ed83395 to 98c5b2d2904c60d576ea88a2eb3a44bc8e0c61e72c15954e9ca2eee31ace0f3c. The metadata is not deterministic and this needs to be fixed.
ERROR: The following commands may help:
ERROR: $ bitbake imx-gpu-sdk -cdo_compile -Snone
ERROR: Then:
ERROR: $ bitbake imx-gpu-sdk -cdo_compile -Sprintdiff
ERROR: Bitbake’s cached basehash does not match the one we just generated (/home/nxf71573/Yoctos/5.10.72_2.2.0/sources/meta-imx/meta-sdk/recipes-graphics/imx-gpu-sdk/imx-gpu-sdk_5.8.0.bb:do_compile)!
ERROR: The mismatched hashes were c9a5e395231ebddcceb23cb3312e6658a038657173d8e603775fb10f6ed83395 and 98c5b2d2904c60d576ea88a2eb3a44bc8e0c61e72c15954e9ca2eee31ace0f3c
ERROR: Taskhash mismatch 540cf4f9ec55ea13ab8671eb9d15e923294edf15c4901d901e2198272f86a578 versus f470bf5f0b7758ac36c24e691112ffd09f5a398d6d1c6119d9274961fb01d973 for /home/nxf71573/Yoctos/5.10.72_2.2.0/sources/meta-imx/meta-sdk/recipes-graphics/imx-gpu-sdk/imx-gpu-sdk_5.8.0.bb:do_compile
My temporary solution is changing old_basehash to new_basehash logged in the error log (the basehash value changed from old_basehash to new_basehash.) at cache file in folder ./tmp/cache/
In my case:
old_basehash:c9a5e395231ebddcceb23cb3312e6658a038657173d8e603775fb10f6ed83395
new_basehash:98c5b2d2904c60d576ea88a2eb3a44bc8e0c61e72c15954e9ca2eee31ace0f3c
- Step1: search old_basehash in folder ./tmp/cache
~/Yoctos/5.10.72_2.2.0/build-imx8qxpc0$ grep -rn c9a5e395231ebddcceb23cb3312e6658a038657173d8e603775fb10f6ed83395 tmp/cache Binary file tmp/cache/default-glibc/imx8qxpc0mek/x86_64/bb_cache.dat.32802993559eecd8b079a9361443b2917b3bce4a2d54cfba659be1e813fc1769 matches
- Step2: Replace old_basehash by new_basehash; open cache file had found in step 1 and replace 98c5b2d2904c60d576ea88a2eb3a44bc8e0c61e72c15954e9ca2eee31ace0f3c by 98c5b2d2904c60d576ea88a2eb3a44bc8e0c61e72c15954e9ca2eee31ace0f3c
~/Yoctos/5.10.72_2.2.0/build-imx8qxpc0$ vim ./tmp/cache/default-glibc/imx8qxpc0mek/x86_64/bb_cache.dat.32802993559eecd8b079a9361443b2917b3bce4a2d54cfba659be1e813fc1769
- Step3: Rebuild yocto again==> it’s ok now
I hope that it is useful for you!