Bazel build tensorflow Lite C++ API with flex fails: dnnl_common.h no such file or directory

Hello,

I have been following the reduce binary size guide in various machines both Mac and Linux with no sucess at building tensorflowlite_flex.

I decided to use an AWS EC2 instance with Docker to avoid possible dependency conflicts, but still the build fails. The instance has this specifications:

RAM: 32GB
vCPU: 16
Architecture: x86_64
OS: Ubuntu 22.0.4 Server

I have a simple model previously converted and saved to a .tflite as follows:

import tensorflow as tf

class CppTfTest(tf.Module):
    def __init__(self, name=None):
        super().__init__(name=name)

    @tf.function
    def call(self):
        frames = tf.range(600)
        bpm = tf.random.uniform(
            tf.TensorShape([600,]),
            minval=0,
            maxval=90,
            dtype=tf.dtypes.float64
            )

        return bpm, frames
cpp_tf_test = CppTfTest()
tf.saved_model.save(
    cpp_tf_test,
    'cpp_tf_test',
    signatures=cpp_tf_test.call.get_concrete_function()
    )
converter = tf.lite.TFLiteConverter.from_saved_model('cpp_tf_test')
converter.target_spec.supported_ops = [
  tf.lite.OpsSet.TFLITE_BUILTINS, # enable TensorFlow Lite ops.
  tf.lite.OpsSet.SELECT_TF_OPS # enable TensorFlow ops.
]

tflite_model = converter.convert()

with open('cpp_tf_test.tflite', 'wb') as f:
  f.write(tflite_model)

These are the BUILD file inside the created tmp folder and the Dockerfile I am using:

load(
   "//tensorflow/lite:build_def.bzl",
   "tflite_custom_cc_library",
   "tflite_cc_shared_object",
)

tflite_custom_cc_library(
   name = "selectively_built_cc_lib",
   models = [
       ":cpp_tf_test.tflite",
   ],
)

# Shared lib target for convenience, pulls in the core runtime and builtin ops.
# Note: This target is not yet finalized, and the exact set of exported (C/C++)
# APIs is subject to change. The output library name is platform dependent:
#   - Linux/Android: `libtensorflowlite.so`
#   - Mac: `libtensorflowlite.dylib`
#   - Windows: `tensorflowlite.dll`
tflite_cc_shared_object(
   name = "tensorflowlite",
   # Until we have more granular symbol export for the C++ API on Windows,
   # export all symbols.
   features = ["windows_export_all_symbols"],
   linkopts = select({
       "//tensorflow:macos": [
           "-Wl,-exported_symbols_list,$(location //tensorflow/lite:tflite_exported_symbols.lds)",
       ],
       "//tensorflow:windows": [],
       "//conditions:default": [
           "-Wl,-z,defs",
           "-Wl,--version-script,$(location //tensorflow/lite:tflite_version_script.lds)",
       ],
   }),
   per_os_targets = True,
   deps = [
       ":selectively_built_cc_lib",
       "//tensorflow/lite:tflite_exported_symbols.lds",
       "//tensorflow/lite:tflite_version_script.lds",
   ],
)


load(
   "@org_tensorflow//tensorflow/lite/delegates/flex:build_def.bzl",
   "tflite_flex_shared_library"
)

# Shared lib target for convenience, pulls in the standard set of TensorFlow
# ops and kernels. The output library name is platform dependent:
#   - Linux/Android: `libtensorflowlite_flex.so`
#   - Mac: `libtensorflowlite_flex.dylib`
#   - Windows: `libtensorflowlite_flex.dll`
tflite_flex_shared_library(
 name = "tensorflowlite_flex",
 models = [
     ":cpp_tf_test.tflite",
 ],
)
FROM tensorflow/build:latest-python3.11

ENV ANDROID_DEV_HOME /android
RUN mkdir -p ${ANDROID_DEV_HOME}

RUN apt-get update && \
    apt-get install -y --no-install-recommends default-jdk

