Error building mpi shared lib: ./liblammps_mpi.so: undefined reference to `LAMMPS_NS::MLIAPModelPython::connect_param_counts()'

I’m trying to compile the shared library mpi build of LAMMPS and I’m getting an error for the target lmp_mpi where there is an undefined reference to “LAMMPS_NS::MLIAPModelPython::connect_param_counts()” in liblammps_mpi.so.

Compiling that static library works just fine. I don’t know if there is an issue with my setup or why they would differ here. I have tried this with both python 2 as a system package and python 3.10 in a virtual env, although I can’t image the python version is the culprit here. This has been in a docker container based on ubuntu:18.04, but I am also encountering the issue outside docker. I’ve also tried the latest stable commit (https://github.com/lammps/lammps/tree/7586adbb6a61254125992709ef2fda9134cfca6c) and an older stable tag (stable_3Mar2020).

I’m mostly just wondering if there is an obvious difference between the static and shared library build process that I was supposed to be aware of or if there is perhaps a bug I should report. I can share my current Dockerfile and a build output if that would be helpful.

Thanks,
Scott

It would be more helpful to test with the latest commit on the “develop” branch.

It is crucial to know how exactly you compiled and configured LAMMPS and what environment you have.

Python 3.6 or later is a requirement for the functionality that is missing and you also need to have cython installed.

I have been able to reproduce it with the stable version using the conventional build system (cmake is fine).

As a workaround, please try:
make no-ml-iap
make yes-ml-iap
and then recompile. That applied the changes that triggered running cythonize and generated the missing C++ source file.

FYI, I have implemented a fix into this pull request

Please see this commit

Thank you very much for your time on this. The workaround and the patch both seem to work.