Opencv.js reproducible build

I need an opencv.js that is reproducible, and I’ve made some progress, but now my bag of tricks is empty. I’m at a dead end skill-/experience-wise and I could really use some advice.

I’ve succceeded in making the opencv.js build stable across builds in a single machine using the build process (using docker) provided in the opencv docs, and I’ve managed to narrow the output differences of builds in different machines down to the following files (excluding the output files themselves)

./build_js/modules/core/CmakeFiles/opencv_core.dir/src/system.cpp.o
./build_js/lib/libopencv_core.a
./modules/python/src2/__pycache__/hdr_parser.cpython-37.pyc
./modules/js/generator/__pycache__/templates.cpython-37.pyc

The above file differences were generated when I ran the build process (using docker) in an amazon EC2 instance as a reference point for “another machine” than my own. Both machines have a x86_64 processor.

Having said that, those are all bytecode files, and I have no idea how to proceed. How can I find out what in those files is changing the output and why? What’s the next step? Is there some workaround I could try?

How I’ve gotten this far

By default opencv.js builds are unique, but through trial and error, and looking at the output file differences, I’ve figured out a way to make the build stable across builds in a single machine. In order to do that you have to hardcode this parameter OPENCV_TIMESTAMP
in build_js.py.
Additionally these CMAKE’s internal variables affect the build output, but these are stable per machine.

CMAKE_HOST_SYSTEM
CMAKE_HOST_SYSTEM_VERSION
CMAKE_HOST_SYSTEM_NAME
CMAKE_HOST_SYSTEM_PROCESSOR