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

Non-interactive shells can't run LAMMPS #9

Closed
ilia-nikiforov-umn opened this issue Nov 1, 2023 · 3 comments
Closed

Non-interactive shells can't run LAMMPS #9

ilia-nikiforov-umn opened this issue Nov 1, 2023 · 3 comments
Assignees

Comments

@ilia-nikiforov-umn
Copy link
Contributor

$ docker run --name kim_dev ghcr.io/openkim/developer-platform:latest-minimal lmp
lmp: error while loading shared libraries: liblammps.so.0: cannot open shared object file: No such file or directory

LD_LIBRARY_PATH is set in .bashrc, which is not called in non-interactive shells.

@ilia-nikiforov-umn ilia-nikiforov-umn self-assigned this Nov 1, 2023
@ilia-nikiforov-umn
Copy link
Contributor Author

@dskarls do you know why LD_LIBRARY_PATH=/usr/local/lib is needed in the first place? Shouldn't libraries in that directory be found automatically? I'm revisiting this because I discovered a strange behavior -- non-interactive shells of the full image CAN run find liblammps.so. Only the minimal image can't find it without loading .bashrc. I have confirmed that installing these packages in the minimal image fixes this, so something relevant happens in the Ubuntu configuration during their installation

RUN apt-get update -qq \

@yafshar
Copy link
Member

yafshar commented Feb 4, 2025

@ilia-nikiforov-umn By default, the linker searches in standard directories like /lib and /usr/lib. However, if your libraries are located in non-standard directories, such as /usr/local/lib, you need to set LD_LIBRARY_PATH to include these paths.

You can ensure that LD_LIBRARY_PATH includes /usr/local/lib when running your command:

docker run -e LD_LIBRARY_PATH=/usr/local/lib --name kim_dev ghcr.io/openkim/developer-platform:latest-minimal lmp

Or building the Docker image you can add the necessary environment variable or run ldconfig in the Dockerfile.

@ilia-nikiforov-umn
Copy link
Contributor Author

@ilia-nikiforov-umn By default, the linker searches in standard directories like /lib and /usr/lib. However, if your libraries are located in non-standard directories, such as /usr/local/lib, you need to set LD_LIBRARY_PATH to include these paths.

You can ensure that LD_LIBRARY_PATH includes /usr/local/lib when running your command:

docker run -e LD_LIBRARY_PATH=/usr/local/lib --name kim_dev ghcr.io/openkim/developer-platform:latest-minimal lmp

Or building the Docker image you can add the necessary environment variable or run ldconfig in the Dockerfile.

Thanks! I didn't realize that /usr/local/lib was considered a "non-standard" directory. I was confused that /usr/local/lib was already listed in /etc/ld.so.conf.d/libc.conf, but I see now that it is not actually used until I run ldconfig.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants