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

[OpenFOAM.com] Setting of working environment in Ubuntu / WSL

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 2 Post By christoph81

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 4, 2019, 14:24
Default Setting of working environment in Ubuntu / WSL
  #1
New Member
 
Join Date: Jan 2019
Posts: 2
Rep Power: 0
christoph81 is on a distinguished road
Dear all,

I've installed OpenFoam v18.06 under Ubuntu 18.04 (Linux-Subsystem for Win10).

I tried to set the working environment by

Code:
echo "source /opt/OpenFOAM/OpenFOAM-v1806/etc/bashrc" >> ~/.bashrc
source $HOME/.bashrc
and received an error message

Code:
-bash: eval: line 38: syntax error near unexpected token `('
-bash: eval: line 38: `PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/mnt/c/Program:Files/WindowsApps/CanonicalGroupLimited.Ubuntu18.04onWindows_1804.2018.817.0_x64__79rhkp1fndgsc:Files:(x86)/Common:Files/Oracle/Java/javapath_target_230390484:(x86)/Business:Objects/Common/3.5/bin/NOTES:(x86)/NVIDIA:Corporation/PhysX/Common:/mnt/c/ProgramData/Oracle/Java/javapath:Files/Common:Files/microsoft:shared/Windows:Live:(x86)/Silverfrost/FTN95:Express:/mnt/c/Windows/System32:/mnt/c/Windows:/mnt/c/Windows/System32/wbem:/mnt/c/Windows/System32/WindowsPowerShell/v1.0:/mnt/c/dislin/win:(x86)/MiKTeX:2.9/miktex/bin:(x86)/Windows:Live/Shared:(x86)/Calibre2:(x86)/GNU/GnuPG/pub:/mnt/c/Windows/System32/OpenSSH:Files/ngsolve-v6.2.1805/bin:/mnt/c/Users/Christoph/AppData/Local/Programs/Python/Python36/Scripts:/mnt/c/Users/Christoph/AppData/Local/Programs/Python/Python36:/mnt/c/Users/Christoph/AppData/Local/Microsoft/WindowsApps:/snap/bin'
-bash: eval: line 62: syntax error near unexpected token `('
-bash: eval: line 62: `PATH=/opt/OpenFOAM/ThirdParty-v1806/platforms/linux64Gcc63/openmpi-1.10.4/bin:/opt/OpenFOAM/ThirdParty-v1806/platforms/linux64/gcc-6.3.0/bin:/home/christoph/OpenFOAM/christoph-v1806/platforms/linux64Gcc63DPInt32Opt/bin:/opt/OpenFOAM/site/v1806/platforms/linux64Gcc63DPInt32Opt/bin:/opt/OpenFOAM/OpenFOAM-v1806/platforms/linux64Gcc63DPInt32Opt/bin:/opt/OpenFOAM/OpenFOAM-v1806/bin:/opt/OpenFOAM/OpenFOAM-v1806/wmake:/opt/OpenFOAM/ThirdParty-v1806/platforms/linux64Gcc63/gperftools-2.5/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/mnt/c/Program:Files/WindowsApps/CanonicalGroupLimited.Ubuntu18.04onWindows_1804.2018.817.0_x64__79rhkp1fndgsc:Files:(x86)/Common:Files/Oracle/Java/javapath_target_230390484:(x86)/Business:Objects/Common/3.5/bin/NOTES:(x86)/NVIDIA:Corporation/PhysX/Common:/mnt/c/ProgramData/Oracle/Java/javapath:Files/Common:Files/microsoft:shared/Windows:Live:(x86)/Silverfrost/FTN95:Express:/mnt/c/Windows/System32:/mnt/c/Windows:/mnt/c/Windows/System32/wbem:/mnt/c/Windows/System32/WindowsPowerShell/v1.0:/mnt/c/dislin/win:(x86)/MiKTeX:2.9/miktex/bin:(x86)/Windows:Live/Shared:(x86)/Calibre2:(x86)/GNU/GnuPG/pub:/mnt/c/Windows/System32/OpenSSH:Files/ngsolve-v6.2.1805/bin:/mnt/c/Users/Christoph/AppData/Local/Programs/Python/Python36/Scripts:/mnt/c/Users/Christoph/AppData/Local/Programs/Python/Python36:/mnt/c/Users/Christoph/AppData/Local/Microsoft/WindowsApps:/snap/bin:'
-bash: eval: line 38: syntax error near unexpected token `('
-bash: eval: line 38: `PATH=/opt/OpenFOAM/ThirdParty-v1806/platforms/linux64Gcc63/gperftools-2.5/bin:/opt/OpenFOAM/ThirdParty-v1806/platforms/linux64Gcc63/openmpi-1.10.4/bin:/opt/OpenFOAM/ThirdParty-v1806/platforms/linux64/gcc-6.3.0/bin:/home/christoph/OpenFOAM/christoph-v1806/platforms/linux64Gcc63DPInt32Opt/bin:/opt/OpenFOAM/site/v1806/platforms/linux64Gcc63DPInt32Opt/bin:/opt/OpenFOAM/OpenFOAM-v1806/platforms/linux64Gcc63DPInt32Opt/bin:/opt/OpenFOAM/OpenFOAM-v1806/bin:/opt/OpenFOAM/OpenFOAM-v1806/wmake:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/mnt/c/Program:Files/WindowsApps/CanonicalGroupLimited.Ubuntu18.04onWindows_1804.2018.817.0_x64__79rhkp1fndgsc:Files:(x86)/Common:Files/Oracle/Java/javapath_target_230390484:(x86)/Business:Objects/Common/3.5/bin/NOTES:(x86)/NVIDIA:Corporation/PhysX/Common:/mnt/c/ProgramData/Oracle/Java/javapath:Files/Common:Files/microsoft:shared/Windows:Live:(x86)/Silverfrost/FTN95:Express:/mnt/c/Windows/System32:/mnt/c/Windows:/mnt/c/Windows/System32/wbem:/mnt/c/Windows/System32/WindowsPowerShell/v1.0:/mnt/c/dislin/win:(x86)/MiKTeX:2.9/miktex/bin:(x86)/Windows:Live/Shared:(x86)/Calibre2:(x86)/GNU/GnuPG/pub:/mnt/c/Windows/System32/OpenSSH:Files/ngsolve-v6.2.1805/bin:/mnt/c/Users/Christoph/AppData/Local/Programs/Python/Python36/Scripts:/mnt/c/Users/Christoph/AppData/Local/Programs/Python/Python36:/mnt/c/Users/Christoph/AppData/Local/Microsoft/WindowsApps:/snap/bin'
Despite the error the installation seems to work so far.
But nevertheless I would like to understand and solve this problem.
So any hints are welcome.

