Commit d3d03de4 authored by Mark Olesen's avatar Mark Olesen

DOC: relocate cross-compile (mingw) information to wiki content

parent 74a062d1
......@@ -199,11 +199,11 @@ ThirdParty directory will contain either an `Allwmake` file or a
## Useful Links
- Download [source](https://sourceforge.net/projects/openfoam/files/) and [download and installation instructions](http://www.openfoam.com/download/)
- Download [source](https://dl.openfoam.com/source/) and [download and installation instructions](http://www.openfoam.com/download/)
- [Documentation](http://www.openfoam.com/documentation)
- [Reporting bugs/issues/feature requests](http://www.openfoam.com/code/bug-reporting.php)
- [Issue tracker](https://develop.openfoam.com/Development/openfoam/issues)
- [Wiki](http://wiki.openfoam.com/) and [code wiki](https://develop.openfoam.com/Development/openfoam/wikis/)
- [Issue tracker](https://develop.openfoam.com/Development/openfoam/-/issues)
- [Code wiki](https://develop.openfoam.com/Development/openfoam/-/wikis/) and [general wiki](http://wiki.openfoam.com/)
- [Community](http://www.openfoam.com/community/), [Governance](http://www.openfoam.com/governance/)
- [Contacting OpenCFD](http://www.openfoam.com/contact/)
......
## OpenFOAM® Quick Build Guide
Prior to building, ensure that the [system requirements][link openfoam-require]
are satisfied (including any special [cross-compiling][link openfoam-cross]
are satisfied (including any special [cross-compiling][wiki-cross-compile]
considerations), and source the correct OpenFOAM environment.
For example, for the OpenFOAM-v2006 version:
```
......@@ -137,7 +137,7 @@ More details in the [ThirdParty build guide][link third-build].
[link openfoam-issues]: https://develop.openfoam.com/Development/openfoam/blob/develop/doc/BuildIssues.md
[link openfoam-config]: https://develop.openfoam.com/Development/openfoam/blob/develop/doc/Config.md
[link openfoam-build]: https://develop.openfoam.com/Development/openfoam/blob/develop/doc/Build.md
[link openfoam-cross]: https://develop.openfoam.com/Development/openfoam/blob/develop/doc/Cross-Compile-mingw.md
[wiki-cross-compile]: https://develop.openfoam.com/Development/openfoam/-/wikis/guides/build/cross-compile-mingw
[link openfoam-require]: https://develop.openfoam.com/Development/openfoam/blob/develop/doc/Requirements.md
[link third-readme]: https://develop.openfoam.com/Development/ThirdParty-common/blob/develop/README.md
[link third-build]: https://develop.openfoam.com/Development/ThirdParty-common/blob/develop/BUILD.md
......
......@@ -180,4 +180,4 @@ and attempt to install a `paraview~qt` version instead.
[link third-require]: https://develop.openfoam.com/Development/ThirdParty-common/blob/develop/Requirements.md
---
Copyright 2019 OpenCFD Ltd
Copyright 2019-2020 OpenCFD Ltd
## Notes for cross-compiling with mingw
### Minimum version
The mingw cross-compiler should be at least version 8.2.0 (tested) or
slightly older. Versions that are much older may have faulty regex
implementations.
### Host setup
On openSUSE use the packages for compilation:
```
mingw64-cross-binutils
mingw64-cross-cpp
mingw64-cross-gcc
mingw64-cross-gcc-c++
mingw64-filesystem
mingw64-headers
mingw64-runtime
mingw64-libwinpthread1
mingw64-winpthreads-devel
mingw64-libfftw3
mingw64-fftw3-devel
mingw64-libz
mingw64-zlib-devel
```
If the `zlib` (or `libz`) setup does not worksetup, it is possible to download that manually and compile as a
*static* library.
```
CC="$(wmake -show-c)" CFLAGS="$(wmake -show-cflags)" ./configure --static
make
```
The resulting output files (zconf.h, zlib.h) and (libz.a) either need
to be installed in system locations where OpenFOAM can find them, or if
they are to be shipped directly with OpenFOAM, they can also be placed
in the `src/OpenFOAM/include` and `platforms/XXX/lib` paths.
If the header files are only needed during compilation, it can be a
fairly convenient hack to simply place copies of them in the
`src/OSspecific/MSwindows` directory.
Flex is used in a few locations within OpenFOAM for generating code.
The generated C++ code requires the `FlexLexer.h` header file, but
its `/usr/include` location will be ignored by the cross-compiler.
As another ugly hack, a copy of this file can be made in a standard
project include location. For example,
```
ln -s /usr/include/FlexLexer.h src/OSspecific/MSwindows
```
The last point to consider when cross-compiling is the behaviour of
the OpenFOAM wmake toolchain used during compilation. These are found
under `wmake/src`. If the `Makefile` is used directly, executables
will be created that work on the target platform (Windows), but *not*
on the host platform (which is what is required). This is addressed
directly by the `wmake/src/Allmake` script, which will use the system
gcc to create host binaries for the wmake toolchain. If, for some
reason, you also require target wmake toolchain binaries, you will
need invoke make manually within the `wmake/src` directory.
The settings for cross-compilation are normally defined in the
`etc/pref.sh` file with contents like this:
```
# For mingw cross-compile
export WM_COMPILER=Mingw
export WM_MPLIB=MSMPI
export WM_LABEL_SIZE=32
# other settings...
```
Additional adjustments may be required in some other places. For example
in `etc/config.sh/FFTW`
```
fftw_version=fftw-system
export FFTW_ARCH_PATH=/usr/x86_64-w64-mingw32/sys-root/mingw
```
### Run-time setup
When using the cross-compiled executables and libraries, the
corresponding runtime libraries will be required.
These will need to be copied across from the Linux host system to the
target machine.
On openSUSE these runtime libraries are provided by the packages:
```
mingw64-libgcc_s_seh1
mingw64-libstdc++6
mingw64-libz
```
When running, the `WM_PROJECT_DIR` environment must be set.
OpenFOAM will otherwise not be able to locate its files.
### Known limitations (2020-06-16)
- kahip does not build
- ptscotch does not build
- boost should build ok, but no CGAL support (ie, no foamyHexMesh)
- no ParaView plugin, runTimePostProcessing
- reacting EulerFoam solvers have too many interdependencies and do
not yet compile cleanly.
It is advisable to compile with the wmake `-k` option to keep going
even when the EulerFoam solvers fail to compile.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment