View Issue Details

IDProjectCategoryView StatusLast Update
0003736OpenFOAMBugpublic2021-10-19 11:04
ReporterfelipeAssigned Tochris 
PrioritynormalSeverityminorReproducibilityN/A
Status resolvedResolutionfixed 
PlatformUBUNTU 20.04OSWindowsOS Version10
Product Version9 
Fixed in Version 
Summary0003736: Issue launching paraFoam
DescriptionparaFoam doesn't lauch anything and I get the following message:

felipe@VSAV418PROY:~/OpenFOAM/felipe-9/run/cavity$ paraFoam &
[2] 288
felipe@VSAV418PROY:~/OpenFOAM/felipe-9/run/cavity$ Created temporary 'cavity.OpenFOAM'
/opt/paraviewopenfoam56/lib/paraview: error while loading shared libraries: libQt5Core.so.5: cannot open shared object file: No such file or directory
Steps To ReproduceI've just installed OpenFOAM following the instructions from this page: https://openfoam.org/download/9-ubuntu/
Then, as I was following the instructions from the tutorial on this page: https://cfd.direct/openfoam/user-guide/v9-cavity/#x5-110002.1.2 , on step 2.1.2, the bug occurred after writing " paraFoam & "
Additional InformationI'm a complete newb on Ubuntu and OpenFOAM, perhaps I've made an obvious mistake...
TagsNo tags attached.

Activities

wyldckat

2021-10-06 16:08

updater   ~0012214

OK, this one was not a easy fix and what I'm going to describe now is just working around the real issue: it seems to be WSL's v1 fault and has been for over 2 years, the odd thing is that it only revealed itself more recently in Ubuntu, apparently due to the linker libraries...

Sources for this fix:
- https://askubuntu.com/questions/1034313/ubuntu-18-4-libqt5core-so-5-cannot-open-shared-object-file-no-such-file-or-dir
- https://github.com/microsoft/WSL/issues/3023
- https://github.com/YosysHQ/nextpnr/issues/444
- https://stackoverflow.com/questions/63627955/cant-load-shared-library-libqt5core-so-5
- https://discourse.paraview.org/t/build-paraview-inside-windows-subsystem-for-linux-wsl/6439/15

The workaround is as follows:

1. Install VcXsrv, instead of Xming. It's a lot more recent and it has a lot more options: https://sourceforge.net/projects/vcxsrv/files/vcxsrv/

    - I used the installer "vcxsrv-64.1.20.9.0.installer.exe"

2. Then start 'XLaunch' that was installed with VcXsrv and configure the "Extra settings" window as explained here: https://discourse.paraview.org/t/build-paraview-inside-windows-subsystem-for-linux-wsl/6439/16 - namely:
   a. Unselect the Native opengl
   b. Select the "Disable access control" option.

3. Now comes a somewhat annoying workaround, which may limit Qt5's usability in your WSL-Ubuntu installation, which is to run the following command:

    sudo strip --remove-section=.note.ABI-tag /usr/./lib/x86_64-linux-gnu/libQt5Core.so.5

    - This will remove the bit that breaks WSL's mask in pretending to be a valid Linux Kernel, but may make a few other applications get confused with the missing note/tag.

    - You can reinstall this library by running:
         sudo apt install --reinstall libqt5core5a

4. The rest is as per instructions given here: https://openfoam.org/download/windows/ - with the exception of replacing Xming with VcXsrv.

wyldckat

2021-10-06 16:15

updater   ~0012215

A somewhat better workaround without damaging Qt5's default installation on Ubuntu, is to run the following commands:

   sudo cp /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 /opt/paraviewopenfoam56/mesa/lib/
   sudo strip --remove-section=.note.ABI-tag /opt/paraviewopenfoam56/mesa/lib/libQt5Core.so.5

wyldckat

2021-10-06 16:16

updater   ~0012216

@Chris With these findings, the changes I propose for this page: https://openfoam.org/download/windows/ - are as follows:

1. Replace Xming with VcXsrv, since it's a lot more recent and it has a lot more options: https://sourceforge.net/projects/vcxsrv/files/vcxsrv/
2. Have the users run the following workaround or provide the Qt5 library already modified in the Deb package with these commands?

   sudo cp /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 /opt/paraviewopenfoam56/mesa/lib/
   sudo strip --remove-section=.note.ABI-tag /opt/paraviewopenfoam56/mesa/lib/libQt5Core.so.5

felipe

2021-10-07 17:10

reporter   ~0012217

Thanks a lot!

FYI, the first suggestion didn't work out, but I reinstalled libqt5core5a as you instructed, then tried the second workaround and this time it worked great.

chris

2021-10-07 19:46

