Skip to content

Build issues on Ubuntu 24.04 - incorrect openmp linkage in CMake #959

@dbabokin

Description

@dbabokin

OpenMP libraries a linked using the library name (i.e. omp):
https://github.com/plaidml/tpp-mlir/blob/9c53a05fb56128cda8869a563b999e90b31f2e17/cmake/modules/xsmm-dnn.cmake#L47-L50
https://github.com/plaidml/tpp-mlir/blob/9c53a05fb56128cda8869a563b999e90b31f2e17/tools/tpp-run/CMakeLists.txt#L12-L14

This is not portable, as it assumes the libomp.so is in standard location, which might not be the case. And it seems that what happens on Ubuntu 24.04 with libomp-dev package installed. -lomp5 works, but not -lomp.

The recommended way to handle this is the following:

target_link_libraries(xsmm_dnn_mlp PRIVATE OpenMP::OpenMP_C)

And that fix perfectly fixes the first code snippet.

For the second case it's a bit messy, because of --no-as-needed/--as-needed hack. I suggest using OpenMP_C_LIBRARIES instead of -lomp, though it brings two libraries on my machine: /usr/lib/llvm-18/lib/libomp.so;/lib/aarch64-linux-gnu/libpthread.a

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions