diff --git a/CMakeLists.txt b/CMakeLists.txt index d6faab67f29..34ed1c6206d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -191,6 +191,13 @@ cmake_dependent_option( set(ONNX_NAMESPACE "onnx_torch" CACHE STRING "A namespace for ONNX; needed to build with other frameworks that share ONNX.") +# This is a fix for a rare build issue on Ubuntu: +# symbol lookup error: miniconda3/envs/pytorch-py3.7/lib/libmkl_intel_lp64.so: undefined symbol: mkl_blas_dsyrk +# https://software.intel.com/en-us/articles/symbol-lookup-error-when-linking-intel-mkl-with-gcc-on-ubuntu +if(LINUX) + set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-as-needed") +endif() + if (MSVC) foreach(flag_var CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE