|
| 1 | +# Building IDAES binaries locally |
| 2 | + |
| 3 | +For testing purposes, it may be useful to build the binaries locally, i.e. not |
| 4 | +using the Docker build scripts. This is also necessary for the MacOS builds |
| 5 | +(see the MacOS section in `build.md` for more information). |
| 6 | + |
| 7 | +You can build locally by running the following scripts: |
| 8 | + |
| 9 | +- `scripts/compile_solvers.sh`: Compile solvers (including `k_aug`, `dot_sens`, |
| 10 | +`petsc`, and all solver-associated libraries). |
| 11 | +- `scripts/compile_libs.sh`: Compile shared libraries for external functions. |
| 12 | + |
| 13 | +It is recommended to perform an "out-of-source" build. This can be done by |
| 14 | +first running `scripts/build_directory.sh _build` from the top level of this |
| 15 | +repository. This copies source code, makefiles, patch files, and build scripts |
| 16 | +into the `_build` directory, where you will actually run the build. |
| 17 | +Move into the build directory with `cd _build`. |
| 18 | + |
| 19 | +The build scripts were not designed for local use, so there are a few gotchas: |
| 20 | + |
| 21 | +- We look for patch files in a specific location relative to the original |
| 22 | +working directory. I.e. you must run `compile_solvers.sh` from *one level above* |
| 23 | +the scripts directory in order for patches (e.g. `ipopt.pc.patch`) to be |
| 24 | +correctly applied. |
| 25 | +- `ipopt.pc.patch` assumes that `coinmumps` and `coinhsl` are listed as |
| 26 | +dependencies in the `ipopt.pc` file. If either is not found (i.e. we are |
| 27 | +compiling without HSL), the patch application will fail. |
| 28 | +- By default, Petsc is assumed to be installed in hard-coded, OS-dependent |
| 29 | +location. If you are compiling locally, you have probably installed it |
| 30 | +in your own preferred location. To override the default, set the `PETSC_DIR` |
| 31 | +environment variable to the location where you have installed Petsc. |
| 32 | +- If you have your own system-installed HSL libraries that are discoverable |
| 33 | +by the linker (i.e. `LD_LIBRARY_PATH` is set), the COIN-OR solvers will likely |
| 34 | +be able to find and link against them. In this case, you will see a |
| 35 | +`HSL Present: NO` message (as there was no `coinhsl.zip` in the parent of the |
| 36 | +working directory), but will likely still build HSL-enabled solvers. |
0 commit comments