Open bernstei opened 1 year ago
The kim-api uses the c++ standard routine std::filesystem::temp_directory_path()
(https://en.cppreference.com/w/cpp/filesystem/temp_directory_path). So this is, logically, not a kim-api issue but an issue with your system. I guess the fix will depend on your system's implementation of the c++ standard. Yes, I would guess that you can use TMPDIR
to put your system into working order.
I don't think it's obvious that it's an issue with our system as such, because the directory is created. It's only a problem because of KIM's assumption that a directory created this way is an acceptable place to put a shared library to be dynamically loaded. I realize it's not the most common configuration, but it's not a crazy one.
Setting TMPDIR
does fix the issue. I think at the very least it could use a note in the docs someplace.
Actually, looking deeper, there are other places in collections-management scripts that just use TMPDIR
directly.
https://github.com/openkim/kim-api/blob/431e641788a5df5ff6058e1974004c7efe93931e/utils/collections-management.in#L205
And we have a std::filesystem
drop-in replacement for older compilers
https://github.com/openkim/kim-api/blob/431e641788a5df5ff6058e1974004c7efe93931e/cpp/src/ghc-filesystem/filesystem.hpp#L4598
that will use TMPDIR
first and then check other env variables if it's not defined.
So, yes, I think setting TMPDIR
is the best solution here.
Ah, OK now I understand more clearly: the system provides /tmp
but doesn't allow (direct) execution of files created there. Yeah, that's an issue.
It seems that the C++ standard doesn't say anything about the permissions of the returned temp directory; POSIX doesn't require systems to provide TMPDIR
.
So, yeah, it seems that the best that can be done is to document the expectations of the kim-api:
TMPDIR
variable is set to a location where temp directories/files can be created and executed.std::filesystem::temp_directory_path()
routine returns a location where temp directories/files can be created and executed.We'll leave this issue open as a reminder to implement this addition to the documentation.
Sounds good.
Following the instructions at https://openkim.org/doc/usage/obtaining-models/#installing_api to install from source, with some slight modifications, appears to work. The modifications are to set
-DCMAKE_INSTALL_PREFIX=${PWD}/../../installed-kim-api-2.3.0
, as the LAMMPS kim README suggests, and to skip thesudo
s.Using this installation to to install the Ercolessi-Adams model that the LAMMPS README refers to leads to an error. Our
/tmp
is mounted noexec, which I believe will also block shared libraries. Is there a way to set a differentTMPDIR
, in case that's the issue?