Skip to content

Compiler cannot find libxsmm.mod and linker cannot find PkgConfig::LIBXSMMEXT #997

@hjjvandam

Description

@hjjvandam

While trying to build CP2K I ran into a couple of issues compiling DBCSR. The two issues seem to be related to a few lines in CMakeLists.txt in the src directory. The lines are

if (USE_OPENMP)
to
target_link_libraries(dbcsr PRIVATE PkgConfig::LIBXSMM)
.

One issue is that target_link_libraries seem to add PkgConfig::LIBXSMMEXT and PkgConfig::LIBXSMM verbatim to the link line, resulting in the linker complaining that it cannot find these libraries. I suppose target_link_libraries should have replaced these with the actual libraries mentioned in the corresponding .pc files, but it didn't do that for me. I am using CMake version 3.31.7 that CP2K installs and pkg-config version 1.7.3. Locally, I could fix this issue by replacing two lines with

#target_link_libraries(dbcsr PRIVATE PkgConfig::LIBXSMMEXT)
target_link_libraries(dbcsr PRIVATE ${LIBXSMMEXT_LIBRARIES})

#target_link_libraries(dbcsr PRIVATE PkgConfig::LIBXSMM)
target_link_libraries(dbcsr PRIVATE ${LIBXSMM_LIBRARIES})

The other issue was that while compiling the Fortran code the libxsmm.mod file was not found. The reason was that no appropriate locations for include files were added to the compile line. Again, locally, I could easily fix this by adding

target_include_directories(dbcsr PRIVATE ${LIBXSMM_INCLUDE_DIRS})

Admittedly, the lines of CMakeLists.txt that I am commenting on have been there for at least 5 years already. So, I am not sure why this is not causing issues all over the place, maybe I am missing something. Nevertheless, I would appreciate it if this problem could be mitigated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions