CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Installation (https://www.cfd-online.com/Forums/openfoam-installation/)
-   -   [OpenFOAM.org] Building OpenFOAM 3.0.1 on Ubuntu 16.04 - failed (https://www.cfd-online.com/Forums/openfoam-installation/169644-building-openfoam-3-0-1-ubuntu-16-04-failed.html)

erico April 14, 2016 20:30

Building OpenFOAM 3.0.1 on Ubuntu 16.04 - failed
 
1 Attachment(s)
Hello!

I followed the steps here, which is where I download the source too, my system is a 64-bit Ubuntu 16.04, 16 GB RAM.

When I run ./Allwmake my build fails. It presents lots of errors instead of stopping on the first one, with the message : "undefined reference to `yyFlexLexer::yywrap" .

I did:

user@pc:~/OpenFOAM/OpenFOAM-3.0.1$ flex++ --version
flex++ 2.6.0
user@pc:~/OpenFOAM/OpenFOAM-3.0.1$ which flex++
/usr/bin/flex++

What am I doing wrong here?

Edit: also, is there a ppa available to install OpenFOAM without building on Ubuntu Xenial Xerus?

wyldckat April 15, 2016 19:04

Quick answers:
  1. To fix the problem, run:
    Code:

    #Go into OpenFOAM's main source folder
    cd $WM_PROJECT_DIR
     
    #Change how the flex version is checked
    find src applications -name "*.L" -type f | xargs sed -i -e 's=\(YY\_FLEX\_SUBMINOR\_VERSION\)=YY_FLEX_MINOR_VERSION < 6 \&\& \1='

    Then try running Allwmake once again.
  2. AFAIK, there is no PPA available for any OpenFOAM version :( I have been wanting to do this myself for quite sometime now, but setting up the Debian packaging folder isn't straight forward.
  3. edit: I'm writing the detailed installation instructions here: http://openfoamwiki.net/index.php/In...u#Ubuntu_16.04

erico April 15, 2016 19:54

Thanks Bruno! Will try this as soon as possible!

I notice you answer most things here. I am still learning OpenFoam but been a linux USER for some time. How can one help with the OpenFoam project?

wyldckat April 15, 2016 21:41

Quote:

Originally Posted by erico (Post 595286)
How can one help with the OpenFoam project?

Quick answer: Good question! I didn't even remember that a forum sticky thread for this question big question was missing! I've quickly written it now and it's this one: http://www.cfd-online.com/Forums/ope...echnology.html

Phicau April 20, 2016 04:23

Let me add something to this. If you are using wmakeScheduler to compile, you will get the following error:

Code:

wmakeScheduler: Could not find executable 'lockfile'
The solution is to install procmail:

Code:

sudo apt install procmail
When it prompts you to configure it, just select 'No configuration'.

Solution found in this thread: http://www.cfd-online.com/Forums/ope...oam-2-3-x.html

Best,

Pablo

erico April 27, 2016 20:40

Ok, using the code from Bruno it worked.

I used the same code on OpenFOAM 2.4.0 and could build it successfully on Ubuntu 16.04.

Then I went to build Paraview, but build failed at 13% building object vtkXOpenGLRenderWindow.cxx.o .

glxext.h 480:143 error: GLintptr has not been declared

erico April 28, 2016 08:48

2 Attachment(s)
Tried to follow the instructions here instead:

https://openfoamwiki.net/index.php/I...u#Ubuntu_16.04

But on step 8, using `./Allwmake > make.log 2>&1` gives me errors

I've attached the log.

Attachment 47046

Attachment 47047

erico May 1, 2016 06:16

Does the variable WM_NCOMPPROCS=4 matter AFTER building? If I didn't use it, in the 3.0.1 install, will OpenFOAM use 4 cores when running?

wyldckat May 1, 2016 17:45

Quick answers:
Quote:

Originally Posted by erico (Post 597034)
Then I went to build Paraview, but build failed at 13% building object vtkXOpenGLRenderWindow.cxx.o .

glxext.h 480:143 error: GLintptr has not been declared

You probably already solved this issue, but the fix for this is in step 9.2 here: https://openfoamwiki.net/index.php/I...u#Ubuntu_16.04

Quote:

Originally Posted by erico (Post 597130)
Tried to follow the instructions here instead:

https://openfoamwiki.net/index.php/I...u#Ubuntu_16.04

But on step 8, using `./Allwmake > make.log 2>&1` gives me errors

This is very strange, because I did a build of OpenFOAM 2.4.0 on Ubuntu 16.04 about a month ago and I didn't have any problems. Please try unpacking the ThirdParty-2.4.0.tgz file once again, for example, like this:
Code:

cd ~/OpenFOAM
tar -xzf ThirdParty-2.4.0.tgz

Then do step #8 once again.


Quote:

Originally Posted by erico (Post 597523)
Does the variable WM_NCOMPPROCS=4 matter AFTER building? If I didn't use it, in the 3.0.1 install, will OpenFOAM use 4 cores when running?

"WM_NCOMPPROCS" is only used for building in parallel. It does not affect running cases in parallel or serial mode.

LukaD May 3, 2016 02:52

I was missing the ptscotch.h file when trying to build OpenFOAM on Ubuntu 16.04, so I had to install an additional package:

Code:

apt-get install libptscotch-dev

erico May 8, 2016 10:19

3 Attachment(s)
I still can't build, I created a script here called:

installOF240_sh.txt

if someone could be kind enough to give me a script to just run and install Open FOAM 2.4.0 in Ubuntu 16.04 I would be very happy.

Tried everything and it just doesn't build.

I could build with no problems Open FOAM 3.0.1.

If there is a .deb package that works or a PPA please, tell me!!!

wyldckat May 8, 2016 14:18

@erico: OK, the problem with CGAL can be ignored. I still don't understand what's going on wrong, but this can be ignored for now. I'll have to review the instructions to use the CGAL version that comes with Ubuntu 16.04, which should solve this problem.


If you still have OpenFOAM-2.4.0 in your build structure, then please simply try run the following commands and you should get at least most of OpenFOAM built and up and running, although foamyHexMesh won't be working (edit: see the next post as well):
Code:

#Go into OpenFOAM's main source folder
cd $WM_PROJECT_DIR
 
#Change how the flex version is checked
find src applications -name "*.L" -type f | xargs sed -i -e 's=\(YY\_FLEX\_SUBMINOR\_VERSION\)=YY_FLEX_MINOR_VERSION < 6 \&\& \1='

#Go into OpenFOAM's main source folder
cd $WM_PROJECT_DIR
 
#Still better be certain that the correct Qt version is being used
export QT_SELECT=qt4
 
# This next command will take a while... somewhere between 30 minutes to 3-6 hours.
./Allwmake > log.make 2>&1
 
#Run it a second time for getting a summary of the installation
./Allwmake > log.make 2>&1


If you want the complete script, it's easier for me to post the code here (edit: updated script code based on findings shown in the next post):
Code:

cd ~
mkdir OpenFOAM
cd OpenFOAM
wget "http://downloads.sourceforge.net/foam/OpenFOAM-2.4.0.tgz?use_mirror=mesh" -O OpenFOAM-2.4.0.tgz
wget "http://downloads.sourceforge.net/foam/ThirdParty-2.4.0.tgz?use_mirror=mesh" -O ThirdParty-2.4.0.tgz
 
tar -xzf OpenFOAM-2.4.0.tgz
tar -xzf ThirdParty-2.4.0.tgz

ln -s /usr/bin/mpicc.openmpi OpenFOAM-2.4.0/bin/mpicc
ln -s /usr/bin/mpirun.openmpi OpenFOAM-2.4.0/bin/mpirun

sed -i -e 's/^\(cgal_version=\).*/\1cgal-system/' OpenFOAM-2.4.0/etc/config/CGAL.sh

source $HOME/OpenFOAM/OpenFOAM-2.4.0/etc/bashrc WM_NCOMPPROCS=4

echo "alias of240='source \$HOME/OpenFOAM/OpenFOAM-2.4.0/etc/bashrc $FOAM_SETTINGS'" >> $HOME/.bashrc

cd $WM_THIRD_PARTY_DIR
 
export QT_SELECT=qt4

sed -i -e 's=//#define GLX_GLXEXT_LEGACY=#define GLX_GLXEXT_LEGACY=' \
  ParaView-4.1.0/VTK/Rendering/OpenGL/vtkXOpenGLRenderWindow.cxx
 
cd $WM_THIRD_PARTY_DIR/ParaView-4.1.0
 
wget http://www.paraview.org/pipermail/paraview/attachments/20140210/464496cc/attachment.bin -O Fix.patch
patch -p1 < Fix.patch
 
cd VTK
wget https://github.com/gladk/VTK/commit/ef22d3d69421581b33bc0cd94b647da73b61ba96.patch -O Fix2.patch
patch -p1 < Fix2.patch
 
cd ../..

#this will take a while... somewhere between 30 minutes to 2 hours or more
./makeParaView4 -python -mpi -python-lib /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0 > log.makePV 2>&1

wmSET $FOAM_SETTINGS

#Go into OpenFOAM's main source folder
cd $WM_PROJECT_DIR
 
#Change how the flex version is checked
find src applications -name "*.L" -type f | xargs sed -i -e 's=\(YY\_FLEX\_SUBMINOR\_VERSION\)=YY_FLEX_MINOR_VERSION < 6 \&\& \1='


#Create stub folders, so that they mark their presences
mkdir -p $CGAL_ARCH_PATH
mkdir -p $BOOST_ARCH_PATH


#Go into OpenFOAM's main source folder
cd $WM_PROJECT_DIR
 
#Still better be certain that the correct Qt version is being used
export QT_SELECT=qt4
 
# This next command will take a while... somewhere between 30 minutes to 3-6 hours.
./Allwmake > log.make 2>&1
 
#Run it a second time for getting a summary of the installation
./Allwmake > log.make 2>&1

gzip < log.make > log.make.gz

At the end, check the contents of the file "log.make". If there are problems, please attach the file "log.make.gz".

wyldckat May 8, 2016 15:59

Sorry about the confusion. I've solved the problem with CGAL. Quoting myself from a few minutes ago:
Quote:

Originally Posted by wyldckat (Post 599193)
edit: I've solved the problem with building CGAL: http://openfoamwiki.net/index.php/In...u#Ubuntu_16.04

I didn't notice the error that I had gotten on the build I had made before on the VM. You can run the following commands to finish up the build:
Code:

foam

sed -i -e 's/^\(cgal_version=\).*/\1cgal-system/' OpenFOAM-2.4.0/etc/config/CGAL.sh

wmREFRESH

mkdir -p $CGAL_ARCH_PATH
mkdir -p $BOOST_ARCH_PATH



#Go into OpenFOAM's main source folder
cd $WM_PROJECT_DIR
 
#Still better be certain that the correct Qt version is being used
export QT_SELECT=qt4
 
# This next command will take a while... somewhere between 30 minutes to 3-6 hours.
./Allwmake > log.make 2>&1
 
#Run it a second time for getting a summary of the installation
./Allwmake > log.make 2>&1

And this should solve most of the problems.

I've also updated the big chunk of script code in the previous post.

erico May 14, 2016 22:04

so wmSET didn't work.

I understand that using source $HOME/OpenFOAM/OpenFOAM-2.4.0/etc/bashrc WM_NCOMPPROCS=4 is ok - as alternative to the wmSET command that is inexistent on my system.

Anyway, now I have a different problem. Damn, I really wish OpenFOAM was just packed somewhere, maybe as Snaps, or as debs or a ppa...

user@pc:~/OpenFOAM/
user-2.4.0/run/testes/parede_DxDy5$ of240
user@pc:~/OpenFOAM/user-2.4.0/run/testes/parede_DxDy5$ paraview --version
paraview version 4.1.0

Inconsistency detected by ld.so: dl-close.c: 811: _dl_close: Assertion `map->l_init_called' failed!
user@pc:~/OpenFOAM/user-2.4.0/run/testes/parede_DxDy5$ of301
user@pc:~/OpenFOAM/user-2.4.0/run/testes/parede_DxDy5$ paraview --version
paraview version 4.4.0

Inconsistency detected by ld.so: dl-close.c: 811: _dl_close: Assertion `map->l_init_called' failed!


I have zero results for this error in Google.

---

EDIT: I am an idiot. The correct software is paraFoam. Nevermind, everything is working. It's perfect.

RishabhG September 11, 2016 02:45

Unable to install OpenFOAM in ubuntu 16.04
 
As per the instruction, I tried running
Code:

apt-get install build-essential binutils-dev cmake flex bison zlib1g-dev qt4-dev-tools libqt4-dev libqtwebkit-dev gnuplot \
 libreadline-dev libncurses-dev libxt-dev libopenmpi-dev openmpi-bin libboost-system-dev libboost-thread-dev libgmp-dev \
 libmpfr-dev python python-dev libcgal-dev

But I received the following message
Code:

Reading package lists... Done
Building dependency tree     
Reading state information... Done
Package libgmp-dev is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

Package gnuplot is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

Package zlib1g-dev is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

Package libxt-dev is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

Package libncurses-dev is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

Package qt4-dev-tools is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
  qtchooser

Package libqt4-dev is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
  libqt4-dbus

Package flex is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

Package bison is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

Package python-dev is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
  python

Package cmake is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Unable to locate package binutils-dev
E: Package 'cmake' has no installation candidate
E: Package 'flex' has no installation candidate
E: Package 'bison' has no installation candidate
E: Package 'zlib1g-dev' has no installation candidate
E: Package 'qt4-dev-tools' has no installation candidate
E: Package 'libqt4-dev' has no installation candidate
E: Unable to locate package libqtwebkit-dev
E: Package 'gnuplot' has no installation candidate
E: Unable to locate package libreadline-dev
E: Package 'libncurses-dev' has no installation candidate
E: Package 'libxt-dev' has no installation candidate
E: Unable to locate package libopenmpi-dev
E: Unable to locate package openmpi-bin
E: Unable to locate package libboost-system-dev
E: Unable to locate package libboost-thread-dev
E: Package 'libgmp-dev' has no installation candidate
E: Unable to locate package libmpfr-dev
E: Package 'python-dev' has no installation candidate
E: Unable to locate package libcgal-dev

Could someone please tell me what to do as I am new to Ubuntu and OpenFOAM?

Thanks

wyldckat September 11, 2016 08:46

Quick answer @RishabhG: Sorry, I completely forgot to add to the instructions on the wiki for updating the apt-get cache.

On the terminal, in root mode, please run the following command:
Code:

apt-get update
Or if you're on the terminal as a normal user, try:
Code:

sudo apt-get update
Then try following the instructions once again.


edit: I've updated all of the wiki pages I could remember about on this detail.

RishabhG September 12, 2016 00:01

OpenFoam Tutorial
 
1 Attachment(s)
Thanks a lot. I was able to successfully install

I was trying a tutorial given in http://cfd.direct/openfoam/user-guid...ty/#x5-40002.1

Code:

cd $FOAM_RUN
cp -r $FOAM_TUTORIALS/incompressible/icoFoam/cavity/cavity . 
 cd cavity

Code:

cp: missing destination file operand after  '/home/rishabh/OpenFOAM/OpenFOAM-3.0.1/tutorials/incompressible/icoFoam/cavity/cavity'
Try 'cp --help' for more information.

This seems legit as the screen shot below shows no cavity file/folder within the cavity folder. So is there a mistake in tutorial or am I missing something?

wyldckat September 13, 2016 15:58

Quick answer @RishabhG: I'm guessing that you started a new terminal window or tab. You need to run the respective alias command. In your situation, where you have OpenFOAM 3.0.1, run:
Code:

of301
to activate the OpenFOAM environment on the terminal (command line).

If that gives you an error message, then something went wrong. Please let me/us know of what error message it gives you or check the installation instructions again, namely the step that uses the command "source", which at the current time of writing is step #8 here: http://openfoamwiki.net/index.php/In...u#Ubuntu_16.04

RishabhG September 17, 2016 04:35

I did run the of301 command. The I ran
Code:

cd $FOAM_RUN
Followed by
Code:

cp -r $FOAM_TUTORIALS/incompressible/icoFoam/cavity/cavity
I received the following
Code:

cp: missing destination file operand after '/home/rishabh/OpenFOAM/OpenFOAM-3.0.1/tutorials/incompressible/icoFoam/cavity'
Try 'cp --help' for more information.

Probably there is some mistake in command as it says what to copy but not where to copy. Could you please help me out

wyldckat September 17, 2016 06:47

Quote:

Originally Posted by RishabhG (Post 618189)
I did run the of301 command. The I ran
Code:

cd $FOAM_RUN
Followed by
Code:

cp -r $FOAM_TUTORIALS/incompressible/icoFoam/cavity/cavity
I received the following
Code:

cp: missing destination file operand after '/home/rishabh/OpenFOAM/OpenFOAM-3.0.1/tutorials/incompressible/icoFoam/cavity'
Try 'cp --help' for more information.

Probably there is some mistake in command as it says what to copy but not where to copy. Could you please help me out

Quick answer: Oh, OK, not I can see what the problem really is. THe error message is telling you this:
Code:

missing destination file operand
This means that the target location is missing from the address. For example, the command expects this:
Code:

cp -r origin target
where:
  • "origin" is this path:
    Code:

    $FOAM_TUTORIALS/incompressible/icoFoam/cavity/cavity
  • and the "target" is this meant little dot:
    Code:

    .
In your the previous post, the dot was there:
Quote:

Originally Posted by RishabhG (Post 617521)
Code:

cd $FOAM_RUN
cp -r $FOAM_TUTORIALS/incompressible/icoFoam/cavity/cavity . 
 cd cavity



But on the post you made now:
Quote:

Originally Posted by RishabhG (Post 618189)
Code:

cp -r $FOAM_TUTORIALS/incompressible/icoFoam/cavity/cavity

See? The dot at the end of the command line is missing!


Maybe this is easier to see:
Code:

cp -r $FOAM_TUTORIALS/incompressible/icoFoam/cavity/cavity ./
It's the same, it's just that this makes it a bit easier to spot the dot at the end and the slash "/" is an indication of the directory (folder) to which the dot refers to.


Take a look at the following thread for more details: http://unix.stackexchange.com/questi...nd-directories


All times are GMT -4. The time now is 17:47.