# Install Android SDK.
ENV ANDROID_SDK_FILENAME commandlinetools-linux-6858069_latest.zip
ENV ANDROID_SDK_URL https://dl.google.com/android/repository/${ANDROID_SDK_FILENAME}
ENV ANDROID_API_LEVEL 31
ENV ANDROID_NDK_API_LEVEL 21
# Build Tools Version liable to change.
ENV ANDROID_BUILD_TOOLS_VERSION 33.0.2
ENV ANDROID_SDK_HOME ${ANDROID_DEV_HOME}/sdk
RUN mkdir -p ${ANDROID_SDK_HOME}/cmdline-tools
ENV PATH ${PATH}:${ANDROID_SDK_HOME}/cmdline-tools/latest/bin:${ANDROID_SDK_HOME}/platform-tools
RUN cd ${ANDROID_DEV_HOME} && \
    wget -q ${ANDROID_SDK_URL} && \
    unzip ${ANDROID_SDK_FILENAME} -d /tmp && \
    mv /tmp/cmdline-tools ${ANDROID_SDK_HOME}/cmdline-tools/latest && \
    rm ${ANDROID_SDK_FILENAME}

# Install Android NDK.
ENV ANDROID_NDK_FILENAME android-ndk-r21e-linux-x86_64.zip
ENV ANDROID_NDK_URL https://dl.google.com/android/repository/${ANDROID_NDK_FILENAME}
ENV ANDROID_NDK_HOME ${ANDROID_DEV_HOME}/ndk
ENV PATH ${PATH}:${ANDROID_NDK_HOME}
RUN cd ${ANDROID_DEV_HOME} && \
    wget -q ${ANDROID_NDK_URL} && \
    unzip ${ANDROID_NDK_FILENAME} -d ${ANDROID_DEV_HOME} && \
    rm ${ANDROID_NDK_FILENAME} && \
    bash -c "ln -s ${ANDROID_DEV_HOME}/android-ndk-* ${ANDROID_NDK_HOME}"

# Make android ndk executable to all users.
RUN chmod -R go=u ${ANDROID_DEV_HOME}

# Get android tools
RUN yes | sdkmanager \
  "build-tools;${ANDROID_BUILD_TOOLS_VERSION}" \
  "platform-tools" \
  "platforms;android-${ANDROID_API_LEVEL}"

# Sets up tensorflow source code
RUN cd /home && \
    wget https://github.com/tensorflow/tensorflow/archive/refs/tags/v2.13.0.tar.gz && \
    tar -zxvf v2.13.0.tar.gz && \
    rm v2.13.0.tar.gz && \
    cd tensorflow-2.13.0

# Sets up missing dnnl source files
RUN cd /home && \
    wget https://github.com/oneapi-src/oneDNN/archive/refs/tags/v3.2.1.tar.gz && \
    tar -zxvf v3.2.1.tar.gz && \
    rm v3.2.1.tar.gz && \
    cp -r /home/oneDNN-3.2.1/include/oneapi /home/tensorflow-2.13.0/tensorflow/core/kernels/mkl/oneapi && \
    cp /home/tensorflow-2.13.0/tensorflow/core/kernels/mkl/oneapi/dnnl/dnnl.hpp /home/tensorflow-2.13.0/tensorflow/core/kernels/mkl/dnnl.hpp && \
    cp /home/oneDNN-3.2.1/include/dnnl_config.h /home/tensorflow-2.13.0/tensorflow/core/kernels/mkl/oneapi/dnnl/dnnl_config.h && \
    cp /home/oneDNN-3.2.1/include/dnnl_config.h /home/tensorflow-2.13.0/tensorflow/core/kernels/mkl/dnnl_config.h
    
# Set files for build
RUN mkdir -p tmp
COPY BUILD /home/tensorflow-2.13.0/tmp/BUILD
COPY cpp_tf_test.tflite /home/tensorflow-2.13.0/tmp/cpp_tf_test.tflite
RUN mkdir /home/bazel-results

