Hi. (I already posted similar question on stack overflow, but reposting here for visbility).
I am following instructions here: Reduce TensorFlow Lite binary size 1.
Tensorflow version: 2.6.0, and i am running everything in a devel-cpu docker container as found in tensorflow/tools/dockerfiles (which is, worth noting, ubuntu 18.04 image). Here is my BUILD file:
load(
    "//tensorflow/lite:build_def.bzl",
    "tflite_custom_cc_library",
    "tflite_cc_shared_object",
)

load(
    "//tensorflow/lite/delegates/flex:build_def.bzl",
    "tflite_flex_cc_library",
)

tflite_flex_cc_library(
  name = "selective_cc_flex",
  models = [
     ":saved_model.tflite",
  ],
)

tflite_custom_cc_library(
    name = "selective_cc_builtin",
    models = [
        ":saved_model.tflite",
    ],
)

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": [
        "//conditions:default": [
            "-Wl,-z,defs",
            "-Wl,--version-script,$(location //tensorflow/lite:tflite_version_script.lds)",
        ],
    }),
    per_os_targets = True,
    deps = [
        ":selective_cc_builtin",
        "//tensorflow/lite:tflite_exported_symbols.lds",
        "//tensorflow/lite:tflite_version_script.lds",
   #        ":selective_cc_flex",
   #     "//tensorflow/lite/delegates/flex:exported_symbols.lds",
   #     "//tensorflow/lite/delegates/flex:version_script.lds",

    ],
)

Which for convenience includes both built-in and flex selective build in one file, but otherwise is more or less identical to what happens in the instructions. I just change the final dependency if i want to try one or the other.
I tried both with exactly the same outcome: no matter what library i copy for the saved_model.tflite, i get exactly the same tensorflowlite.so binary size.
For example, if I compile for --config=elinux_armhf, built-in operations, I always get a binary of 3,198,770, no matter which model i use for saved_model.tflite. If I use, for example, SPICE model from the same page, i still get this over 3Mb size, whereas the same instruction page advertises at the moment 376kb aar for Android. It is not quite the same, but it would have the jni version of the same .so inside it, which, if I read TF bazel build correctly, more or less follows the same path of operation filtering.
Similarly, if I build for flex (aka SELECT TF) ops, i get north of 200 Mb(!) binaries on x86, whereas advertised size for android is ~1.7kb, give or take. I get similarly gargantuan footprints for elinux_armhf and elinux_aarch64 builds.
What am I doing wrong? Or perhaps my expectations are wrong? If so, then i don’t see a difference between selective build and a regular build.
Thank you.