Intel® oneAPI Data Analytics Library
Learn from community members on how to build compute-intensive applications that run efficiently on Intel® architecture.

Unable to link using cmake

R-Goc
Beginner
110 Views

Hello, I am trying to use cmake to build a simple program with oneDAL(some simple analysis on the diamonds dataset to check out the library). However, when using the normal find_package workflow, a large number of variables isn't set, and no libraries actually get linked leading to link errors due to missing symbols.
 

This is the relevant part of my CMakeLists.txt:
```cmake

find_package(oneDAL REQUIRED)

message(STATUS "oneDAL_INCLUDE_DIRS: " ${oneDAL_INCLUDE_DIRS})
target_include_directories(diamonds PRIVATE ${oneDAL_INCLUDE_DIRS})
message(STATUS "ONEDAL_CUSTOM_COMPILE_OPTIONS: " ${ONEDAL_CUSTOM_COMPILE_OPTIONS})
target_compile_options(diamonds PRIVATE ${ONEDAL_CUSTOM_COMPILE_OPTIONS})
message(STATUS "oneDAL_IMPORTED_TARGETS: " ${oneDAL_IMPORTED_TARGETS})
target_link_libraries(diamonds PRIVATE ${oneDAL_IMPORTED_TARGETS})
message(STATUS "ONEDAL_CUSTOM_LINK_OPTIONS: " ${ONEDAL_CUSTOM_LINK_OPTIONS})
target_link_libraries(diamonds PRIVATE ${oneDAL_LIBRARIES})
message(STATUS "oneDAL_LIBRARIES: " ${oneDAL_LIBRARIES})
target_link_options(diamonds PRIVATE ${ONEDAL_CUSTOM_LINK_OPTIONS})

```
I have tried adding the non-standard variables, as shown by some responses on this forum.

Everything is ran from a oneAPI command prompt. the cmake command is:
`cmake -Bbuild -GNinja`

This is the output from cmake:
```
-- The CXX compiler identification is IntelLLVM 2025.1.0 with MSVC-like command-line
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Intel/oneAPI/compiler/latest/bin/icx.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Optimization library is not enabled on Windows
-- CMAKE_BUILD_TYPE: Release
-- ONEDAL_LINK: dynamic
-- ONEDAL_USE_DPCPP: yes
-- ONEDAL_INTERFACE: no
-- ONEDAL_SET_TBB_MANUALLY: no
-- MATH_BACKEND: mkl
-- REF_BACKEND:
-- MKL_DEPENDENCY: no
-- ONEDAL_USE_DPCPP: yes
-- oneDAL_ROOT_DIR: C:/Program Files (x86)/Intel/oneAPI/dal/latest
-- oneDAL_INCLUDE_DIRS: C:/Program Files (x86)/Intel/oneAPI/dal/latest/include
-- oneDAL_DLL_DIR: C:/Program Files (x86)/Intel/oneAPI/dal/latest/redist
-- oneDAL_IMPORTED_TARGETS: TBB::tbb;TBB::tbbmalloc;OpenCL.lib;oneDAL::onedal_core
-- oneDAL_INCLUDE_DIRS: C:/Program Files (x86)/Intel/oneAPI/dal/latest/include
-- ONEDAL_CUSTOM_COMPILE_OPTIONS:
-- oneDAL_IMPORTED_TARGETS: TBB::tbbTBB::tbbmallocOpenCL.liboneDAL::onedal_core
-- ONEDAL_CUSTOM_LINK_OPTIONS:
-- oneDAL_LIBRARIES:
-- Configuring done (2.4s)
-- Generating done (0.1s)
```

Here is the entire error log from the linker: https://gist.github.com/R-Goc/f62baa6f2809e5719d27a09fe0c232cc

0 Kudos
0 Replies
Reply