This is the error I get:

bazel --output_user_root=/home/bazel-results build -c opt --cxxopt=–std=c++17 --config=android_arm64 --config=monolithic --host_crosstool_top=@bazel_tools//tools/cpp:toolchain //tmp:tensorflowlite_flex --verbose_failures
INFO: Options provided by the client:
Inherited ‘common’ options: --isatty=1 --terminal_columns=80
INFO: Reading rc options for ‘build’ from /home/tensorflow-2.13.0/.bazelrc:
Inherited ‘common’ options: --experimental_repo_remote_exec
INFO: Reading rc options for ‘build’ from /etc/bazel.bazelrc:
‘build’ options: --action_env=DOCKER_CACHEBUSTER=1693700023118896811 --host_action_env=DOCKER_HOST_CACHEBUSTER=1693700023214737835
INFO: Reading rc options for ‘build’ from /home/tensorflow-2.13.0/.bazelrc:
‘build’ options: --define framework_shared_object=true --define tsl_protobuf_header_only=true --define=use_fast_cpp_protos=true --define=allow_oversize_protos=true --spawn_strategy=standalone -c opt --announce_rc --define=grpc_no_ares=true --noincompatible_remove_legacy_whole_archive --enable_platform_specific_config --define=with_xla_support=true --config=short_logs --config=v2 --define=no_aws_support=true --define=no_hdfs_support=true --experimental_cc_shared_library --experimental_link_static_libraries_once=false --incompatible_enforce_config_setting_visibility --deleted_packages=tensorflow/compiler/mlir/tfrt,tensorflow/compiler/mlir/tfrt/benchmarks,tensorflow/compiler/mlir/tfrt/jit/python_binding,tensorflow/compiler/mlir/tfrt/jit/transforms,tensorflow/compiler/mlir/tfrt/python_tests,tensorflow/compiler/mlir/tfrt/tests,tensorflow/compiler/mlir/tfrt/tests/ir,tensorflow/compiler/mlir/tfrt/tests/analysis,tensorflow/compiler/mlir/tfrt/tests/jit,tensorflow/compiler/mlir/tfrt/tests/lhlo_to_tfrt,tensorflow/compiler/mlir/tfrt/tests/lhlo_to_jitrt,tensorflow/compiler/mlir/tfrt/tests/tf_to_corert,tensorflow/compiler/mlir/tfrt/tests/tf_to_tfrt_data,tensorflow/compiler/mlir/tfrt/tests/saved_model,tensorflow/compiler/mlir/tfrt/transforms/lhlo_gpu_to_tfrt_gpu,tensorflow/core/runtime_fallback,tensorflow/core/runtime_fallback/conversion,tensorflow/core/runtime_fallback/kernel,tensorflow/core/runtime_fallback/opdefs,tensorflow/core/runtime_fallback/runtime,tensorflow/core/runtime_fallback/util,tensorflow/core/tfrt/eager,tensorflow/core/tfrt/eager/backends/cpu,tensorflow/core/tfrt/eager/backends/gpu,tensorflow/core/tfrt/eager/core_runtime,tensorflow/core/tfrt/eager/cpp_tests/core_runtime,tensorflow/core/tfrt/gpu,tensorflow/core/tfrt/run_handler_thread_pool,tensorflow/core/tfrt/runtime,tensorflow/core/tfrt/saved_model,tensorflow/core/tfrt/graph_executor,tensorflow/core/tfrt/saved_model/tests,tensorflow/core/tfrt/tpu,tensorflow/core/tfrt/utils,tensorflow/core/tfrt/utils/debug
INFO: Found applicable config definition build:short_logs in file /home/tensorflow-2.13.0/.bazelrc: --output_filter=DONT_MATCH_ANYTHING
INFO: Found applicable config definition build:v2 in file /home/tensorflow-2.13.0/.bazelrc: --define=tf_api_version=2 --action_env=TF2_BEHAVIOR=1
INFO: Found applicable config definition build:android_arm64 in file /home/tensorflow-2.13.0/.bazelrc: --config=android --cpu=arm64-v8a --fat_apk_cpu=arm64-v8a
INFO: Found applicable config definition build:android in file /home/tensorflow-2.13.0/.bazelrc: --crosstool_top=//external:android/crosstool --host_crosstool_top=@bazel_tools//tools/cpp:toolchain --dynamic_mode=off --noenable_platform_specific_config --copt=-w --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 --define=with_xla_support=false
INFO: Found applicable config definition build:monolithic in file /home/tensorflow-2.13.0/.bazelrc: --define framework_shared_object=false --define tsl_protobuf_header_only=false --experimental_link_static_libraries_once=false
WARNING: Download from https://storage.googleapis.com/mirror.tensorflow.org/github.com/llvm/llvm-project/archive/dc275fd03254d67d29cc70a5a0569acf24d2280d.tar.gz failed: class java.io.FileNotFoundException GET returned 404 Not Found
WARNING: Download from https://storage.googleapis.com/mirror.tensorflow.org/github.com/tensorflow/runtime/archive/7d879c8b161085a4374ea481b93a52adb19c0529.tar.gz failed: class java.io.FileNotFoundException GET returned 404 Not Found
WARNING: Download from https://mirror.bazel.build/github.com/bazelbuild/rules_cc/archive/081771d4a0e9d7d3aa0eed2ef389fa4700dfb23e.tar.gz failed: class java.io.FileNotFoundException GET returned 404 Not Found
WARNING: Download from https://storage.googleapis.com/mirror.tensorflow.org/github.com/google/XNNPACK/archive/b9d4073a6913891ce9cbd8965c8d506075d2a45a.zip failed: class java.io.FileNotFoundException GET returned 404 Not Found
WARNING: Download from https://storage.googleapis.com/mirror.tensorflow.org/github.com/openxla/stablehlo/archive/43d81c6883ade82052920bd367c61f9e52f09954.zip failed: class java.io.FileNotFoundException GET returned 404 Not Found
INFO: Analyzed target //tmp:tensorflowlite_flex (0 packages loaded, 0 targets configured).
INFO: Found 1 target…
ERROR: /home/tensorflow-2.13.0/tensorflow/core/kernels/mkl/BUILD:347:22: Compiling tensorflow/core/kernels/mkl/mkl_softmax_op.cc [for host] failed: (Exit 1): gcc failed: error executing command
(cd /home/bazel-results/6897743e8077d4fe4767803ff084a13c/execroot/org_tensorflow &&
exec env -
DOCKER_HOST_CACHEBUSTER=1693700023214737835
LD_LIBRARY_PATH=/usr/local/nvidia/lib:/usr/local/nvidia/lib64
PATH=/root/.cache/bazelisk/downloads/bazelbuild/bazel-5.3.0-linux-x86_64/bin:/usr/local/nvidia/bin:/usr/local/cuda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/android/sdk/cmdline-tools/latest/bin:/android/sdk/platform-tools:/android/ndk
PWD=/proc/self/cwd
/usr/bin/gcc -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -g0 -O2 ‘-D_FORTIFY_SOURCE=1’ -DNDEBUG -ffunction-sections -fdata-sections ‘-std=c++0x’ -MD -MF bazel-out/host/bin/tensorflow/core/kernels/mkl/_objs/mkl_softmax_op/mkl_softmax_op.pic.d ‘-frandom-seed=bazel-out/host/bin/tensorflow/core/kernels/mkl/_objs/mkl_softmax_op/mkl_softmax_op.pic.o’ -fPIC -DEIGEN_MPL2_ONLY ‘-DEIGEN_MAX_ALIGN_BYTES=64’ -DHAVE_SYS_UIO_H -DTF_USE_SNAPPY -DTF_ENABLE_ACTIVITY_WATCHER ‘-DLLVM_ON_UNIX=1’ ‘-DHAVE_BACKTRACE=1’ ‘-DBACKTRACE_HEADER=<execinfo.h>’ ‘-DLTDL_SHLIB_EXT=“.so”’ ‘-DLLVM_PLUGIN_EXT=“.so”’ ‘-DLLVM_ENABLE_THREADS=1’ ‘-DHAVE_DEREGISTER_FRAME=1’ ‘-DHAVE_LIBPTHREAD=1’ ‘-DHAVE_PTHREAD_GETNAME_NP=1’ ‘-DHAVE_PTHREAD_H=1’ ‘-DHAVE_PTHREAD_SETNAME_NP=1’ ‘-DHAVE_REGISTER_FRAME=1’ ‘-DHAVE_SETENV_R=1’ ‘-DHAVE_STRERROR_R=1’ ‘-DHAVE_SYSEXITS_H=1’ ‘-DHAVE_UNISTD_H=1’ -D_GNU_SOURCE ‘-DHAVE_LINK_H=1’ ‘-DHAVE_MALLINFO=1’ ‘-DHAVE_SBRK=1’ ‘-DHAVE_STRUCT_STAT_ST_MTIM_TV_NSEC=1’ ‘-DLLVM_NATIVE_ARCH=“X86”’ ‘-DLLVM_NATIVE_ASMPARSER=LLVMInitializeX86AsmParser’ ‘-DLLVM_NATIVE_ASMPRINTER=LLVMInitializeX86AsmPrinter’ ‘-DLLVM_NATIVE_DISASSEMBLER=LLVMInitializeX86Disassembler’ ‘-DLLVM_NATIVE_TARGET=LLVMInitializeX86Target’ ‘-DLLVM_NATIVE_TARGETINFO=LLVMInitializeX86TargetInfo’ ‘-DLLVM_NATIVE_TARGETMC=LLVMInitializeX86TargetMC’ ‘-DLLVM_NATIVE_TARGETMCA=LLVMInitializeX86TargetMCA’ ‘-DLLVM_HOST_TRIPLE=“x86_64-unknown-linux-gnu”’ ‘-DLLVM_DEFAULT_TARGET_TRIPLE=“x86_64-unknown-linux-gnu”’ ‘-DLLVM_VERSION_MAJOR=17’ ‘-DLLVM_VERSION_MINOR=0’ ‘-DLLVM_VERSION_PATCH=0’ ‘-DLLVM_VERSION_STRING=“17.0.0git”’ -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS ‘-DBLAKE3_USE_NEON=0’ -DBLAKE3_NO_AVX2 -DBLAKE3_NO_AVX512 -DBLAKE3_NO_SSE2 -DBLAKE3_NO_SSE41 -DCURL_STATICLIB -iquote . -iquote bazel-out/host/bin -iquote external/com_google_absl -iquote bazel-out/host/bin/external/com_google_absl -iquote external/eigen_archive -iquote bazel-out/host/bin/external/eigen_archive -iquote external/nsync -iquote bazel-out/host/bin/external/nsync -iquote external/com_google_protobuf -iquote bazel-out/host/bin/external/com_google_protobuf -iquote external/zlib -iquote bazel-out/host/bin/external/zlib -iquote external/gif -iquote bazel-out/host/bin/external/gif -iquote external/libjpeg_turbo -iquote bazel-out/host/bin/external/libjpeg_turbo -iquote external/com_googlesource_code_re2 -iquote bazel-out/host/bin/external/com_googlesource_code_re2 -iquote external/farmhash_archive -iquote bazel-out/host/bin/external/farmhash_archive -iquote external/fft2d -iquote bazel-out/host/bin/external/fft2d -iquote external/highwayhash -iquote bazel-out/host/bin/external/highwayhash -iquote external/double_conversion -iquote bazel-out/host/bin/external/double_conversion -iquote external/snappy -iquote bazel-out/host/bin/external/snappy -iquote external/llvm-project -iquote bazel-out/host/bin/external/llvm-project -iquote external/llvm_terminfo -iquote bazel-out/host/bin/external/llvm_terminfo -iquote external/llvm_zlib -iquote bazel-out/host/bin/external/llvm_zlib -iquote external/curl -iquote bazel-out/host/bin/external/curl -iquote external/boringssl -iquote bazel-out/host/bin/external/boringssl -iquote external/jsoncpp_git -iquote bazel-out/host/bin/external/jsoncpp_git -Ibazel-out/host/bin/external/llvm-project/mlir/_virtual_includes/BuiltinAttributeInterfacesIncGen -Ibazel-out/host/bin/external/llvm-project/mlir/_virtual_includes/BuiltinAttributesIncGen -Ibazel-out/host/bin/external/llvm-project/mlir/_virtual_includes/BuiltinDialectBytecodeGen -Ibazel-out/host/bin/external/llvm-project/mlir/_virtual_includes/BuiltinDialectIncGen -Ibazel-out/host/bin/external/llvm-project/mlir/_virtual_includes/BuiltinLocationAttributesIncGen -Ibazel-out/host/bin/external/llvm-project/mlir/_virtual_includes/BuiltinOpsIncGen -Ibazel-out/host/bin/external/llvm-project/mlir/_virtual_includes/BuiltinTypeInterfacesIncGen -Ibazel-out/host/bin/external/llvm-project/mlir/_virtual_includes/BuiltinTypesIncGen -Ibazel-out/host/bin/external/llvm-project/mlir/_virtual_includes/CallOpInterfacesIncGen -Ibazel-out/host/bin/external/llvm-project/mlir/_virtual_includes/CastOpInterfacesIncGen -Ibazel-out/host/bin/external/llvm-project/mlir/_virtual_includes/FunctionInterfacesIncGen -Ibazel-out/host/bin/external/llvm-project/mlir/_virtual_includes/InferTypeOpInterfaceIncGen -Ibazel-out/host/bin/external/llvm-project/mlir/_virtual_includes/OpAsmInterfaceIncGen -Ibazel-out/host/bin/external/llvm-project/mlir/_virtual_includes/RegionKindInterfaceIncGen -Ibazel-out/host/bin/external/llvm-project/mlir/_virtual_includes/SideEffectInterfacesIncGen -Ibazel-out/host/bin/external/llvm-project/mlir/_virtual_includes/SymbolInterfacesIncGen -Ibazel-out/host/bin/external/llvm-project/mlir/_virtual_includes/TensorEncodingIncGen -Ibazel-out/host/bin/external/llvm-project/mlir/_virtual_includes/ArithBaseIncGen -Ibazel-out/host/bin/external/llvm-project/mlir/_virtual_includes/ArithCanonicalizationIncGen -Ibazel-out/host/bin/external/llvm-project/mlir/_virtual_includes/ArithOpsIncGen -Ibazel-out/host/bin/external/llvm-project/mlir/_virtual_includes/ArithOpsInterfacesIncGen -Ibazel-out/host/bin/external/llvm-project/mlir/_virtual_includes/InferIntRangeInterfaceIncGen -Ibazel-out/host/bin/external/llvm-project/mlir/_virtual_includes/VectorInterfacesIncGen -Ibazel-out/host/bin/external/llvm-project/mlir/_virtual_includes/ControlFlowInterfacesIncGen -Ibazel-out/host/bin/external/llvm-project/mlir/_virtual_includes/ControlFlowOpsIncGen -Ibazel-out/host/bin/external/llvm-project/mlir/_virtual_includes/FuncIncGen -Ibazel-out/host/bin/external/llvm-project/mlir/_virtual_includes/AsmParserTokenKinds -Ibazel-out/host/bin/external/llvm-project/mlir/_virtual_includes/QuantOpsIncGen -Ibazel-out/host/bin/external/llvm-project/mlir/_virtual_includes/LoopLikeInterfaceIncGen -Ibazel-out/host/bin/external/llvm-project/mlir/_virtual_includes/Mem2RegInterfacesIncGen -Ibazel-out/host/bin/external/llvm-project/mlir/_virtual_includes/DialectUtilsIncGen -Ibazel-out/host/bin/external/llvm-project/mlir/_virtual_includes/ViewLikeInterfaceIncGen -Ibazel-out/host/bin/external/llvm-project/mlir/_virtual_includes/PDLOpsIncGen -Ibazel-out/host/bin/external/llvm-project/mlir/virtual_includes/PDLTypesIncGen -Ibazel-out/host/bin/external/llvm-project/mlir/virtual_includes/PDLInterpOpsIncGen -Ibazel-out/host/bin/external/llvm-project/mlir/virtual_includes/ConversionPassIncGen -Ibazel-out/host/bin/external/llvm-project/mlir/virtual_includes/TransformsPassIncGen -Ibazel-out/host/bin/external/llvm-project/mlir/virtual_includes/DerivedAttributeOpInterfaceIncGen -Ibazel-out/host/bin/external/llvm-project/mlir/virtual_includes/RuntimeVerifiableOpInterfaceIncGen -isystem third_party/eigen3/mkl_include -isystem bazel-out/host/bin/third_party/eigen3/mkl_include -isystem external/eigen_archive -isystem bazel-out/host/bin/external/eigen_archive -isystem external/nsync/public -isystem bazel-out/host/bin/external/nsync/public -isystem external/com_google_protobuf/src -isystem bazel-out/host/bin/external/com_google_protobuf/src -isystem external/zlib -isystem bazel-out/host/bin/external/zlib -isystem external/gif -isystem bazel-out/host/bin/external/gif -isystem external/farmhash_archive/src -isystem bazel-out/host/bin/external/farmhash_archive/src -isystem external/llvm-project/llvm/include -isystem bazel-out/host/bin/external/llvm-project/llvm/include -isystem external/llvm-project/mlir/include -isystem bazel-out/host/bin/external/llvm-project/mlir/include -isystem external/curl/include -isystem bazel-out/host/bin/external/curl/include -isystem external/boringssl/src/include -isystem bazel-out/host/bin/external/boringssl/src/include -isystem external/jsoncpp_git/include -isystem bazel-out/host/bin/external/jsoncpp_git/include -g0 -g0 ‘-std=c++17’ -DEIGEN_AVOID_STL_ARRAY -Iexternal/gemmlowp -Wno-sign-compare ‘-ftemplate-depth=900’ -fno-exceptions -DINTEL_MKL -DAMD_ZENDNN -msse3 -DTENSORFLOW_MONOLITHIC_BUILD -pthread -fexceptions -fno-canonical-system-headers -Wno-builtin-macro-redefined '-D__DATE=“redacted”’ '-D__TIMESTAMP=“redacted”’ '-D__TIME=“redacted”’ -c tensorflow/core/kernels/mkl/mkl_softmax_op.cc -o bazel-out/host/bin/tensorflow/core/kernels/mkl/_objs/mkl_softmax_op/mkl_softmax_op.pic.o)

Configuration: f7736c66a1c5d6543b9d473ac02e097194c3e108f3c8a13c26323b744862e63b

Execution platform: @local_execution_config_platform//:platform

In file included from tensorflow/core/kernels/mkl/dnnl.hpp:34,
from tensorflow/core/kernels/mkl/mkl_softmax_op.cc:20:
tensorflow/core/kernels/mkl/oneapi/dnnl/dnnl.h:23:10: fatal error: oneapi/dnnl/dnnl_common.h: No such file or directory
23 | #include “oneapi/dnnl/dnnl_common.h”
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Target //tmp:tensorflowlite_flex failed to build

It seems to be a consistent error in all the Intel - Linux machines I’ve tried. At lines 52 to 60 of my Dockerfile I tried to solve this issue by including the source files from oneAPI into the source files of Tensorflow, but the same error keeps showing.

I appreciate your help.