Automated scripts for building gcc 4.4.x and 4.5.x for using with OpenFOAM 1.7 series
Posted September 26, 2010 at 11:35 by wyldckat
Updated April 21, 2011 at 22:08 by wyldckat (Added 4th version of the scripts)
Updated April 21, 2011 at 22:08 by wyldckat (Added 4th version of the scripts)
This blog post is meant to centralize my efforts for providing gcc build scripts to the OpenFOAM community. It provides build scripts for gcc 4.3.x, 4.4.x and 4.5.x series.
NOTE: If you don't have internet on the computer where you want to run this script, you can still run these scripts, because they will provide you with instructions on which files to download and where to place them!
These scripts are based on the scripts provided with the patches for cross-compiling OpenFOAM 1.7.0 in Linux for Windows, available in this wiki page. These new attached scripts have already been partially integrated into the nucleation project.
The scripts inside the attached build-gcc*.tar.gz files are build-gcc44 and build-gcc45 (build-gcc43 starting with version build-gcc_v4), which will take care of downloading and building binutils and gcc and some of it's direct dependencies (namely gmp, mpfr and mpc for 4.5.x). Keep in mind that these scripts will not take care of all of the necessary steps to get your system ready for building OpenFOAM!
NOTE: The v4 version is the latest version and has some improvements. Nonetheless, I didn't fully test it yet, but it should work as intended
These scripts are hard coded to build gcc 4.4.4 and 4.5.0 (4.5.1 in v2 and v3 - also added 4.3.3 on v4). For more information on how to update those scripts, the instructions provided for the original scripts are suitable - see section "Building mingw cross-compilers" of the previously mentioned wiki page. But if you don't feel like reading instructions, simply open the scripts and change them to your heart's content
These scripts have been tested successfully in Ubuntu 9.10 x86_64, building gcc 4.4.4, 4.5.0 and 4.5.1; also some tests in Ubuntu 10.10 x86_64 with gcc 4.3.3.
The following steps are needed for this to work (might not be complete, since I haven't tested in systems other than Ubuntu):
Now, keep in mind that these steps will only get as far as building OpenFOAM and OpenMPI. And this is assuming that you can get the remaining necessary packages that I'm not giving instructions about. If you need a software package that you can't request to be installed in the system, then you will have to download the source code and build it yourself... usually with a group of commands like this:
As for ParaView, it requires a larger heap load of packages to be installed and/or built (for example, it's very likely that all would have to be built in RHEL 3/4 ) which is too much work to even bother, or so I believe The best option would be to simply get the ready to use version from www.paraview.org and follow the instructions I've already detailed here: Using the official pre-built ParaView 3.8.0 version with OpenFOAM...
Additional notes about these scripts:
Side note: I've tried creating a beefed up version of these scripts for also building an updated glibc (theoretically useful for older systems), but things didn't work totally as expected... More here: Trying to include glibc in my build-gcc scripts...
NOTE to this "Side note": This glibc thingy I tried seems unnecessary, after building OpenFOAM 1.7.1 in CentOS 3.3, 3.9, 4.0 and 4.8 with the v3 version of these scripts, without any problems!
Good luck!
Bruno
NOTE: If you don't have internet on the computer where you want to run this script, you can still run these scripts, because they will provide you with instructions on which files to download and where to place them!
These scripts are based on the scripts provided with the patches for cross-compiling OpenFOAM 1.7.0 in Linux for Windows, available in this wiki page. These new attached scripts have already been partially integrated into the nucleation project.
The scripts inside the attached build-gcc*.tar.gz files are build-gcc44 and build-gcc45 (build-gcc43 starting with version build-gcc_v4), which will take care of downloading and building binutils and gcc and some of it's direct dependencies (namely gmp, mpfr and mpc for 4.5.x). Keep in mind that these scripts will not take care of all of the necessary steps to get your system ready for building OpenFOAM!
NOTE: The v4 version is the latest version and has some improvements. Nonetheless, I didn't fully test it yet, but it should work as intended
These scripts are hard coded to build gcc 4.4.4 and 4.5.0 (4.5.1 in v2 and v3 - also added 4.3.3 on v4). For more information on how to update those scripts, the instructions provided for the original scripts are suitable - see section "Building mingw cross-compilers" of the previously mentioned wiki page. But if you don't feel like reading instructions, simply open the scripts and change them to your heart's content
These scripts have been tested successfully in Ubuntu 9.10 x86_64, building gcc 4.4.4, 4.5.0 and 4.5.1; also some tests in Ubuntu 10.10 x86_64 with gcc 4.3.3.
The following steps are needed for this to work (might not be complete, since I haven't tested in systems other than Ubuntu):
- Check yourself and/or request your system administrator to install these packages (the names are from Debian, so you'll need to find similar names for your system):
- flex - it should include the binaries flex and flex++, as well as FlexLexer.h.
- libreadline5-dev - this has the readline library and respective header files.
- texinfo - this is required during building gcc for documentation... but I can't remember what were the needed files
- byacc and bison - these are two applications, one needed for building gcc, the other for building OpenFOAM.
- Get OpenFOAM 1.7.0/1 or 1.7.x into your system, by following the instructions at www.openfoam.com. Keep in mind that only starting from 1.7.1 and 1.7.x will work properly with gcc 4.5.x!
- After getting OpenFOAM's bashrc sourced (search for «source the etc/bashrc» in the project's installation page) into the working environment, edit the file "$WM_PROJECT_DIR/etc/settings.sh" and change the following lines:
- For gcc 4.4.4 - change:Code:
gcc_version=gcc-4.4.3
Code:gcc_version=gcc-4.4.4
- For gcc 4.5.1 - change:Code:
gcc_version=gcc-4.4.3
Code:gcc_version=gcc-4.5.1
- For gcc 4.3.3 ... follow the same idea
- For either one - change:Code:
: ${compilerInstall:=system}
Code:: ${compilerInstall:=OpenFOAM}
- For gcc 4.4.4 - change:
- Source the bashrc file once more, or start a new terminal and source it again.
- Download the attached build-gcc_v4.tar.gz (build-gcc_v3.tar.gz if things don't go well) and unpack it in the "$WM_THIRD_PARTY_DIR".
- Now run:Code:
cd $WM_THIRD_PARTY_DIR ./build-gcc44
Code:cd $WM_THIRD_PARTY_DIR ./build-gcc45
- Whenever there is an error, it will tell you in which log file the error is listed. Check it for the things it says it needs or is missing and try to get them. If you can't figure it out, compress and attach the compressed relevant log file.
If you can get them, then run build-gcc44 or build-gcc45 again. - When you finally have gcc fully built, then you can move on to building OpenFOAM...
If you use the scripts from build-gcc.tar.gz, you might also want to nuke first the build folder used for building gcc and binutils, which is whoopingly over 1.5GB in disk space! To remove that build folder, run this to check if the folder seems legit:Code:echo $WM_THIRD_PARTY_DIR/platforms/build-$WM_ARCH$WM_COMPILER
Code:rm -rf $WM_THIRD_PARTY_DIR/platforms/build-$WM_ARCH$WM_COMPILER
Now, keep in mind that these steps will only get as far as building OpenFOAM and OpenMPI. And this is assuming that you can get the remaining necessary packages that I'm not giving instructions about. If you need a software package that you can't request to be installed in the system, then you will have to download the source code and build it yourself... usually with a group of commands like this:
Code:
./config --prefix=/the/folder/where/to/install make make install
Additional notes about these scripts:
- They do not take into account if the download of the necessary packages fails during download. In case one or more downloads do fail, try finding another mirror, edit the relevant script and update the relevant URL. You will also have to remove manually the failed file download, which is located in the folder $WM_THIRD_PARTY/download.
- Building with multilib is disabled by default in these scripts. The basic multilib option allows for gcc built in a 64bit system to build for both 32 and 64bit architectures. The advanced option allows to target various others architectures like ARM. This options is disabled because it will require that the system's multilib packages are also installed, which I believe is a rare necessity for the usual OpenFOAM user.
If you do need the multilib option, simply search for the "--disable-multilib" options for configure in the build-gcc4? scripts and remove them. - These scripts are meant to solely build for your local system. So it should work fine for other architectures other than i?68 and x86_64, but this has not been tested.
- PPL and CLooG-PPL are not built with these scripts, because I don't believe that OpenFOAM will benefit from these libraries. But if someone does report that they are useful for OpenFOAM, I will integrate them into the scripts.
- The build-gcc_v2.tar.gz version should now take care of dealing with some additional clean up at the end, as well as be more helpful when things don't build at first try, but allowing you to sort-of continue were things were left off.
- The version build-gcc_v3.tar.gz has resulted from experimentation with CentOS 3.3, 3.9, 4.0 and 4.8. The CentOS 3.x series requires an updated GNU make which I've added to the script (make version 3.82 to be exact). If you want to use your system's make, find the variable BUILD_MAKE (around line 66) and set it to 0:Code:
BUILD_MAKE=0
- Another thing about the v3 version: I disabled "help information" for building binutils, because it requires to install texinfo. In other words, man won't work for the applications built in the custom binutils.
- I added the capability to build gcc 4.3.3 to v4 for usage with older OpenFOAM versions. For example, as seen here: Blast from the past: installing OpenFOAM 1.5 in modern Linux boxes
Side note: I've tried creating a beefed up version of these scripts for also building an updated glibc (theoretically useful for older systems), but things didn't work totally as expected... More here: Trying to include glibc in my build-gcc scripts...
NOTE to this "Side note": This glibc thingy I tried seems unnecessary, after building OpenFOAM 1.7.1 in CentOS 3.3, 3.9, 4.0 and 4.8 with the v3 version of these scripts, without any problems!
Good luck!
Bruno
Total Comments 14
Comments
-
Hello Bruno,
How do you make scotch decomposition method work? The log file indicate that the libscotch.so was not copy to appropriate folder. So I copy them over after finish installation, but metis/scotch still not working. Thank you for your time and help.
Nam
------------------
have OPENMPI shared library
========================================
Build Scotch decomposition library
have scotch shared libraries in scotch_5.1/lib
+ cp scotch_5.1/lib/libscotch.so scotch_5.1/lib/libscotcherrexit.so /home/hnguyen/OpenFOAM/OpenFOAM-1.7.1/lib/linux64GccDPOpt
cp: target `/home/hnguyen/OpenFOAM/OpenFOAM-1.7.1/lib/linux64GccDPOpt' is not a directory
--------------------------------------------Posted March 3, 2011 at 19:46 by namCFD -
Hi Bruno,
I figured it out. All I had to do was to type 'wmake libso' in the src.
Thanks,
NamPosted March 4, 2011 at 03:01 by namCFD -
Hi Bruno,
I am trying to install OpenFOAM 1.7.1 on Redhat 5 linux. It has Gcc4.1.x. Would the steps given above of ubuntu linux will work in my case. Are the steps of checking the flex, flex++, FlexLexer.h., libreadline5-dev, texinfo, byacc and bison would be the same as given above. I am a new user of linux and know only basic commands and operations. Could you please help me or please give me the systematic steps to install OF1.7.1 on RHEL5 Linux.
Thanks in advance
MLDPosted April 13, 2011 at 01:33 by run_cfd -
Hi MLD,
I suggest that you first try CentFOAM: http://sourceforge.net/apps/mediawik...itle=Main_Page
Best regards and good luck!
BrunoPosted April 13, 2011 at 08:25 by wyldckat -
Hi Bruno,
Thanks for our quick response.
I have got instructions to go for OF1.7.1. For the time being I agree to go for CentFOAM from my side, if that works well then I can convince them.
I am trying to follow the steps given in the link you provided in last post, incase of any problem i will write you again. In the mean time, if you don't mind, can I request you to take some time in writing the steps from downloading to installations along with the commands, I am a new user of Linux. Please help me out, I badly needed it.
Thanks and Best wishes,
MLDPosted April 14, 2011 at 01:30 by run_cfd -
Hello Bruno,
In the mean time the CentFOAM was being downloaded, I tried to install OpenFOAM-1.7.1 according as the procedures given on "http://www.openfoam.com/download/source.php". For building the gcc44, I followed the steps (1-8) you gave in this blog. But I got stuck on the step 6 i.e. executing "./build-gcc44". It gave the following Error message:
[root@ANSYS etc]# cd $WM_THIRD_PARTY_DIR
[root@ANSYS ~]# ./build-gcc44
./build-gcc44: line 39: wmakeCheckPwd: command not found
Error: Current directory is not $WM_THIRD_PARTY_DIR
The environment variables are inconsistent with the installation.
Check the OpenFOAM entries in your dot-files and source them.
[root@ANSYS ~]#
Please suggest the possible reason for this error.
I have few more doubts in previous steps.
1. As I am installing in the root, my path for installation is "/root/OpenFOAM/OpenFOAM-1.7.1" , whereas the steps involved on the OpenFOAM website and in your blog uses the path "$HOME/OpenFOAM/OpenFOAM-1.7.1". I guess the using both the paths directs to the same folder. Is it So? Anyway I checked using both the paths but got the same error.
2. When I sourced the bashrc using the step given on OpenFOAM website, i.e. adding the line ". $HOME/OpenFOAM/OpenFOAM-1.7.1/etc/bashrc" at the end of bashrc file and executing the command ". $HOME/.bashrc” the result was nothing. see below the extracts from the terminal:
[root@ANSYS etc]# cd $HOME/OpenFOAM/OpenFOAM-1.7.1/etc
[root@ANSYS etc]# . $HOME/.bashrc
[root@ANSYS etc]#
How to check whether the execution of this step was correct?
When I did the foamSystemCheck in the bin it was passed: see below:
[root@ANSYS bin]# ./foamSystemCheck
Checking basic system...
-----------------------------------------------------------------------
Shell: /bin/bash
Host: ANSYS
OS: Linux version 2.6.18-128.el5
User: root
System check: PASS
==================
Continue OpenFOAM installation.
[root@ANSYS bin]#
3. As in step 6 where this directory "$WM_THIRD_PARTY_DIR" exists actually. or where exactly the build-gcc_v3.tar.gz has to be extracted. I just typed the commands you gave in this procedure.
Please rescue me out and suggest What mistake i am doing or is there anything wrong with my system resources. I am going to rut out of the deadline, I really need it.
I will try to install CentFOAM, once I will get the files downloaded. I will follow the steps on the lik suggested by you.
Thanks in advance,
MLDPosted April 14, 2011 at 08:39 by run_cfd -
Hi MLD,
OK, first of all, do not build OpenFOAM directly as root, specially if you still don't know your way around in Linux. I say this because building as root can potentially lead to hazardous mass deletions of the whole system, or unintentionally overwriting system critical files!
So, follow these instructions to the letter: CentFOAM Manual install
Secondly, you can run the environment sourcing command directly on the terminal:
Code:. $HOME/OpenFOAM/OpenFOAM-1.7.1/etc/bashrc
Code:source $HOME/OpenFOAM/OpenFOAM-1.7.1/etc/bashrc
To know if this command has worked, try running this command:
Code:echo $WM_THIRD_PARTY_DIR ls $WM_THIRD_PARTY_DIR
Sourcing the "~/.bashrc" file on your local environment sometimes doesn't work. To be 100% certain that this file is sourced is to start a new terminal/console.
Using one of my build-gcc4x scripts is only necessary if for some reason CentFOAM's ready to use packages don't work!
Now, when you finally have OpenFOAM working on your own personal area, then you can safely copy or move your OpenFOAM installation to /opt/OpenFOAM or something like that. It will require some additional tuning, but we'll see this tomorrow after you got it running on your area.
Best regards and good luck!
BrunoPosted April 14, 2011 at 19:12 by wyldckat -
Hello Bruno,
Greetings!!!
Now I succeeded to install (CentFOAM) OpenFoam-1.7.1. available on the link http://sourceforge.net/apps/mediawik...itle=Main_Page. Thanks a lot for your great help!!
I tried running a case of icoFOAM/cavity, it's working. But I was not able to open paraFoam. When I type the command "paraFoam" in case directory terminal. it gives following error.
---------
[root@sunserver cavity]# paraFoam
created temporary 'cavity.OpenFOAM'
/root/OpenFOAM/OpenFOAM-1.7.1/bin/paraFoam: line 139: paraview: command not found
[root@sunserver cavity]#
---------
I saw one of your thread about same problem. I followed the steps of adding few lines in settings.sh. but didn't worked.
What may be the problem? Can you suggest any other alternative.
Thanks and Best wishes,
MLDPosted April 19, 2011 at 06:58 by run_cfd -
Hi MLD,
See this blog post of mine: Related issues to ParaView with OpenFOAM - Fixes and solutions
There you will find various possible solutions, although at least one of these should work:
- On how to build ParaView 3.8.0 with a custom Qt 4.6: Building ParaView 3.8.0 with custom Qt 4.6.3
- On how to get and use the pre-built ParaView 3.8.0 from www.paraview.org to work with OpenFOAM: Using the official pre-built ParaView 3.8.0 version with OpenFOAM...
Best regards,
BrunoPosted April 19, 2011 at 21:47 by wyldckat -
OpenFOAM running problems with paraView
Quote:Hi MLD,
See this blog post of mine: Related issues to ParaView with OpenFOAM - Fixes and solutions
There you will find various possible solutions, although at least one of these should work:
- On how to build ParaView 3.8.0 with a custom Qt 4.6: Building ParaView 3.8.0 with custom Qt 4.6.3
- On how to get and use the pre-built ParaView 3.8.0 from www.paraview.org to work with OpenFOAM: Using the official pre-built ParaView 3.8.0 version with OpenFOAM...
Best regards,
Bruno
Hi Bruno,
Greetings!!!
I succeeded to open paraFoam according as the steps you gave in last post. But now my OpenFOAM stopped working. The icoFoam command is not working now. It gives the following error.
................
[root@sunserver cavity]# icoFoam /root/OpenFOAM/root-1.7.1/run/tutorials/incompressible/icoFoam/cavity
icoFoam: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by icoFoam)
icoFoam: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.11' not found (required by icoFoam)
icoFoam: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.11' not found (required by /root/OpenFOAM/OpenFOAM-1.7.1/lib/linux64GccDPOpt/libfiniteVolume.so)
................
I saw one of your blog about the same problem "using-official-pre-built-paraview-3-8-0-version-openfoam.html " explained to sahm. I followed the steps given there and I found that the line "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ParaView_DIR/lib/paraview-$ParaView_MAJOR" already present in the file "$WM_PROJECT_DIR/etc/apps/paraview3/bashrc". And the line "export LD_LIBRARY_PATH=/lib64:/usr/lib64:$LD_LIBRARY_PATH" also already present on the path "$HOME/.bashrc". But still I am getting the same error. What may be the problem?
Thanks for your great helps
Best Wishes
-MLDPosted April 20, 2011 at 08:10 by run_cfd -
So many possibilities... so many solutions :)
Hi MLD,
OK, the problem is this: with CentFOAM's OpenFOAM version, it comes with it's own "libstdc++.so.6". By following my instructions, you overrided the normal paths for CentFOAM, which lead to this problem.
So, one solution should be this:
- Remove the line "export LD_LIBRARY_PATH=/lib64:/usr/lib64:$LD_LIBRARY_PATH" from "$HOME/.bashrc".
- Edit the file "$WM_PROJECT_DIR/etc/bashrc" and find the line that says:Code:
paraview3=`$WM_PROJECT_DIR/bin/foamEtcFile apps/paraview3/bashrc` \ && _foamSource $paraview3 unset paraview3
Code:#paraview3=`$WM_PROJECT_DIR/bin/foamEtcFile apps/paraview3/bashrc` \ # && _foamSource $paraview3 #unset paraview3
- Next, edit the script "$WM_PROJECT_DIR/bin/paraFoam". Go to the line right after the first block of comments and add the lines that were commented in "$WM_PROJECT_DIR/etc/bashrc", although with a little tweak. With the tweak, it should look something like this (bold is the new addition):Code:
# Description # start paraview with the OpenFOAM libraries # #------------------------------------------------------------------------------ paraview3=`$WM_PROJECT_DIR/bin/foamEtcFile apps/paraview3/bashrc` \ && source $paraview3 unset paraview3 usage() {
- Start a new terminal. Try and see if things now work as intended!
BrunoPosted April 21, 2011 at 18:46 by wyldckat -
Hi Bruno,
Greeting!!!
wow!!! Worked great!!! Now my OpenFoam and paraFoam both work together. you are too good!!
Thanks a lot for all your help!
Best Wishes,
MLDPosted April 22, 2011 at 09:46 by run_cfd -
Hi Bruno,
Greetings!!!
I am trying to solve a problem which involves a compressible flow in a porous media with heat transfer effects on my OF-171 binery installation.
Now I feel a need of compiling the OpenFoam1.7.1 source code so that I could have some control on problem solution. Could you please help me in getting and compiling the same.
With Best Wishes,
MLDPosted May 24, 2011 at 02:58 by run_cfd -
Hi MLD,
Uhm... simply follow the official instructions? http://www.openfoam.com/download/source.php
The other possibility is to roughly follow the instructions I recently posted for Fedora 15 + OpenFOAM 1.7.x: http://www.cfd-online.com/Forums/ope...tml#post308762
Best regards,
BrunoPosted May 27, 2011 at 16:10 by wyldckat