Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replacing date/gdate with perl program #833

Merged
merged 2 commits into from
Sep 12, 2023
Merged

Replacing date/gdate with perl program #833

merged 2 commits into from
Sep 12, 2023

Conversation

Robertorosmaninho
Copy link
Collaborator

Fixes runtimeverification/k#3610
This PR replaces the use of date and gdate, depending on the user system, to get the current timestamp in milliseconds with a simple Perl program to improve compatibility across Unix-like systems.

This modification is needed due to the following:

  • date in MacOS is a FreeBSD version that doesn't support (return) timestamps in milliseconds as we need in llvm-kompile --profile introduced by Add --profile option to llvm-kompile #793.
  • gdate isn't a default package nor a standalone package to be installed in MacOS. Instead, it's commonly installed with coreutils. We do not want to ask our users to install all coreutils when we only need gdate from it and to use it in an optional flag.
  • Other options were considered as python time and bash ${EPOCHREALTIME}, but this was the simplest to use and with common default dependencies in Unix-like systems.

@Robertorosmaninho
Copy link
Collaborator Author

I can probably delete these lines as well:

substituteInPlace bin/utils.sh \
--replace 'gdate' 'date'

They were added in #797 to fix an issue of using gdate on MacOS Homebrew.

Copy link
Contributor

@radumereuta radumereuta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is Perl available by default in Ubuntu and Macs?
Do we need to add it as a dependency to the Dockerfiles?

@Robertorosmaninho
Copy link
Collaborator Author

Yes, Perl seems to be default in Ubuntu Focal (v5.30), Jimmy (v5.34), and MacOS 13 (v5.30)!
It is also default in other distros and macOS versions; I just don't have access to them!

Copy link
Contributor

@radumereuta radumereuta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, let's see what happens.

@goodlyrottenapple
Copy link
Contributor

Seems ok if we are reasonably sure perl is always present on a system. Otherwise could always add perl as a runtime dependency for the nix built package here:

boost coreutils fmt gmp jemalloc libffi mpfr ncurses python-env unixtools.xxd

@goodlyrottenapple
Copy link
Contributor

I can probably delete these lines as well:

substituteInPlace bin/utils.sh \
--replace 'gdate' 'date'

Yes, those should be deleted

@rv-jenkins rv-jenkins merged commit 11b4a57 into master Sep 12, 2023
6 checks passed
@rv-jenkins rv-jenkins deleted the replace-date branch September 12, 2023 13:42
rv-jenkins pushed a commit that referenced this pull request Dec 21, 2023
In #833 we
changed from the built-in date command to perl for getting the system
time in ms; this caused some weird interactions with the OS when
installed via `kup`:
runtimeverification/kup#80

This PR drops our use of `perl` and instead uses an equivalent `python3`
command, which we already depend on when building the backend.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge dependencies Pull requests that update a dependency file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing gdate as MacOS dependence
4 participants