Skip to content

Commit db356d4

Browse files
juan-pablo-vielmamlubin
authored andcommitted
BinaryBuilder (#76)
* Update build.jl * Update REQUIRE * Update build.jl * Update build.jl * Update REQUIRE * Update build.jl * Update build.jl * Update .gitignore * Update REQUIRE * Update build.jl * Update REQUIRE * Update REQUIRE * downgrade to 2.0.5 * updated binaries installation make sure updated versions of binaries are installed * Update MOIWrapper.jl * Update MPBWrapper.jl * Update README.md * Fix WIN32 tests * custom install instructions
1 parent 2359497 commit db356d4

File tree

7 files changed

+57
-72
lines changed

7 files changed

+57
-72
lines changed

README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,13 @@ You can install ECOS.jl through the Julia package manager:
1414
julia> Pkg.add("ECOS")
1515
```
1616

17-
ECOS.jl will automatically setup the ECOS solver itself:
18-
- On Linux it will build from source
19-
- On OS X it will download a binary via [Homebrew.jl].
20-
- On Windows it will download a binary.
17+
ECOS.jl will automatically install and setup the ECOS solver itself using [BinaryProvider.jl](https://github.com/JuliaPackaging/BinaryProvider.jl).
18+
19+
## Custom Installation
20+
21+
After ECOS.jl is installed and built, you can replace the installed binary dependencies with custom builds by overwritting the binaries and libraries in ECOS.jl's `deps/usr` folder (e.g. in Julia v0.6 `$HOME/.julia/v0.6/ECOS/deps/usr`).
22+
23+
Note that the custom binaries will not be overwritten by subsequent builds of the currently installed version of ECOS.jl. However, if ECOS.jl is updated and the update includes new BinaryProvider versions of the ECOS binaries, then the custom binaries will be overwritten by the new BinaryProvider versions.
2124

2225
## Usage
2326

REQUIRE

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
julia 0.6
2-
BinDeps
32
MathProgBase 0.5 0.8
43
MathOptInterface 0.6 0.7
5-
@osx Homebrew
64
Compat 0.68
5+
BinaryProvider 0.3

deps/.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
11
deps.jl
22
usr/
3-
downloads/
4-
src/

deps/build.jl

Lines changed: 46 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,48 @@
1-
using BinDeps
2-
using Compat
3-
4-
@BinDeps.setup
5-
6-
ecos = library_dependency("ecos", aliases=["libecos"])
7-
8-
if Compat.Sys.isapple()
9-
using Homebrew
10-
provides( Homebrew.HB, "ecos", ecos, os = :Darwin )
1+
using BinaryProvider # requires BinaryProvider 0.3.0 or later
2+
3+
# Parse some basic command-line arguments
4+
const verbose = "--verbose" in ARGS
5+
const prefix = Prefix(get([a for a in ARGS if a != "--verbose"], 1, joinpath(@__DIR__, "usr")))
6+
products = [
7+
LibraryProduct(prefix, String["libecos"], :ecos),
8+
]
9+
10+
# Download binaries from hosted location
11+
bin_prefix = "https://github.com/juan-pablo-vielma/ECOSBuilder/releases/download/v2.0.5-beta"
12+
13+
# Listing of files generated by BinaryBuilder:
14+
download_info = Dict(
15+
Linux(:aarch64, :glibc) => ("$bin_prefix/ECOSBuilder.v2.0.5.aarch64-linux-gnu.tar.gz", "9e6279a971889df14eaa384c8138136c5918e1a3a97e913d1a23fb3e80d711a6"),
16+
Linux(:aarch64, :musl) => ("$bin_prefix/ECOSBuilder.v2.0.5.aarch64-linux-musl.tar.gz", "afeb89f158dbcb506230e35e13ad63ab374a35f8b4ebe3ff4d1c604acb98e79f"),
17+
Linux(:armv7l, :glibc, :eabihf) => ("$bin_prefix/ECOSBuilder.v2.0.5.arm-linux-gnueabihf.tar.gz", "2fd091c5581156acc1a135d7ad969563f4a356b2631b3d2f2e215c114960c98b"),
18+
Linux(:armv7l, :musl, :eabihf) => ("$bin_prefix/ECOSBuilder.v2.0.5.arm-linux-musleabihf.tar.gz", "776ceedd12467a761354e73641dba4c0e0b34df9e5635360880e0d7f4c347c64"),
19+
Linux(:i686, :glibc) => ("$bin_prefix/ECOSBuilder.v2.0.5.i686-linux-gnu.tar.gz", "2b622c881c0c0cb9a12f514a211512b8a0c2404c6e35f4817e0c590095a759aa"),
20+
Linux(:i686, :musl) => ("$bin_prefix/ECOSBuilder.v2.0.5.i686-linux-musl.tar.gz", "0318aafa7457e0d1cb9a85e0938498457341d0050036ac24ab05b8f2d0ea7d4f"),
21+
Windows(:i686) => ("$bin_prefix/ECOSBuilder.v2.0.5.i686-w64-mingw32.tar.gz", "2c5fba5caed62b5edc1199ebd62e702212197b916f6bab8f7ba30c2c16326117"),
22+
Linux(:powerpc64le, :glibc) => ("$bin_prefix/ECOSBuilder.v2.0.5.powerpc64le-linux-gnu.tar.gz", "9d75f00a0bd9ba2aa917f073cb9544f4fb74f0cd711eeb5b06ab13efe70cf16a"),
23+
MacOS(:x86_64) => ("$bin_prefix/ECOSBuilder.v2.0.5.x86_64-apple-darwin14.tar.gz", "617f20ee41dbbd34dd7f8cb4c8c5f84bf5e52646886880679d8c116de418fd29"),
24+
Linux(:x86_64, :glibc) => ("$bin_prefix/ECOSBuilder.v2.0.5.x86_64-linux-gnu.tar.gz", "69ea265aab6701b9ce2b9c3b6d574bd88f1fd4640527a8d106385359abe88021"),
25+
Linux(:x86_64, :musl) => ("$bin_prefix/ECOSBuilder.v2.0.5.x86_64-linux-musl.tar.gz", "52f6c0f3742e316eb15d5180cfa41c6a7985104745f7ede0bf0577087af97384"),
26+
FreeBSD(:x86_64) => ("$bin_prefix/ECOSBuilder.v2.0.5.x86_64-unknown-freebsd11.1.tar.gz", "52f2167039d40115a92f428c81e81b3de000cece3756ea9bfcf12c07ef6bd9bc"),
27+
Windows(:x86_64) => ("$bin_prefix/ECOSBuilder.v2.0.5.x86_64-w64-mingw32.tar.gz", "f38e30147d12bb06eab3517c314444ffaedf13f252947cb458bd34cddb73e481"),
28+
)
29+
30+
# Install unsatisfied or updated dependencies:
31+
unsatisfied = any(!satisfied(p; verbose=verbose) for p in products)
32+
if haskey(download_info, platform_key())
33+
url, tarball_hash = download_info[platform_key()]
34+
# Check if this build.jl is providing new versions of the binaries, and
35+
# if so, ovewrite the current binaries even if they were installed by the user
36+
if unsatisfied || !isinstalled(url, tarball_hash; prefix=prefix)
37+
# Download and install binaries
38+
install(url, tarball_hash; prefix=prefix, force=true, verbose=verbose)
39+
end
40+
elseif unsatisfied
41+
# If we don't have a BinaryProvider-compatible .tar.gz to download, complain.
42+
# Alternatively, you could attempt to install from a separate provider,
43+
# build from source or something even more ambitious here.
44+
error("Your platform $(triplet(platform_key())) is not supported by this package!")
1145
end
1246

13-
version = "2.0.5"
14-
win_version = "2.0.2"
15-
provides(Sources, URI("https://github.com/ifa-ethz/ecos/archive/v$version.tar.gz"),
16-
[ecos], os = :Unix, unpacked_dir="ecos-$version")
17-
18-
prefix = joinpath(BinDeps.depsdir(ecos),"usr")
19-
srcdir = joinpath(BinDeps.depsdir(ecos),"src","ecos-$version")
20-
21-
provides(Binaries, URI("https://cache.julialang.org/https://bintray.com/artifact/download/tkelman/generic/ecos-$win_version.7z"),
22-
[ecos], unpacked_dir="usr/bin$(Sys.WORD_SIZE)", os = :Windows,
23-
SHA="b90254220a9a63cba08700f3664519d360f45d363454e5c107e6f30e144a60a1")
24-
25-
# We'll keep this around for emergencies, but OSX users should be able to use Homebrew
26-
provides(SimpleBuild,
27-
(@build_steps begin
28-
GetSources(ecos)
29-
CreateDirectory(joinpath(prefix,"lib"))
30-
FileRule(joinpath(prefix,"lib","libecos.dylib"),@build_steps begin
31-
ChangeDirectory(srcdir)
32-
`make shared`
33-
`mv libecos.dylib $prefix/lib`
34-
end)
35-
end),[ecos], os = :Darwin)
36-
37-
provides(SimpleBuild,
38-
(@build_steps begin
39-
GetSources(ecos)
40-
CreateDirectory(joinpath(prefix,"lib"))
41-
FileRule(joinpath(prefix,"lib","libecos.so"),@build_steps begin
42-
ChangeDirectory(srcdir)
43-
`make shared`
44-
`mv libecos.so $prefix/lib`
45-
end)
46-
end),[ecos], os = :Unix)
47-
48-
@BinDeps.install Dict(:ecos => :ecos)
47+
# Write out a deps.jl file that will contain mappings for our products
48+
write_deps_file(joinpath(@__DIR__, "deps.jl"), products, verbose=verbose)

src/MPBWrapper.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ function MPB.loadproblem!(m::ECOSMathProgModel, c, A, b, constr_cones, var_cones
265265
for (cone,idxs) in constr_cones
266266
cone == :Free && error("Free cone constraints not handled")
267267
(cone == :SOC || cone == :ExpPrimal) && continue # Handle later
268-
idxset = vec(collect(idxs))::Vector{Int}
268+
idxset = vec(collect(idxs))
269269
if cone == :Zero
270270
append!(eq_rows, idxset)
271271
continue
@@ -331,7 +331,7 @@ function MPB.loadproblem!(m::ECOSMathProgModel, c, A, b, constr_cones, var_cones
331331
if cone == :SOC
332332
num_SOC_cones += 1
333333
push!(SOC_conedims, length(idxs))
334-
idx_list = collect(idxs)::Vector{Int}
334+
idx_list = collect(idxs)
335335
all_rows = vcat(all_rows, idx_list)
336336
end
337337
end

test/MOIWrapper.jl

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,6 @@ end
2525

2626
@testset "Continuous conic problems" begin
2727
exclude = ["sdp", "rootdet", "logdet"]
28-
@static if Compat.Sys.iswindows()
29-
# Test exp3 fails on Windows 32 and 64 bits because the windows
30-
# binaries are out of date just like EXP3 fails with the MPB wrapper
31-
# See https://github.com/JuliaOpt/ECOS.jl/issues/47
32-
push!(exclude, "exp3")
33-
end
34-
3528
MOIT.contconictest(MOIB.GeoMean{Float64}(MOIB.RSOC{Float64}(optimizer)),
3629
config, exclude)
3730
end

test/MPBWrapper.jl

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,7 @@ end
2424
include(joinpath(MPB_test_path, "conicinterface.jl"))
2525
coniclineartest(ECOS.ECOSSolver(), duals=true)
2626
conicSOCtest(ECOS.ECOSSolver(), duals=true)
27-
@static if !Compat.Sys.iswindows()
28-
# Test EXP3 fails on Windows 32 and 64 bits because the windows
29-
# binaries are out of date. There failure is:
30-
# Expression: (-(y[2]) * log(-(y[2]) / y[4]) + y[2]) - y[3] ≤ tol
31-
# Evaluated: 0.39942722775671957 ≤ 1.0e-6
32-
# See https://github.com/JuliaOpt/ECOS.jl/issues/47
33-
conicEXPtest(ECOS.ECOSSolver(), duals=true)
34-
end
35-
27+
conicEXPtest(ECOS.ECOSSolver(), duals=true)
3628
include(joinpath(MPB_test_path, "quadprog.jl"))
3729
socptest(ECOS.ECOSSolver())
3830
end

0 commit comments

Comments
 (0)