# \[MadNLPHSL\] Feature proposal: simplify installation with custom-compiled HSL library

**URL:** https://discourse.julialang.org/t/madnlphsl-feature-proposal-simplify-installation-with-custom-compiled-hsl-library/126474
**Category:** Optimization (Mathematical)
**Tags:** package-extensions
**Created:** [March 2, 2025, 6:25pm UTC](https://discourse.julialang.org/t/madnlphsl-feature-proposal-simplify-installation-with-custom-compiled-hsl-library/126474 "2025-03-02T18:25:13Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![KSepetanc](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ksepetanc/32/10841_2.png) [@KSepetanc](https://discourse.julialang.org/u/KSepetanc)
#### Post date: [March 2, 2025, 6:25pm UTC](https://discourse.julialang.org/t/madnlphsl-feature-proposal-simplify-installation-with-custom-compiled-hsl-library/126474/1 "2025-03-02T18:25:13Z")

</div>

HSL\_jll.jl obtained from [https://licences.stfc.ac.uk/products/Software/HSL/LibHSL](https://licences.stfc.ac.uk/products/Software/HSL/LibHSL) requires free academic or purchased license and contains extended set of HSL libraries. However there is free license for individuals for HSL archive that has subset of HSL\_jll libraries, but includes “ma27” which is usually for optimal power flows the best anyway. To use HSL archive instead of HSL\_jll, archive needs to be custom compiled which I will here assume that it is already done. I have confirmed working `libhsl.so` with “ma27” tested on Ipopt (loaded at runtime).

MadNLPHSL includes short tutorial how to use custom compiled library, but I have failed in reproducing it. It states that `julia./artifacts/Overrides.toml` should be modified in the following way.

```julia
# replace HSL_jll.jl artifact /usr/local/lib/libhsl.so
ecece3e2c69a413a0e935cf52e03a3ad5492e137 = "/usr/local"

```

I’ve put `libhsl.so` at `/home/karlo/HSL/lib/libhsl.so`

And I’ve put in Overrides.toml after installing MadNLPHSL (clean installed as the only package in Julia).  
`ecece3e2c69a413a0e935cf52e03a3ad5492e137 = /home/karlo/HSL`

Normally, when I install MadNLPHSL and then dev-install HSL\_jll and then write `pkg>instantiate`, it rebuilds and everything is working (installation needs to be in that order). However, with Overrides.toml approach it should work without HSL\_jll installation which it does not (instead it should use custom compiled library).

It is my understanding that content-hash (“ecece”… code) is operating system dependant, even version dependant. I have tried even content-hash that actual HSL\_jll creates, which is for me `4caf94fdf1f7c386576863cb01ae5c56354bf33f`, but without installing HSL\_jll it did not work, and HSL\_jll is only obtainable using more strict licensing conditions so it should not be used.

To conclude, I think we need better tutorial for this or function to define custom library just like CUDA.jl has function to define CUDA version for case when installing on a system without installed CUDA such as containers. The referenced function is: `CUDA.set_runtime_version!(v"11.8"; local_toolkit=true)`

@amontoison you may know if this should be put on MadNLPHSL.jl or HSL.jl issue list.

---

<div class="post-metadata">

### Author: ![odow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/odow/32/28685_2.png) [@odow](https://discourse.julialang.org/u/odow)
#### Post date: [March 2, 2025, 8:45pm UTC](https://discourse.julialang.org/t/madnlphsl-feature-proposal-simplify-installation-with-custom-compiled-hsl-library/126474/2 "2025-03-02T20:45:44Z")

</div>

Here are the JuMP docs for how to use a custom binary: [Custom binaries · JuMP](https://jump.dev/JuMP.jl/stable/developers/custom_solver_binaries/)

---

<div class="post-metadata">

### Author: ![KSepetanc](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ksepetanc/32/10841_2.png) [@KSepetanc](https://discourse.julialang.org/u/KSepetanc)
#### Post date: [March 3, 2025, 12:34am UTC](https://discourse.julialang.org/t/madnlphsl-feature-proposal-simplify-installation-with-custom-compiled-hsl-library/126474/3 "2025-03-03T00:34:38Z")

</div>

This helps a lot. The confusing part with HSL\_jll is that there are two versions of it. One that is obtained from HSL site ([HSL\_jll.jl.v2024.11.28](https://licences.stfc.ac.uk/products/Software/HSL/LibHSL)) and public one HSL\_jll.jl (v4.0.2+0), each with different license conditions. The public version seems to include a free for all license that allows distribution and changes even for binaries as long as you do not take credit for the product. v2024 version does not allow for distribution unless purchased, but can take credit for it. Julia code is in both cases covered by permissive MIT license. Basically, public version can be used to override the artifact and use the binaries from HSL archive.

I haven’t tried it yet, but JuMP docs are very detailed. I marked it as solved. Thank you! 🙂

---

<div class="post-metadata">

### Author: ![odow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/odow/32/28685_2.png) [@odow](https://discourse.julialang.org/u/odow)
#### Post date: [March 3, 2025, 12:56am UTC](https://discourse.julialang.org/t/madnlphsl-feature-proposal-simplify-installation-with-custom-compiled-hsl-library/126474/4 "2025-03-03T00:56:07Z")

</div>

Note that the public HSL\_jll is a small shim that allows compilation by providing the appropriate symbols. It does not contain the actual contents of the HSL routines, so any code actually using it at runtime will error.

The idea is that you can add HSL\_jll as a package and distribute that so things will compile etc, but any user will still need to download the official package and agree to those license terms.

One example of a code that compiles with the public HSL\_jll is Uno:

> <https://github.com/odow/Yggdrasil/blob/7dd0723365f866de9f5a1c4fbe80cefa329c814f/U/Uno/build_tarballs.jl#L42>