Thanks and best regards
Christoph
christoph81 is offline   Reply With Quote

Old   January 4, 2019, 19:12
Default
  #2
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Quick answers:
  1. The error messages occur because the PATH environment variable is inherited from Windows into Ubuntu Bash.
  2. This carries with it paths such as "C:\Program Files (x86)" which OpenFOAM usually is allergic to it.
  3. One solution is to upgrade to OpenFOAM-v1812, which has this bug already solved.
  4. Another solution is to reset the PATH variable to something more... normal by Ubuntu's standard... for example, edit the file "~/.bashrc" in Ubuntu and add the following line before sourcing OpenfOAM's "etc/bashrc":
    Code:
    export PATH=$HOME/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
For more details about these issues and fixes, see the following bug reports:
__________________
wyldckat is offline   Reply With Quote

Old   January 5, 2019, 05:01
Default
  #3
New Member
 
Join Date: Jan 2019
Posts: 2
Rep Power: 0
christoph81 is on a distinguished road
Thanks for your quick response.

It works with upgrade to v18.12.


Best regards
Christoph
olesen and wyldckat like this.
christoph81 is offline   Reply With Quote

Old   March 16, 2024, 15:28
Lightbulb Backing up other paths
  #4
New Member
 
Ahmed Hesham Saad Yassin
Join Date: Feb 2017
Location: Kentucky, USA
Posts: 10
Rep Power: 9
AhmedSaad is on a distinguished road
Send a message via Skype™ to AhmedSaad
Quote:
Originally Posted by wyldckat View Post
Quick answers:
  1. The error messages occur because the PATH environment variable is inherited from Windows into Ubuntu Bash.
  2. This carries with it paths such as "C:\Program Files (x86)" which OpenFOAM usually is allergic to it.
  3. One solution is to upgrade to OpenFOAM-v1812, which has this bug already solved.
  4. Another solution is to reset the PATH variable to something more... normal by Ubuntu's standard... for example, edit the file "~/.bashrc" in Ubuntu and add the following line before sourcing OpenfOAM's "etc/bashrc":
    Code:
    export PATH=$HOME/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
For more details about these issues and fixes, see the following bug reports:
This solves the problem but permanently deletes other paths, including the Windows one. Before sourcing, I used the following to back up my paths before sourcing "/opt/openfoam11/etc/bashrc". Then, I appended them at the end.

Code:
# For OpenFOAM
# workaround of alien paths issues from windows in WSL 
# store temporary path
export tmp_PATH=$(echo $PATH | sed 's|^/usr/local/bin:||;s|:/usr/local/bin:|:|g')
export tmp_PATH=$(echo $tmp_PATH | sed 's|^/usr/bin:||;s|:/usr/bin:|:|g')
export tmp_PATH=$(echo $tmp_PATH | sed 's|^/bin:||;s|:/bin:|:|g')
export tmp_PATH=$(echo $tmp_PATH | sed 's|^/usr/sbin:||;s|:/usr/sbin:|:|g')
export tmp_PATH=$(echo $tmp_PATH | sed 's|^/sbin:||;s|:/sbin:|:|g')
# reset PATH to basic Linux
export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
# source OpenFOAM environment
source /opt/openfoam11/etc/bashrc
# add paths from tmp_PATH
export PATH="$PATH:$tmp_PATH"
AhmedSaad is offline   Reply With Quote

Reply


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
Setting working environment variable Arthur FLUENT 0 December 10, 2008 04:33
ICEM working directory setting Bogesz CFX 2 October 8, 2008 07:45
Adventure of fisrst openfoam installation on Ubuntu 710 jussi OpenFOAM Installation 0 April 24, 2008 14:25
setting the working directory Jiri Novak FLUENT 4 April 24, 2005 08:13
Debate on Working Environment Debate Main CFD Forum 11 December 19, 2000 23:21


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