"ImportError: random_device could not be read" when importing duckdb after importing tensorflow
This seems very similar to https://uwekorn.com/2019/09/15/how-we-build-apache-arrows-manylinux-wheels.html#annoying-end-users-issue-2-segmentation-fault-after-import-tensorflow, so I suspect the issue has something to do with the `_GLIBCXX_USE_CXX11_ABI` flag. @sid-kap,
I tried to execute the mentioned code on tensorflow v2.13, v2.12 and tf-nightly. Kindly find the gist of it [here](https://colab.research.google.com/gist/tilakrayal/25a6f2b3b81630aec6065a9a68e8ed3a/untitled1350.ipynb). Also I tried with tensorflow-macos M1 aswell and was able to execute the code without any crash/error.
<img width="497" alt="image (16)" src="https://github.com/tensorflow/tensorflow/assets/81610181/dba17d19-090c-4724-8f1e-b0aeed3b8096">
<img width="497" alt="image (17)" src="https://github.com/tensorflow/tensorflow/assets/81610181/3e40f6b8-56a9-490f-bb6f-e395ec24e4a2">

And also it doesn't looks like an issue from the tensorflow side. Thank you!
 I was able to reproduce in a Colab notebook [here](https://colab.research.google.com/drive/11NueSQT-ch8ySQrKXR1tlgjdPTcPYz4E?usp=sharing) The solution for me was to set
```python
LD_PRELOAD="/lib/x86_64-linux-gnu/libstdc++.so.6"
```
before starting the python interpreter, as suggested in https://github.com/pytorch/pytorch/issues/102360#issuecomment-1708989096.

Would still be nice to understand the root cause. Hi, we are looking at some errors that appear whenever we import `tensorflow` first and then another project. We believe we have narrowed it down to `std::random_device` being defined in this library:

```
$ nm -an libtensorflow_framework.so.2 | grep  random_device | c++filt 
0000000001cbac50 T std::random_device::_M_init(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
0000000001cbad10 T std::random_device::_M_fini()
0000000001cbad30 T std::random_device::_M_getval()
0000000001cbadb0 T std::random_device::_M_getentropy() const
0000000001cbae70 T std::random_device::_M_init_pretr1(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
0000000001cbb040 T std::random_device::_M_getval_pretr1()
```

There are a several other symbols that are normally defined in libstdc++ but are instead available in `libtensorflow_framework.so.2`.

Is there a good reason for these symbols to be exported? @erick-xanadu Can you check if those symbols are still defined in a recent TF nightly (`tf-nightly==2.15.0.dev20230804` or later)?

It seems like Google rarely patches old versions of TensorFlow, so even if we identified the fix they are unlikely to patch 2.13 or 2.14. (2.14 is not released yet, but it seems like it doesn't include commits after Aug 2.) It would be good to confirm that this will at least be fixed in 2.15. ```bash
(env) erick.ochoalopez@DL7420-GS4N1J3:~/Downloads/CodeTemporary$ pip install tf-nightly==2.15.0.dev20230804
Collecting tf-nightly==2.15.0.dev20230804
  Downloading tf_nightly-2.15.0.dev20230804-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (491.8 MB)
  
### ---snip---

(env) erick.ochoalopez@DL7420-GS4N1J3:~/Downloads/CodeTemporary/env/lib64/python3.10/site-packages/tensorflow$ nm -an libtensorflow_framework.so.2 | grep  random_device | c++filt 
00000000020a6bb0 T std::random_device::_M_init(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
00000000020a6c70 T std::random_device::_M_fini()
00000000020a6c90 T std::random_device::_M_getval()
00000000020a6d10 T std::random_device::_M_getentropy() const
00000000020a6dd0 T std::random_device::_M_init_pretr1(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
00000000020a6e40 T std::random_device::_M_getval_pretr1()

### --- snip ---

(env) erick.ochoalopez@DL7420-GS4N1J3:~/Downloads/CodeTemporary/env/lib64/python3.10/site-packages/tensorflow$ python -c "import tensorflow as tf; print(tf.version.GIT_VERSION, tf.version.VERSION)"
2023-10-05 12:58:49.764634: I tensorflow/core/util/port.cc:111] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable `TF_ENABLE_ONEDNN_OPTS=0`.
2023-10-05 12:58:49.767231: I tensorflow/tsl/cuda/cudart_stub.cc:28] Could not find cuda drivers on your machine, GPU will not be used.
2023-10-05 12:58:49.807953: E tensorflow/compiler/xla/stream_executor/cuda/cuda_dnn.cc:9346] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered
2023-10-05 12:58:49.808003: E tensorflow/compiler/xla/stream_executor/cuda/cuda_fft.cc:609] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered
2023-10-05 12:58:49.808034: E tensorflow/compiler/xla/stream_executor/cuda/cuda_blas.cc:1518] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered
2023-10-05 12:58:49.814929: I tensorflow/tsl/cuda/cudart_stub.cc:28] Could not find cuda drivers on your machine, GPU will not be used.
2023-10-05 12:58:49.815194: I tensorflow/core/platform/cpu_feature_guard.cc:182] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.
To enable the following instructions: AVX2 AVX512F AVX512_VNNI FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.
2023-10-05 12:58:50.790420: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT
WARNING:tensorflow:From /home/erick.ochoalopez/Downloads/CodeTemporary/env/lib/python3.10/site-packages/tensorflow/python/ops/distributions/distribution.py:259: ReparameterizationType.__init__ (from tensorflow.python.ops.distributions.distribution) is deprecated and will be removed after 2019-01-01.
Instructions for updating:
The TensorFlow Distributions library has moved to TensorFlow Probability (https://github.com/tensorflow/probability). You should update all references to use `tfp.distributions` instead of `tf.distributions`.
WARNING:tensorflow:From /home/erick.ochoalopez/Downloads/CodeTemporary/env/lib/python3.10/site-packages/tensorflow/python/ops/distributions/bernoulli.py:165: RegisterKL.__init__ (from tensorflow.python.ops.distributions.kullback_leibler) is deprecated and will be removed after 2019-01-01.
Instructions for updating:
The TensorFlow Distributions library has moved to TensorFlow Probability (https://github.com/tensorflow/probability). You should update all references to use `tfp.distributions` instead of `tf.distributions`.
v1.12.1-97980-g93990114b0d 2.15.0-dev20230804

``` @sid-kap,
Could you please check in the latest TensorFlow v2.16, as most of the bugs are resolved in the latest version. As mentioned, I don't find any issue in the Mac-os or the colab. Thank you! Yes, it has been fixed since 2.15 for me @sid-kap,
Glad the issue got fixed. Could you please feel free to move this issue to closed status. Thank you! Are you satisfied with the resolution of your issue?
<a href="https://docs.google.com/forms/d/e/1FAIpQLSfaP12TRhd9xSxjXZjcZFNXPGk4kc1-qMdv3gc6bEP90vY1ew/viewform?entry.85265664=Yes&entry.2137816233=https://github.com/tensorflow/tensorflow/issues/61741">Yes</a>
<a href="https://docs.google.com/forms/d/e/1FAIpQLSfaP12TRhd9xSxjXZjcZFNXPGk4kc1-qMdv3gc6bEP90vY1ew/viewform?entry.85265664=No&entry.2137816233=https://github.com/tensorflow/tensorflow/issues/61741">No</a>

### Issue type

Bug

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

Yes

### Source

binary

### TensorFlow version

2.13

### Custom code

No

### OS platform and distribution

python:3.10-slim-bookworm

### Mobile device

_No response_

### Python version

3.10

### Bazel version

_No response_

### GCC/compiler version

_No response_

### CUDA/cuDNN version

_No response_

### GPU model and memory

_No response_

### Current behavior?

In a linux x86_64 machine in a python3.10 venv that contains `tensorflow==2.13.0` and `duckdb==0.8.1`, running this python code:
```python
import tensorflow
import duckdb
```
either hangs indefinitely or crashes with 
```
ImportError: random_device could not be read
```

This happens with tensorflow 2.12 and tensorflow 2.13, but not tensorflow 2.11 or 2.11.1.
It happens with both duckdb 0.7.1 and duckdb 0.8.1.

It also happens with all nightlies from July up to `tf-nightly==2.15.0.dev20230803`, but the problem is fixed starting on `tf-nightly==2.15.0.dev20230804` and all nightlies after that.

### Standalone code to reproduce the issue

```shell
python3.10 -m venv ./venv
source ./venv/bin/activate
pip install tensorflow==2.13.0 duckdb==0.8.1
python -c 'import tensorflow; print("done importing tensorflow"); import duckdb'
```


### Relevant log output

_No response_