wavebitscientific / datetime-fortran

Date and time manipulation for modern Fortran
MIT License
137 stars 50 forks source link

Force ar/ranlib to do a deterministic build. #75

Closed harshula closed 1 year ago

harshula commented 1 year ago

I noticed that datetime-fortran does not create deterministic builds. Details are documented in: https://github.com/ACCESS-NRI/ACCESS-OM/issues/8

milancurcic commented 1 year ago

Thanks @harshula! Does ar on Xcode have a different option set? From the failed ci/mac job, it seems that ar there doesn't like -D

harshula commented 1 year ago

Thanks @harshula! Does ar on Xcode have a different option set?

Sorry, I'm not familiar with Xcode.

milancurcic commented 1 year ago

@scivision do you know what's the ar option for deterministic builds on macOS? -D doesn't seem to be it, but I also can't find an answer from an online search. See https://github.com/wavebitscientific/datetime-fortran/actions/runs/3261165880/jobs/5368639001

harshula commented 1 year ago

Notes

https://gitlab.kitware.com/cmake/cmake/-/issues/19852

My current workaround is to set CMAKE__CREATE_STATIC_LIBRARY on macOS platforms to something along the lines of /usr/bin/xcrun libtool -static -D -o , which seems to have the same effect, but it would be preferable if CMake had native libtool support instead of relying on xcrun.

&

You can also try setting ZERO_AR_DATE=1 in the environment. This is supported by older apple tools. It doesn't zero out the uid etc. in the .a, but it's better than nothing.

milancurcic commented 1 year ago

Thanks. Either workaround is OK with me.

harshula commented 1 year ago

Closing this as wontfix because: