MadNLP / MadNLP.jl

A solver for nonlinear programming
MIT License
169 stars 15 forks source link

Unable to install HSL extension in Windows #217

Closed IlyaOrson closed 1 year ago

IlyaOrson commented 2 years ago

I settled the env variable pointing to the HSL source location but could not install nor build the MadNLPHSL extension.

pkg> build MadNLPHSL
    Building MadNLPHSL → `C:\Users\ilyao\.julia\scratchspaces\44cfe95a-1eb2-52ea-b672-e2afdf69b78f\78742b9e9faaba0ade5617cdaca5e34f63c5fa8e\build.log`
ERROR: Error building `MadNLPHSL`:
ERROR: LoadError: Unable to open libLLVM!
Stacktrace:
  [1] error(s::String)
    @ Base .\error.jl:35
  [2] (::BinaryProvider.var"#open_libllvm#124")()
    @ BinaryProvider C:\Users\ilyao\.julia\packages\BinaryProvider\U2dKK\src\PlatformNames.jl:652
  [3] detect_cxx11_string_abi()
    @ BinaryProvider C:\Users\ilyao\.julia\packages\BinaryProvider\U2dKK\src\PlatformNames.jl:655
  [4] detect_compiler_abi()
    @ BinaryProvider C:\Users\ilyao\.julia\packages\BinaryProvider\U2dKK\src\PlatformNames.jl:668
  [5] top-level scope
    @ C:\Users\ilyao\.julia\packages\BinaryProvider\U2dKK\src\PlatformNames.jl:685
  [6] include(mod::Module, _path::String)
    @ Base .\Base.jl:419
  [7] include(x::String)
    @ BinaryProvider C:\Users\ilyao\.julia\packages\BinaryProvider\U2dKK\src\BinaryProvider.jl:1
  [8] top-level scope
    @ C:\Users\ilyao\.julia\packages\BinaryProvider\U2dKK\src\BinaryProvider.jl:12
  [9] include
    @ .\Base.jl:419 [inlined]
 [10] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt64}}, source::String)
    @ Base .\loading.jl:1554
 [11] top-level scope
    @ stdin:1
in expression starting at C:\Users\ilyao\.julia\packages\BinaryProvider\U2dKK\src\PlatformNames.jl:685
in expression starting at C:\Users\ilyao\.julia\packages\BinaryProvider\U2dKK\src\BinaryProvider.jl:1
in expression starting at stdin:1
ERROR: LoadError: Failed to precompile BinaryProvider [b99e7846-7c00-51b0-8f62-c81ae34c0232] to C:\Users\ilyao\.julia\compiled\v1.8\BinaryProvider\jl_B958.tmp.
Stacktrace:
  [1] error(s::String)
    @ Base .\error.jl:35
  [2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::IO, internal_stdout::IO, keep_loaded_modules::Bool)
    @ Base .\loading.jl:1705
  [3] compilecache
    @ .\loading.jl:1649 [inlined]
  [4] _require(pkg::Base.PkgId)
    @ Base .\loading.jl:1337
  [5] _require_prelocked(uuidkey::Base.PkgId)
    @ Base .\loading.jl:1200
  [6] macro expansion
    @ .\loading.jl:1180 [inlined]
  [7] macro expansion
    @ .\lock.jl:223 [inlined]
  [8] require(into::Module, mod::Symbol)
    @ Base .\loading.jl:1144
  [9] include(fname::String)
    @ Base.MainInclude .\client.jl:476
 [10] top-level scope
    @ none:5
in expression starting at C:\Users\ilyao\.julia\packages\MadNLPHSL\8XAiY\deps\build.jl:1

This is my system info:

pkg> st MadNLP MadNLPHSL
Status `D:\ilyao\Documents\research\neural_ode\transcription_neuralode\Project.toml`
  [2621e9c9] MadNLP v0.5.0
  [7fb6135f] MadNLPHSL v0.3.0

julia> versioninfo()
Julia Version 1.8.0
Commit 5544a0fab7 (2022-08-17 13:38 UTC)
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: 16 × AMD Ryzen 7 4800H with Radeon Graphics
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-13.0.1 (ORCJIT, znver2)
  Threads: 1 on 16 virtual cores
sshin23 commented 2 years ago

Thanks for reporting this @IlyaOrson, we'll try to look into it. MadNLPHSL build on Windows has not been tested before, and it might have some issues. Alternatively, you can compile your HSL library externally and set the environment variable MADNLP_HSL_LIBRARY_PATH or run MadNLP on WSL or docker.

But from the error stack trace, the error seems to be caused by BinaryProvider.jl. Have you tried using BinaryProvider?

IlyaOrson commented 2 years ago

Indeed the error seems to be unrelated to MadNLP. This is the upstream issue https://github.com/JuliaPackaging/BinaryProvider.jl/issues/211

IlyaOrson commented 2 years ago

Apparently that repo is not maintained anymore and the recommendation is to move to JLLs for binary dependencies. Would it be possible to do that with the HSL library?

sshin23 commented 2 years ago

@IlyaOrson unfortunately no, we cannot redistribute HSL due to license issues. But indeed BinaryProvider seems to be dead. I'll keep this open and look into alternatives

amontoison commented 2 years ago

@sshin23 I updated HSL.jl to drop BinaryProvider if it can help you: https://github.com/JuliaSmoothOptimizers/HSL.jl/pull/112

amontoison commented 1 year ago

@sshin23 @frapac For information, I released JuliaHSL.

sshin23 commented 1 year ago

Thanks, @amontoison, that's great news! One less thing for MadNLP to worry about :) We'll look into the ways to incorporate this into MadNLP