Get build version of Gramine binaries
Description of the problem
Need a command line option for gramine executables (gramine-sgx, gramine-direct etc) to get the version details like git commit version from which binaries are built. Right now this is available only when gramine is built with debug option, it prints commit details as one one the debug prints at the start up.
When we build GSC docker and docker is deployed, there is no way to know what version/commit of gramine it contains. We may not have access to config yaml file in which gramine version is specified. This command line option will help while debugging failures.
Steps to reproduce
None
Expected results
Print the source commit version
Actual results
Nothing is printed now
Gramine commit hash
mainline
A workaround:
manifest=LibOS/shim/test/regression/bootstrap.manifest
libos=$(grep -Po -e 'entrypoint.*file:\K[^"]*' $manifest)
off=$(nm $libos | fgrep g_gramine_commit_hash | cut -d' ' -f1 | sed 's/^0*//')
strings -tx $libos | fgrep $off | sed "s/.*$off //"
You can substitute manifest with a path to some manifest or, even better, replace libos with the path to libsysdb.so directly (lib/x86_64-linux-gnu/gramine/libsysdb.so in your Gramine installation dir).
I wouldn't mind if there was gramine-{direct,sgx} --version and maybe even --help.