diff --git a/.ci/pipeline/ci.yml b/.ci/pipeline/ci.yml index 227bc890af7..b0d1433d9d5 100755 --- a/.ci/pipeline/ci.yml +++ b/.ci/pipeline/ci.yml @@ -534,15 +534,12 @@ jobs: --test_thread_mode=par displayName: 'cpp-examples-thread-release-static' - # The issue that bazel doesnt link MKL libs via -Wl, --start-group.. - # oneDAL make build pass this test - # TODO: add cycle linking in bazel - # - script: | - # export DALROOT=`pwd`/bazel-bin/release/daal/latest - # bazel test //examples/oneapi/cpp:all \ - # --test_link_mode=release_dynamic \ - # --test_thread_mode=par - # displayName: 'cpp-examples-thread-release-dynamic' + - script: | + export DALROOT=`pwd`/bazel-bin/release/daal/latest + bazel test //examples/oneapi/cpp:all \ + --test_link_mode=release_dynamic \ + --test_thread_mode=par + displayName: 'cpp-examples-thread-release-dynamic' - script: | bazel test //cpp/daal:tests diff --git a/dev/bazel/deps/mkl.tpl.BUILD b/dev/bazel/deps/mkl.tpl.BUILD index cf492886f09..13dca8ffdb6 100644 --- a/dev/bazel/deps/mkl.tpl.BUILD +++ b/dev/bazel/deps/mkl.tpl.BUILD @@ -22,11 +22,22 @@ cc_library( "lib/libmkl_tbb_thread.a", ], linkopts = [ + # The source libraries have circular symbol dependencies. To successfully build this cc_library, + # oneMKL requires wrapping the libraries with -Wl,--start-group and -Wl,--end-group. + "-Wl,--start-group", + "$(location lib/libmkl_intel_ilp64.a)", + "$(location lib/libmkl_tbb_thread.a)", + "$(location lib/libmkl_core.a)", + "-Wl,--end-group", "-lpthread", + "-lm", + "-ldl", ], deps = [ ":headers", ] + alwayslink = 1, + linkstatic = 1, ) cc_library(