manager   ~0012218

@wyldckat @felipe Thanks for working through this issue.

Just confirming the suggestion to change the windows installation page at: https://openfoam.org/download/windows/

1) Use VcXsrv instead of Xming, configure settings as described above

2) IF you get the error message:
/opt/paraviewopenfoam56/lib/paraview: error while loading shared libraries: libQt5Core.so.5: cannot open shared object file: No such file or directory

then run
sudo cp /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 /opt/paraviewopenfoam56/mesa/lib/
sudo strip --remove-section=.note.ABI-tag /opt/paraviewopenfoam56/mesa/lib/libQt5Core.so.5

chris

2021-10-07 22:37

manager   ~0012219

@wyldckat Let me know if the note above is what you suggest here

wyldckat

2021-10-08 10:58

updater   ~0012220

@Chris: Yes, that's exactly it!

I've only confirmed this for Ubuntu 20.04, I have no idea if this is still an issue on Ubuntu versions 20.10 and 21.04/10.


An additional quick suggestion/note as well: is it possible to have an automatic link that links people to the latest OpenFOAM version? It would be useful for this Windows page, given that it's rarely updated (given it was still at OpenFOAM 8 the other day).

chris

2021-10-08 12:00

manager   ~0012221

@wyldckat

We have always had this link:
https://openfoam.org/latest

But here, I suspect you mean a link to the latest version packed for Ubuntu. Is that correct?

wyldckat

2021-10-08 12:12

updater   ~0012222

@Chris: Yes, I'm referring to the Ubuntu package, if possible.
If not, having a link to the latest one would already be a nice feature.

The other alternative would be to have a dummy deb package that always points to the latest stable package... and mention that on the Windows page.

chris

2021-10-08 13:40

manager   ~0012223

@wyldckat
OK, added this temporary redirect (so it can be modified)
https://openfoam.org/download/latest-ubuntu

Before I change the Windows install page, I need to check:
+ In Enabling Graphical Applications, does the user still need to do set the DISPLAY environment variable?
+ I assume the changes are for Ubuntu 20.04? (We should not maintain instructions for different versions of Ubuntu)

wyldckat

2021-10-08 15:34

updater   ~0012224

@Chris

> + In Enabling Graphical Applications, does the user still need to do set the DISPLAY environment variable?

Yes, it's still necessary.


> + I assume the changes are for Ubuntu 20.04? (We should not maintain instructions for different versions of Ubuntu)

This is something that occurs due to WSL v1, namely the subsystem that pretends that it's a Linux Kernel, so it has been affecting several Linux Distributions since 2019.
Ubuntu 22.04 is the next major version that will possibly be supported on WSL v1...


As for WSL v2, it still needs VcXsrv and the settings aforementioned, but it's a whole other ball game when in comes to installation and setting up... I'll open another report regarding WSL v2.

chris

2021-10-11 09:37

manager   ~0012227

@wyldckat I am trying to update the instructions on installing on Windows.
I don't have access to Windows so am operating blind. So I need to run some questions by you.

The first big issue is the version of WSL. The instructions direct the reader to
https://docs.microsoft.com/en-gb/windows/wsl/install

As usual, the MS documentation is unclear, confusing, incomplete, circularly referencing, etc. Basically garbage.

Under the WSL install command it says: "This command will enable the required optional components, download the latest Linux kernel, set WSL 2 as your default, and install a Linux distribution for you (Ubuntu by default, see below to change this)."

This seems to indicate that the user will get WSL v2. You seem to indicate they need to use WSL v1.

What do we say here in our instructions?

When they install WSL v1, is Ubuntu 20.04 the default? (MS docs say nothing about version of Ubuntu).

chris

2021-10-11 09:53

manager   ~0012228

@wyldckat I have made edits you mentioned:
https://openfoam.org/download/windows/

I think we just need to clarify the WSL installation

wyldckat

2021-10-12 17:50

updater   ~0012233

@Chris
Quick side note: "pavaview" typo in the "Problem running ParaView" section, namely it's "para" and not "pava" ;)

I might as well write the WSL v2 report here, instead of opening a new one.

WSL acts as if it was a form of virtualization software:
- v1 would pretend that it was a Linux kernel, so it was similar to using chroot on Linux, while using its own virtual filesystem.
- v2 uses VM technology to instead use a real Linux Kernel, hence minimizing compatibility issues to a minimum.

This means that both versions don't care if the end-user wants Ubuntu, Fedora, OpenSUSE or any other Linux distribution.

Now, the annoying part is that WSL v2 also has it's flaws, namely that it's not as straight forward as v1 was. Which leads us to two user scenarios:

