No session factory registered for the given session options: {target: "" config: } Registered factories are {}
### Issue type

Build/Install

### Have you reproduced the bug with TensorFlow Nightly?

No

### Source

source

### TensorFlow version

tf2.8.3

### Custom code

Yes

### OS platform and distribution

Linux Centos7.5

### Mobile device

_No response_

### Python version

3.8

### Bazel version

4.2.4

### GCC/compiler version

8.3.1

### CUDA/cuDNN version

None

### GPU model and memory

None

### Current behavior?

1. Try to create a new TensorFlow session:
```
Session* session;
Status status = NewSession(SessionOptions(), &session);
```

2. Compile succeeds:
```
g++ -o "build64_release/thirdparty/tensorflow-2.8.3/tf_test.objs/tf_test.cc.o" -c -std=gnu++14 -msse4.2 -faligned-new -Wno-invalid-offsetof -Werror=conversion-null -Werror=reorder -Werror=non-virtual-dtor -Werror=overloaded-virtual -fPIC -m64 -mcx16 -pipe -g -DNDEBUG -D_FILE_OFFSET_BITS=64 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -g -Wall -Wextra -Wno-unused-but-set-variable -Wno-unused-parameter -Wno-unused-local-typedefs -Wno-missing-field-initializers -Wno-unused-function -Wendif-labels -Wformat=2 -Wframe-larger-than=69632 -Wmissing-include-dirs -Wpointer-arith -Wwrite-strings -Werror=char-subscripts -Werror=comments -Werror=empty-body -Werror=endif-labels -Werror=format -Werror=missing-include-dirs -Werror=overflow -Werror=parentheses -Werror=return-type -Werror=sequence-point -Werror=sign-compare -Werror=switch -Werror=type-limits -Werror=uninitialized -Werror=unused-label -Werror=unused-result -Werror=unused-value -Werror=unused-variable -Werror=write-strings -Werror=vla -O3 -fno-omit-frame-pointer -Wno-error=overloaded-virtual -lm -Wl,--allow-multiple-definition -Wl,--whole-archive -Wl,--no-as-needed -Ithirdparty/protobuf/src -Ithirdparty -Ibuild64_release -I. -Ithirdparty/tensorflow-2.8.3/include "thirdparty/tensorflow-2.8.3/tf_test.cc"
g++ -o "build64_release/thirdparty/tensorflow-2.8.3/tf_test" -m64 -static-libgcc -static-libstdc++ -Wl,--rpath-link=build64_release/thirdparty/tensorflow-2.8.3 build64_release/version.os "build64_release/thirdparty/tensorflow-2.8.3/tf_test.objs/tf_test.cc.o" "build64_release/thirdparty/tensorflow-2.8.3/libtensorflow_framework.so"
```

3. But running the code gives:
```
2023-11-14 15:00:31.456030: E tensorflow/core/common_runtime/session.cc:81] Failed to get session factory: NOT_FOUND: No session factory registered for the given session options: {target: "" config: } Registered factories are {}.
```

4. I have tried as [#3308](https://github.sheincorp.cn/tensorflow/tensorflow/issues/3308) and [#36433](https://github.sheincorp.cn/tensorflow/tensorflow/issues/36433), but it didn't work.

### Standalone code to reproduce the issue

```shell
#include "thirdparty/tensorflow-2.8.3/include/tensorflow/core/public/session.h"
#include "thirdparty/tensorflow-2.8.3/include/tensorflow/core/platform/env.h"
#include "thirdparty/tensorflow-2.8.3/include/tensorflow/cc/client/client_session.h"

using namespace tensorflow;

/**
 * @brief deep model for click through rate prediction
 * @details [long description]
 *
 * @param argv[1] graph protobuf
 *
 * @return [description]
 */
int main(int argc, char* argv[]) {
  // Initialize a tensorflow session
  Session* session;
  Status status = NewSession(SessionOptions(), &session);
  if (!status.ok()) {
    std::cerr << status.ToString() << std::endl;
    return 1;
  } else {
    std::cout << "Session created successfully" << std::endl;
  }

  // Load the protobuf graph
  GraphDef graph_def;
  std::string graph_path = "/develop/testdata/serving_demo/ps/ps1.11.64";
  status = ReadBinaryProto(Env::Default(), graph_path, &graph_def);
  if (!status.ok()) {
    std::cerr << status.ToString() << std::endl;
    return 1;
  } else {
    std::cout << "Load graph protobuf successfully" << std::endl;
  }

  // Add the graph to the session
  status = session->Create(graph_def);
  if (!status.ok()) {
    std::cerr << status.ToString() << std::endl;
    return 1;
  } else {
    std::cout << "Add graph to session successfully" << std::endl;
  }

  // Setup inputs and outputs:

  // Our graph doesn't require any inputs, since it specifies default values,
  // but we'll change an input to demonstrate.
  Tensor a(DT_FLOAT, TensorShape());
  a.scalar<float>()() = 3.0;

  Tensor b(DT_FLOAT, TensorShape());
  b.scalar<float>()() = 2.0;

  std::vector<std::pair<string, tensorflow::Tensor>> inputs = {
    { "a", a },
    { "b", b },
  };

  // The session will initialize the outputs
  std::vector<tensorflow::Tensor> outputs;

  // Run the session, evaluating our "c" operation from the graph
  status = session->Run(inputs, {"c"}, {}, &outputs);
  if (!status.ok()) {
    std::cerr << status.ToString() << std::endl;
    return 1;
  } else {
    std::cout << "Run session successfully" << std::endl;
  }

  // Grab the first output (we only evaluated one graph node: "c")
  // and convert the node to a scalar representation.
  auto output_c = outputs[0].scalar<float>();

  // (There are similar methods for vectors and matrices here:
  // https://github.com/tensorflow/tensorflow/blob/master/tensorflow/core/public/tensor.h)

  // Print the results
  std::cout << outputs[0].DebugString() << std::endl; // Tensor<type: float shape: [] values: 30>
  std::cout << "output value: " << output_c() << std::endl; // 30

  // Free any resources used by the session
  session->Close();

  return 0;
}
```


### Relevant log output

_No response_