CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Installation (
-   -   OpenFOAM isn't working anymore: "blockMesh: error while loading shared libraries" (

Leech October 18, 2010 16:35

OpenFOAM isn't working anymore: "blockMesh: error while loading shared libraries"
Hi anyone,

i installed OpenFOAM on my Pc and my Laptop with the great help of this forum.
Now i got a strange Problem.

Today i wanted to start up OpenFoam on my Laptop and tried to run blockMesh.
He gave me the following error:
blockMesh: error while loading shared libraries: cannot open shared object file: No such file or directory

After wondering what happened i tried to start up icoFoam or paraview and he gave me the same error messages, except the pointed library changed.

So i tried the same commands on my pc and the same errors occured. This is extremly strange because the hdd with linux on it was disconnected the last time in my pc. So i didn't changed anything.

Maybe a Ubuntu Update changed something with the librarys?

I would be very happy if anyone could help me!

Thanks a lot

wyldckat October 18, 2010 17:54

Hi Pierre,

To me it seems that there are only two possible scenarios for what happened to you:
  • Scenario 1: your user's ".bashrc" file got corrupted/damaged.
    Open it for edition by running on a terminal the following command:

    gedit $HOME/.bashrc
    Now, do you see the line near the end with:

    . /opt/openfoam171/etc/bashrc
    If not, or if the line is slightly different, then that's the reason.
  • Scenario 2: the ".bashrc" file is fine, but the folder "/opt/openfoam171" got mysteriously removed.
    Check if the folder exists or not. For example, run:

    ls -l /opt/openfoam171

    du -sh /opt/openfoam171
    The first one should give you the contents of the folder; the second one should give you the amount of disk space occupied by that folder. If neither give you any expected output, then you'll have to install again following the online instructions.
By the way, did you upgrade Ubuntu from 10.04 to 10.10? If you are not sure of it, run this on your terminal window:

cat /etc/lsb-release
I haven't tested Ubuntu 10.10, so I don't know if the official Debian packages for OpenFOAM will work.

Best regards,

Leech October 19, 2010 03:41

Hi Bruno,

thanks for your help.
I looked at my bashrc.
It got the lines you mentioned. But with openfoam170.
I changed it to 171 and then the terminal said that there is no such directory.

The other things i cant try out right now, going to work :(
I'll try it this evening.

Thanks a lot

Leech October 19, 2010 14:10

Hi again,

i tried out the rest of your instructions.
The folder exists, but it's again openfoam170.
It got contents and it occupies something over 320mbs of disc space.

So i'm a bit worried. It seems like i installed open 170. But i thought i downloaded OpenFoam 171.

So i will try to install it again.


ps: I'll give a report here, if it worked well

Leech October 19, 2010 14:36


i tried to reinstall OpenFoam, but it didn't worked.
I followed the instructions exactly.
At the point "Open a new terminal window and test that the icoFoam application, from the OpenFOAM package, is working by typing icoFoam -help"
the shell answers again:
"pierre@pierre-laptop:~$ icoFoam -help
icoFoam: error while loading shared libraries: cannot open shared object file: No such file or directory"

I am totally out of ideas... :(
Any suggestions?

Thanks guys

wyldckat October 19, 2010 18:27

Hi Pierre,

That's odd... What does this command output:

Additionally, is there anything after the OpenFOAM line in "~/.bashrc"?

Best regards,

Leech October 21, 2010 14:27


you were right. I Had some additional lines in the bashrc.
I didn't thought they would change anything.
I added these lines, to automatically set the environnement variables for netgen:


export NETGENDIR=/opt/netgen/bin
export LD_LIBRARY_PATH=/usr/lib/Togl1.7:/opt/netgen/lib

Can you tell me if there is a way to add these variables in the bashrc? Because Netgen wont work without em.

Thanks a lot again for your help

wyldckat October 21, 2010 14:38

Hi Pierre,

It's pretty simple :) Just modify your line for NETGEN's LD_LIBRARY_PATH to this:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/Togl1.7:/opt/netgen/lib
And voilá, the whole nine yards of library paths are once again available, including NETGEN's :D

Best regards,

ali.m.1 September 7, 2016 10:53

Same problem, newer programs

I've just updated Ubuntu from 14.04 to 16.04 (maybe regrettably!), without changing anything else. I had OpenFOAM 3.0.x working well before I updated, but now I get the same errors as the above poster.

So when I do

I get the error 'icoFoam: error while loading shared libraries: cannot open shared object file: No such file or directory'

When I type

which icoFoam
I get '/home/ali/OpenFOAM/OpenFOAM-3.0.x/platforms/linux64GccDPInt32Opt/bin/icoFoam'

And when I do

I get '/home/ali/OpenFOAM/ThirdParty-3.0.x/platforms/linux64Gcc/CGAL-4.7/lib:/home/ali/OpenFOAM/ThirdParty-3.0.x/platforms/linux64Gcc/gperftools-svn/lib:/home/ali/OpenFOAM/ThirdParty-3.0.x/platforms/linux64Gcc/ParaView-4.4.0/lib/paraview-4.4:/home/ali/OpenFOAM/OpenFOAM-3.0.x/platforms/linux64GccDPInt32Opt/lib/openmpi-system:/home/ali/OpenFOAM/ThirdParty-3.0.x/platforms/linux64GccDPInt32Opt/lib/openmpi-system:/usr/lib/openmpi/lib:/home/ali/OpenFOAM/ali-3.0.x/platforms/linux64GccDPInt32Opt/lib:/home/ali/OpenFOAM/site/3.0.x/platforms/linux64GccDPInt32Opt/lib:/home/ali/OpenFOAM/OpenFOAM-3.0.x/platforms/linux64GccDPInt32Opt/lib:/home/ali/OpenFOAM/ThirdParty-3.0.x/platforms/linux64GccDPInt32Opt/lib:/home/ali/OpenFOAM/OpenFOAM-3.0.x/platforms/linux64GccDPInt32Opt/lib/dummy'

Any help would be appreciated. I could reinstall OpenFOAM, but I have quite a lot of solvers etc, which I don't want to lose.



wyldckat September 11, 2016 11:03

Quick answer @Ali: There are two possible solutions:
  1. You can try using a hack to pretend that the correct library is still being used. The hack I used just now for an old installation of OpenFOAM 3.0.x that I had on another Ubuntu version and that now I tried using on Ubuntu 16.04 x86_64, was this:

    ln -s /usr/lib/openmpi/lib/ $FOAM_LIBBIN/
    ln -s /usr/lib/openmpi/lib/ $FOAM_LIBBIN/
    ln -s /usr/lib/openmpi/lib/ $FOAM_LIBBIN/

  2. Or the correct way is to do re-build at least the Pstream library, by running the following commands:

    cd $FOAM_SRC/Pstream
    ( export WM_OPTIONS="$WM_OPTIONS$WM_MPLIB"; wclean all; wmake all)

ali.m.1 September 12, 2016 03:51

Hi Bruno

Thanks a lot for your reply. I tried linking to, but that didn't work. I ended up having to uninstall and then reinstall OpenFOAM completely (2 days before you replied, so I didn't try your advice).
I had managed to get OpenFOAM's standard solvers to work by just doing ./Allwmake before reinstalling, but my own solvers still had the same issues.
So for anyone else with the same problem, I would recommend trying what Bruno said, and failing that, reinstall OpenFOAM :)

All times are GMT -4. The time now is 02:52.