Skip to content

Missing libraries after install() (when cmake is used) #1048

Open
@phprus

Description

oneTBB (from yum repo):

phprus@phprus:~> ls -l  /opt/intel/oneapi/tbb/latest
lrwxrwxrwx 1 root root 8 Jan 16 13:16 /opt/intel/oneapi/tbb/latest -> 2021.8.0

CMake:

...
set(TBB_ROOT "/opt/intel/oneapi/tbb/latest")
find_package(TBB 2021   REQUIRED    COMPONENTS tbb tbbmalloc tbbmalloc_proxy)
install(IMPORTED_RUNTIME_ARTIFACTS ${TBB_IMPORTED_TARGETS}
    LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
    RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
...

cmake install:

phprus@phprus:~/.../build/gcc10-Release> cmake --install . --config Release
...
-- Installing: /.../lib64/libtbb.so.12
-- Installing: /.../lib64/libtbbmalloc.so.2
-- Installing: /.../lib64/libtbbmalloc_proxy.so.2
...

Show installed files:

phprus@phprus:~/.../lib64> ls -l
lrwxrwxrwx 1 phprus users       25 Mar 22 11:27 libtbbmalloc_proxy.so.2 -> libtbbmalloc_proxy.so.2.8
lrwxrwxrwx 1 phprus users       19 Mar 22 11:27 libtbbmalloc.so.2 -> libtbbmalloc.so.2.8
lrwxrwxrwx 1 phprus users       14 Mar 22 11:27 libtbb.so.12 -> libtbb.so.12.8

libtbbmalloc_proxy.so.2.8, libtbbmalloc.so.2.8, libtbb.so.12.8 is missing.

Fix:

Use IMPORTED_SONAME_<CONFIG> for libtbb.so.12 (filename only) and IMPORTED_LOCATION_<CONFIG> for full path to libtbb.so.12.8 (https://cmake.org/cmake/help/latest/command/add_library.html#id5).
And similarly for libtbbmalloc_proxy.so.2.8, libtbbmalloc.so.2.8.

After these changes install(IMPORTED_RUNTIME_ARTIFACTS will work fine (https://cmake.org/cmake/help/latest/command/install.html#imported-runtime-artifacts).

I tested only oneTBB from yum repository.

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions