Reproducible builds on AIX
We have reproducible build capability on Windows, Linux and MacOS now, but not AIX (Or Solaris). This issue will cover any investigation for AIX.
The most important flag for reproducibilty is -qnotimestamps which stops the compiler from adding timestamps into the object files.
Unfortunately the linker still puts a timestamp into the object files starting from byte 5 in the file. I have spoken to IBM and apparently there is no easy way to inhibit this behaviour, so there will need to be some tweaks to the binaries (executables and shared libraries). This will include the shared libraries included in the jmods within the JDK which will need to be exploded and processed (I believe this is comparable to what we have to do on Windows platforms).
The following C code will squash the relevant bytes to enable comparisons:
#include <stdio.h>
int main(int argc, char *argv[])
{
if (argc<2) {
printf("Usage: aixtssquash <filename>\n");
exit(1);
}
printf("Processing %s ... ", argv[1]);
FILE *f;
f = fopen(argv[1], "rb+");
fseek(f, 4, SEEK_SET);
printf("Replacing these four characters with nulls: %x%x%x%x\n", fgetc(f), fgetc(f), fgetc(f), fgetc(f));
fseek(f, 4, SEEK_SET);
fputc((char)0, f); fputc((char)0, f); fputc((char)0, f); fputc((char)0, f);
fclose(f);
return(0);
}
FYI @andrew-m-leonard
qnotimestamps update: This option was added to builds of JDK17+ on AIX here, tweaked here to prevent this issue, and the tweaked version is being tested here.
Update: The tweak failed. Changed and rerunning here.
Update 2: The above build seems to be working, but there are many instances of the warning below, which seems to defeat the point of the change:
warning: 1540-5200 The option "-qnotimestamp" is not supported.
So -qnotimestamp has become -qnotimestamps, and I tried again here. This seems to work much better.