A- In a clean Windows install, namely the user is installing WSL for the first time, it should work as described in the official documentation. Therefore:

  1. VcXsrv is needed as described.

  2. The hack for "libQt5Core.so.5" associated to WSL v1 is no longer needed.

  3. The following line:

      echo "export DISPLAY=:0" >> ${HOME}/.bashrc

    now becomes:

      echo 'export DISPLAY=$(awk \'/nameserver / {print $2; exit}\' /etc/resolv.conf 2>/dev/null):0' >> ${HOME}/.bashrc

    Why? It's now a legitimate VM, therefore it needs its own virtual network connection.

    - An alternative to get the up-to-date guest IP address is to use instead this command, in case "resolv.conf" was somehow disabled:

      echo 'export DISPLAY=$(ip route | awk \'/^default/{print $3; exit}\'):0' >> ${HOME}/.bashrc

So, if it's a clean install, following the official instructions should work.

Source on the ways to set "DISPLAY": https://stackoverflow.com/questions/61110603/how-to-set-up-working-x11-forwarding-on-wsl2


The scenario B will be in my next comment.

wyldckat

2021-10-12 18:02

updater   ~0012234

Scenario B - If the user already has WSL v1 installed, things get a little bit trickier...
Nonetheless, here are the steps I had to do in order to upgrade Ubuntu 20.04 installation from WSL v1 to v2:

1. Follow the official instructions for upgrading from v1 to v2: https://docs.microsoft.com/en-gb/windows/wsl/install-manual

2. After rebooting the Windows machine, upgrade the Ubuntu installation with the following commands from a command line:

    wsl -l -v
    wsl --set-version Ubuntu-20.04 2

  where "Ubuntu-20.04" is the name of the distribution installed... the user might have more than one Ubuntu version installed or simply have the one named "Ubuntu" from the MS Store, which provides the latest Ubuntu LTS version (20.04 at the moment).

3. Regarding firewall, to allow the VM to communicate the X protocol via virtual network, is a pain to explain it right now... there are already a few instructions online, such as the following: https://github.com/cascadium/wsl-windows-toolbar-launcher#firewall-rules

chris

2021-10-18 14:23

manager   ~0012239

@wyldckat Apologies for the delay on this.

I have updated the page:
https://openfoam.org/download/windows/

Let me know if you think this is OK assuming we ignore:
+ disabling of resolv.conf
+ scenario B: upgrade from WSL v1 to WSL v2 (scenario B)

wyldckat

2021-10-18 15:00

updater   ~0012240

@Chris No problem for the delay... at least I don't think so...

The page now looks perfectly fine, it covers the majority of the issues.
Anything beyond this is up to the end user to sort out on their own... and/or pointing them to this report will also help them sorting it out on their own.

chris

2021-10-19 10:59

manager   ~0012242

@wyldckat Thanks for your response and your hard work on this.
I think we are OK to close the thread.

chris

2021-10-19 11:04

manager   ~0012243

Windows installation page updated, based on discussion:
https://openfoam.org/download/windows/

There may be 1-2 minor additions which can be dealt with when needed.

At the end of the day, Microsoft are a $1 trillion company so they should be funding the support of OpenFOAM on their OS:
https://openfoam.org/supporters/

Issue History

Date Modified Username Field Change
2021-10-05 21:00 felipe New Issue
2021-10-06 16:08 wyldckat Note Added: 0012214
2021-10-06 16:15 wyldckat Note Added: 0012215
2021-10-06 16:16 wyldckat Note Added: 0012216
2021-10-06 16:16 wyldckat Assigned To => chris
2021-10-06 16:16 wyldckat Status new => assigned
2021-10-07 17:10 felipe Note Added: 0012217
2021-10-07 19:46 chris Note Added: 0012218
2021-10-07 22:37 chris Note Added: 0012219
2021-10-08 10:58 wyldckat Note Added: 0012220
2021-10-08 12:00 chris Note Added: 0012221
2021-10-08 12:12 wyldckat Note Added: 0012222
2021-10-08 13:40 chris Note Added: 0012223
2021-10-08 15:34 wyldckat Note Added: 0012224
2021-10-11 09:37 chris Note Added: 0012227
2021-10-11 09:53 chris Note Added: 0012228
2021-10-12 17:50 wyldckat Note Added: 0012233
2021-10-12 18:02 wyldckat Note Added: 0012234
2021-10-18 14:23 chris Note Added: 0012239
2021-10-18 15:00 wyldckat Note Added: 0012240
2021-10-19 10:59 chris Note Added: 0012242
2021-10-19 11:04 chris Status assigned => resolved
2021-10-19 11:04 chris Resolution open => fixed
2021-10-19 11:04 chris Note Added: 0012243