Skip to content

Quick notes on how to update build

Bruno Santos edited this page Nov 11, 2024 · 8 revisions

Introduction

To consolidate information share in issues #19 and #20, this wiki page aims to quickly outline the steps needed for building OpenFOAM technology with the infrastructure provided with blueCFD-Core 2016 and 2017.

Setting up the work environment

This depends on the version of blueCFD-Core that you are currently using:

Work environment for blueCFD-Core 2016-1

There are two limitations in blueCFD-Core 2016-1, that give us some issues in how to build OpenFOAM technology on Windows:

  1. Spaces in directory/folder/file paths is not correctly handled by one of the scripts that is provided with blueCFD-Core, as reported in issue #3.

  2. A good part of the scripting (wmake scripts) and infrastructure (MSys2) that we use, is mostly prepared to handle long path names, which go beyond the 260 character limit. Nonetheless, not all GCC/binutils that are provided in MSys2, will properly handle these long path names.

Therefore, the solution is to following these steps:

  1. First close all MSys/blueCFD-Core terminal windows that you have open.

  2. You need to access the main menu short-cut folder blueCFD-Core 2016/Settings, using one of the following steps:

    • Either use the Windows Start menu to access the apps section, then browse to blueCFD-Core 2016 and then click on the short-cut Extended Start Menu;

    • or double-click on the short-cut on the Desktop named blueCFD-Core 2016 (Start Menu) and then in the short-cut Extended Start Menu on the new window.

  3. From there, browse to Settings -> Local Drive Mode and double-click on Create Substitute Drive Letter X.

  4. This will create a pseudo-virtual drive letter X: which acts as an alias path for the path you have, for example, C:\Program Files\blueCFD-Core-2016.

  5. Use Windows Explorer to go to the path X:\ and then double-click on the file blueCFD-Core_MSys2_mingw64.bat, which will start the MSys terminal, based on this alias path.

  6. Now you are ready to build OpenFOAM technology on Windows.

Note: If you already have the X drive letter assigned to something else, then simply edit and modify the files LocalDrive_ON.bat and LocalDrive_OFF.bat that are located at the base installation folder, e.g. at C:\Program Files\blueCFD-Core-2016.

Next step: Updating the build of OpenFOAM 4.x in blueCFD-Core 2016

Work environment for blueCFD-Core 2016-2 and newer versions

Even though as of blueCFD-Core 2016-2 we have improved considerably the handling of spaces in directory/folder/file paths for building source code, please keep in mind that if you need to rebuild our port of OpenFOAM from source code, that the following steps should likely still be taken, unless you have already installed blueCFD-Core in the root of the drive, for example C:\blueCFD.

Therefore, if you have problems (re)building from source code, it's advisable to follow these steps (which is also needed for properly enabling stack tracing in 2017):

  1. First close all MSys/blueCFD-Core terminal windows that you have open.

  2. You need to access the main menu short-cut folder blueCFD-Core 2017/Settings, using one of the following steps:

    • Either use the Windows Start menu to access the apps section, then browse to blueCFD-Core 2017 and then click on the short-cut Extended Start Menu;

    • or double-click on the short-cut on the Desktop named blueCFD-Core 2017 (Start Menu) and then in the short-cut Extended Start Menu on the new window.

  3. From there, browse to Settings -> Local Drive Mode and double-click on Create Substitute Drive Letter X.

  4. This will create a pseudo-virtual drive letter X: which acts as an alias path for the path you have, for example, C:\Program Files\blueCFD-Core-2017.

  5. Use Windows Explorer to go to the path X:\ and then double-click on the file blueCFD-Core_MSys2_mingw64.bat, which will start the MSys terminal, based on this alias path.

  6. Now you are ready to build OpenFOAM technology on Windows.

Note: If you already have the X drive letter assigned to something else, then simply edit and modify the files LocalDrive_ON.bat and LocalDrive_OFF.bat that are located at the base installation folder, e.g. at C:\Program Files\blueCFD-Core-2017.

Next step: Updating the build of OpenFOAM 5.x in blueCFD-Core 2017

Updating the build of OpenFOAM 4.x in blueCFD-Core 2016

The branch blueCFD-Core-4.x at github.com/blueCFD/OpenFOAM-dev is updated once in a while to sync up with the official OpenFOAM-4.x repository at github.com/OpenFOAM/OpenFOAM-4.x.

The only problem is that building on Windows is still a bit clunky and the only guaranteed way to have it build correctly, is to follow these steps:

  1. Start the MSys2 terminal, as outlined in the previous section.

  2. Update your local repository, by running:

    foam
    git pull
    
    cd $WM_THIRD_PARTY_DIR
    git pull
    
  3. Then to rebuild, run:

    foam
    wcleanPlatform -current
    wcleanLnIncludeAll
    ./Allwmake -j -k > log.make 2>&1
    
  4. When it's done, check the log file log.make for error messages, by running:

    grep "Error " log.make
    

    Notice that there is a space before the second quote mark.

  5. Optional - The following commands will help rebuild the applications that have failed:

    grep '\.exe] Error ' log.make | \
      sed 's=.*/\(.*\)\.exe.*=\1=' | \
      xargs -I {} find applications -name {} | while read line
    do
        wclean $line
        wmake $line
        wmakeVerifyExeDependencies $line || wmake $line
    done > log.make2 2>&1
    
    • Note: This should not be necessary since at least the release of blueCFD-Core 2016-2.
  6. If the previous step was performed, then check the contents of the file log.make2 as well, for example, by running:

    grep "Error " log.make
    

Updating the build of OpenFOAM 5.x in blueCFD-Core 2017

The branch blueCFD-Core-5.x at github.com/blueCFD/OpenFOAM-dev is updated once in a while to sync up with the official OpenFOAM-5.x repository at github.com/OpenFOAM/OpenFOAM-5.x.

The only problem is that building on Windows can still be a bit clunky, so please follow these steps:

  1. Start the MSys2 terminal, as outlined in the previous section.

  2. Update your local repository, by running:

    foam
    git pull
    
    cd $WM_THIRD_PARTY_DIR
    git pull
    
  3. Then to rebuild, run:

    foam
    ./Allwmake -j -k -update > log.make 2>&1
    
  4. When it's done, check the log file log.make for error messages, by running:

    grep "Error " log.make
    

    Notice that there is a space before the second quote mark.

It it gives any errors, try running step #3 once again, but if doesn't solve the problem, please open a report at blueCFD-Core's Issue Tracker.

Updating the build of OpenFOAM 8 in blueCFD-Core 2020

Updating the build of OpenFOAM 12 in blueCFD-Core 2024

For OpenFOAM 8 and 12, as provided with blueCFD-Core 2020 and 2024, the instructions at Updating the build of OpenFOAM 5.x in blueCFD-Core 2017 are still exactly the same.