Okay it works now. The package libstdc++ wasn't installed. Added it to the post above.
tdnf install libstdc++
Some observations:
WSL2 is weired. It somehow uses the NVidia GPU drivers installed on Windows and interacts with the WSL2'ified Photon OS. From a security perspective I would say there are concerns.
Ollama speed is more than 20x faster than in CPU-only mode. This is great news.
With Photon OS on Workstation 17 Pro, the resources used are lower than in comparison to WSL2. Especially, the fan doesn't kick-in in idle mode. However actually it cannot make use of the NVidia adapter.
Photon OS on vSphere or baremetal provisioned still is the best fit for lowest resource consumption, security and speed.
edited: One culprit on WSL2 is the complexity of make use of audio. An audio device is missing.
I've tried to get it run by using a component called AudioPulse, but actually it does not work.
Good suggestions are welcome! I leave the code snippets here if someone is interested.
# WSL2 seems to make use of virtio driver bits
lspci -k
00:00.0 : (rev 01) virtio-pci
00:00.0 : (rev 01) virtio-pci
00:00.0 : (rev 00) dxgkrnl
00:00.0 : (rev 01) virtio-pci
00:00.0 : (rev 00) dxgkrnl
00:00.0 : (rev 01) virtio-pci
00:00.0 : (rev 01) virtio-pci
00:00.0 : (rev 01) virtio-pci
00:00.0 : (rev 01) virtio-pci
00:00.0 : (rev 01) virtio-pci
00:00.0 : (rev 01) virtio-pci
00:00.0 : (rev 01) virtio-pci
00:00.0 : (rev 01) virtio-pci
# Correct time is needed as prerequisite.
# This snippet however is uncurated. ntpd does not work in WSL2 because systemd isn't the booted init system.
tdnf install -y ntp iptables
# add your servers to /etc/ntp.conf
iptables -A INPUT -i eth0 -p udp --dport 123 -j ACCEPT
iptables-save >/etc/systemd/scripts/ip4save
ip6tables-save >/etc/systemd/scripts/ip6save
systemctl enable ntpd
set <continent/town> timezone
ln -sf /usr/share/zoneinfo/<continent>/<town> /etc/localtime
ntpdate -s <your ntp server>
hwclock --systohc --localtime
# A few bits have to be compiled and downloaded. Hence, build-essential and pip is installed.
tdnf install -y build-essential python3-pip
# On WSL2 an audio device is missing.
# An option could be to use PulseAudio. PulseAudio uses sndfile, but the installation of sndfile fails.
pip3 install sndfile # THIS FAILS. The Linux distro isn't recognized and the headerfile sndfile.h is missing.
# As alternative, compiling from source https://github.com/libsndfile/libsndfile, fails, too.
# The following recipe does not work without sndfile.
tdnf install -y meson cmake
git clone https://github.com/pulseaudio/pulseaudio
cd pulseaudio/
meson build
meson compile -C build
build/src/daemon/pulseaudio -n -F build/src/daemon/default.pa -p $(pwd)/build/src/modules/
cd ..
# install google_speech. PulseAudio and libsox are prerequisites.
git clone https://github.com/dmkrepo/libsox
cd libsox/
autoreconf -i
./configure
make -s
make install
cd ..
pip3 install google_speech
google_speech "Hello world."