Skip to content

Commit

Permalink
Fix LAMMPS plugin symlink path on macOS platform (#3473)
Browse files Browse the repository at this point in the history
This pull request fixes the broken symlink for `dpplugin.so` on macOS.
It should point to `libdeepmd_lmp.so` but point to `libdeepmd_lmp.dylib`
instead.

### Details

The `libdeepmd_lmp` is a shared module.

https://github.com/deepmodeling/deepmd-kit/blob/b875ea8f6661b6e1567537ead7e2b4a8b14ea113/source/lmp/plugin/CMakeLists.txt#L72

The build target name on macOS is `libdeepmd_lmp.so`.

Because on macOS, the `CMAKE_SHARED_MODULE_SUFFIX` (`.so`) is different
from `CMAKE_SHARED_LIBRARY_SUFFIX` (`.dynlib`). As a result, in previous
versions, on macOS the symbolic link `dpplugin.so` was pointed to
`libdeepmd_lmp.dylib`, which does not exist. One can check the
conda-forge builds to confirm (e.g.,
[osx-arm64/deepmd-kit-2.2.9-cpu_py311hf5376d5_mpi_openmpi_0.conda](https://anaconda.org/conda-forge/deepmd-kit/2.2.9/download/osx-arm64/deepmd-kit-2.2.9-cpu_py311hf5376d5_mpi_openmpi_0.conda)).

(cherry picked from commit abf3477)
  • Loading branch information
chazeon authored and njzjz committed Apr 6, 2024
1 parent 8ad6327 commit 6b4df90
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion source/lmp/plugin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ if(DEFINED LAMMPS_SOURCE_ROOT OR DEFINED LAMMPS_VERSION)
install(
CODE "execute_process( \
COMMAND ${CMAKE_COMMAND} -E create_symlink \
../${CMAKE_SHARED_LIBRARY_PREFIX}${libname}${CMAKE_SHARED_LIBRARY_SUFFIX} \
../${CMAKE_SHARED_MODULE_PREFIX}${libname}${CMAKE_SHARED_MODULE_SUFFIX} \
${CMAKE_INSTALL_PREFIX}/lib/${libname}/${PLUGINNAME} \
)")
endif()
Expand Down

0 comments on commit 6b4df90

Please sign in to comment.