CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Installation

[OpenFOAM.com] Install OpenFOAM 2112 in Ubuntu 22.04

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 5, 2022, 15:21
Default Install OpenFOAM 2112 in Ubuntu 22.04
  #1
New Member
 
Join Date: Mar 2022
Posts: 24
Rep Power: 4
tRock is on a distinguished road
Hello to all,

I would like to install OpenFOAM v2112 in debug mode in Ubuntu 22.04. The compiler used in Ubuntu 20.04 is GCC 9.4. In Ubuntu 22.04 the default is GCC 11.2.0.

This is giving me problems with the installation. I have installed GCC9 with:


Code:
sudo apt install gcc-9 g++-9
How can I specify the the GCC version I would like OF to be compiled with?


The error I am getting is:


Code:
primitives/functions/Math/erfInv.C: In function ‘Foam::scalar Foam::Math::erfInv(Foam::scalar)’:
primitives/functions/Math/erfInv.C:45:21: error: ‘numeric_limits’ is not a member of ‘std’
   45 |         return std::numeric_limits<scalar>::infinity();
      |                     ^~~~~~~~~~~~~~
primitives/functions/Math/erfInv.C:45:42: error: expected primary-expression before ‘>’ token
   45 |         return std::numeric_limits<scalar>::infinity();
      |                                          ^
primitives/functions/Math/erfInv.C:45:45: error: ‘::infinity’ has not been declared; did you mean ‘finite’?
   45 |         return std::numeric_limits<scalar>::infinity();
      |                                             ^~~~~~~~
      |                                             finite
make: *** [/home/tRock/OpenFOAM/OpenFOAM-v2112/wmake/rules/General/transform:35: /home/tRock/OpenFOAM/OpenFOAM-v2112/build/linux64GccDPInt32Debug/src/OpenFOAM/primitives/functions/Math/erfInv.o] Error 1



Best Regards
tRock is offline   Reply With Quote

Old   May 5, 2022, 16:16
Default
  #2
New Member
 
Join Date: Mar 2022
Posts: 24
Rep Power: 4
tRock is on a distinguished road
Well,

I added to src/OpenFOAM/primitives/functions/Math/MathFunctions.H



Code:
#include <limits>
and it has been compiling.


Edit:
After compilation when running the pitzDaily tutorial with simpleFoam, I get the error:


Code:
--> FOAM FATAL IO ERROR: (openfoam-2112)
error in IOstream "sha1" for operation Foam::Ostream& Foam::operator<<(Foam::Ostream&, int32_t)

Last edited by tRock; May 5, 2022 at 18:34.
tRock is offline   Reply With Quote

Old   May 6, 2022, 17:03
Default
  #3
New Member
 
Join Date: Mar 2022
Posts: 24
Rep Power: 4
tRock is on a distinguished road
Any idea, on how to solve this?

I also tried compiling with g++-9 and gcc-9

Code:
sudo apt install build-essential sudo apt-get install gcc-9 g++-9
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 9 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-9 9
sudo update-alternatives --config gcc # To select gcc version [9.4.0]
sudo update-alternatives --config g++ # To select g++ version[9.4.0]
After compilation, I still get:
Code:
--> FOAM FATAL IO ERROR: (openfoam-2112) error in IOstream "sha1" for operation Foam::Ostream& Foam::operator<<(Foam::Ostream&, int32_t)
When running the pitzDaily tutorial.

How can I solve this?
tRock is offline   Reply With Quote

Old   May 7, 2022, 23:12
Default
  #4
wdm
New Member
 
TX
Join Date: May 2022
Posts: 3
Rep Power: 3
wdm is on a distinguished road
I'm struggling gcc version, too.

today, I tried to compile openfoam for Ubuntu 20.04, and somehow, I would like to install 9.3.0 instead of 9.4.0, but I found it's so hard to change. I tried multiple ways, all failed.

Have you ever compile openfoam in ubuntu 20.04? I got error ".../OSspecific/POSIX/POSIX.o] Error 1.
wdm is offline   Reply With Quote

Old   May 9, 2022, 04:43
Default
  #5
New Member
 
Join Date: Mar 2022
Posts: 24
Rep Power: 4
tRock is on a distinguished road
Quote:
Originally Posted by wdm View Post
I'm struggling gcc version, too.

today, I tried to compile openfoam for Ubuntu 20.04, and somehow, I would like to install 9.3.0 instead of 9.4.0, but I found it's so hard to change. I tried multiple ways, all failed.

Have you ever compile openfoam in ubuntu 20.04? I got error ".../OSspecific/POSIX/POSIX.o] Error 1.

Hi,
On Ubuntu 20.04 I never experienced any installation issues.
tRock is offline   Reply With Quote

Old   May 28, 2022, 04:48
Default
  #6
New Member
 
Join Date: Mar 2022
Posts: 24
Rep Power: 4
tRock is on a distinguished road
has anyone been able to install OF through the source in Ubuntu 22.04?


What procedure did you use to make it work?


Best regards
tRock is offline   Reply With Quote

Old   September 25, 2023, 08:37
Default
  #7
New Member
 
Chris
Join Date: Nov 2021
Posts: 12
Rep Power: 4
Jury is on a distinguished road
For me it worked out to complile with gcc-10. To do this you first have to install it by:
Code:
sudo apt install gcc-10 g++-10
After this you can add the following line to /etc/bashrc:

Code:
export WM_COMPILE_CONTROL="version=10"
With these changes it should compile without any errors.
Jury is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[OpenFOAM.com] Installing OpenFOAM 2.4.0 on Ubuntu 20.04 for Windows RKyle OpenFOAM Installation 5 January 25, 2022 10:45
How to contribute to the community of OpenFOAM users and to the OpenFOAM technology wyldckat OpenFOAM 17 November 10, 2017 15:54
OpenFOAM v3.0+ ?? SBusch OpenFOAM 22 December 26, 2016 14:24
How to install two version openfoam on ubuntu? MAHDI1366 OpenFOAM Installation 1 July 1, 2014 14:25
How to Install Openfoam 2.2.2 in Ubuntu 14.04? satty_00 OpenFOAM Installation 7 May 18, 2014 10:04


All times are GMT -4. The time now is 05:41.