CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Installation (https://www.cfd-online.com/Forums/openfoam-installation/)
-   -   Building OpenFOAM 2.2.x in usr/local, where changes necessary? (ubuntu (https://www.cfd-online.com/Forums/openfoam-installation/127183-building-openfoam-2-2-x-usr-local-where-changes-necessary-ubuntu.html)

aevub December 5, 2013 05:47

Building OpenFOAM 2.2.x in usr/local, where changes necessary? (ubuntu
 
Hi
I'm working on a virtual server (ubuntu 12.04 LTS) and I would like to build OpenFOAM 2.2.x under /usr/local/ so that it's accessible for all users. I work with different versions next to each other, so I used aliases.
I added in /etc/bash.bashrc
alias OF22x='. /usr/local/OpenFOAM/OpenFOAM-2.2.x/etc/bashrc'
and changed in usr/local/OpenFOAM/OpenFOAM-2.2.x/etc/bashrc the foam install to /usr/local/$WM_PROJECT_DIR

Is there some additional change needed? Because when I then start building (in new terminal, after typing OF22x and foam, which all works fine) I get an error that the environmental variables are inconstent with the installation

wmakeCheckPwd: not found
Error: Current directory is not $WM_PROJECT_DIR

Thanx for helping me out!

wyldckat December 8, 2013 13:23

Hi aevub,

Took me a while to see the problem here... but this should be it:
Quote:

Originally Posted by aevub (Post 464969)
and changed in usr/local/OpenFOAM/OpenFOAM-2.2.x/etc/bashrc the foam install to /usr/local/$WM_PROJECT_DIR

If you look at this line: https://github.com/OpenFOAM/OpenFOAM...etc/bashrc#L45
You'll see that the original value is:
Code:

foamInstall=$HOME/$WM_PROJECT
Which means that you should have changed it to this:
Code:

foamInstall=/usr/local/$WM_PROJECT
And not to:
Code:

foamInstall=/usr/local/$WM_PROJECT_DIR
;)

Best regards,
Bruno

aevub December 9, 2013 02:09

Hi Bruno

Apparently, I made a mistake when asking my question, because I didn't put
Code:

foamInstall=/usr/local/$WM_PROJECT_DIR
but
Code:

foamInstall=/usr/local/$WM_PROJECT
:o
Amazing that you found that typo.. but unfortunately it's not the reason for the error.
Any other ideas?

regards
Maaike

vints December 9, 2013 14:20

I was also trying to install under the "/usr/local/" folder, and had the same issue.

As explained in the building from source instructions, one should change the installation directory accordingly:

Code:

export FOAM_INST_DIR=/usr/local/OpenFOAM
foamDotFile=$FOAM_INST_DIR/OpenFOAM-2.2.2/etc/bashrc
[ -f $foamDotFile ] && . $foamDotFile

Running the "source $HOME/.bashrc" afterwards didn't raise an error.

Before this solution, I tried replacing "$HOME" with "/usr/local/" in the bashrc file, but that doesn't work.

Right now, I'm trying to solve some issues with ".\Allwmake" ...

aevub December 10, 2013 02:28

Actually, I tried to build the 2.2.x under my home folder on my pc, and when following the guidelines provided at
http://www.tfd.chalmers.se/~hani/kur...OwnLaptop.html
but I had the same problem.
Only when I build it with
Quote:

source etc
in the bashrc file, the Allwmake works as it should...

vints December 10, 2013 06:59

Were you able to solve it then?

I also did an installation under home folder and it worked smoothly as told in these instructions. Now OpenFOAM and ParaView are operational.

I don't know what the trouble was with the "/usr/local" installation. Some solutions I've read mentioned checking the wmake files with "which " command. That and "echo "ing folder name variables as "$FOAM_INST_DIR" looked correct. I may not be handling permissions correctly, so that might be an issue, as well.

aevub December 10, 2013 07:49

Well, I built OpenFOAM 2.2.x with the" source ..." in the bashrc file, and after compiling, I changed this into an alias to run different versions next to each other, and that works.

The usr/local or opt/ still doesn't work.

wyldckat December 10, 2013 17:05

Greetings to all!

@aevub: As implied by vints - to diagnose, try these steps:
  1. Start a new terminal.
  2. Run these commands:
    Code:

    echo $WM_PROJECT_DIR
    echo $FOAM_INST_DIR

    Both should give you an empty line in the screen.
  3. Now source the OpenFOAM environment, by using the alias you created, namely:
    Code:

    OF22x
  4. Now run the commands from step #2 once again. This time, it should should you the correct locations where you want to install OpenFOAM.
Best regards,
Bruno

aevub December 11, 2013 04:50

To check what happens with my failed /usr/local installation, I changed my alias again. After this,
Quote:

echo $WM_PROJECT_DIR
and
Quote:

echo $FOAM_INST_DIR
give me
Quote:

/usr/local/OpenFOAM/OpenFOAM-2.2.x
and
Quote:

/usr/local/OpenFOAM/
exactly what it should be.

Still, when running ./Allwmake, I get the error that the current directory is not $WM_PROJECT_DIR, although it is..

wyldckat December 11, 2013 15:50

Hi aevub,

Mmm... that kind of issue should only occur if something is out of place.
Try the following steps:
  1. Edit the main "Allwmake" script file and edit the very first line:
    Code:

    #!/bin/sh
  2. And change it to this:
    Code:

    #!/bin/sh -x
  3. Next time you run the script:
    Code:

    ./Allwmake
    it should give you a full output of what this script is doing.
  4. The specific complaint should come from the script "wmakeCheckPwd", which is located at the path given by this command:
    Code:

    echo $WM_PROJECT_DIR/wmake/wmakeCheckPwd
  5. Check if the script has got execution permissions:
    Code:

    ls -l $WM_PROJECT_DIR/wmake/wmakeCheckPwd
    It should give you something like this:
    Code:

    -rwxrwxr-x 1 root root 2664 Mar  9  2013 /usr/local/OpenFOAM/OpenFOAM-2.2.x/wmake/wmakeCheckPwd
    The "x" in "-rwxrwxr-x" indicates the execution permissions.
  6. Edit the script "wmakeCheckPwd" and do the same as in step #2. And try to run the Allwmake script again.
At the end of these steps, the problem should be as clear as clean water ;)

Best regards,
Bruno


All times are GMT -4. The time now is 23:55.