From a3d276ee97c4fcc076f622a2d609c429002c2c39 Mon Sep 17 00:00:00 2001 From: Mohammed Ghannam Date: Fri, 15 Mar 2024 14:07:14 +0100 Subject: [PATCH 01/52] Link statically --- build.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.rs b/build.rs index 8f00122..6bf3ffc 100644 --- a/build.rs +++ b/build.rs @@ -138,9 +138,9 @@ fn main() -> Result<(), Box> { }; #[cfg(windows)] - println!("cargo:rustc-link-lib=libscip"); + println!("cargo:rustc-link-lib=static=libscip"); #[cfg(not(windows))] - println!("cargo:rustc-link-lib=scip"); + println!("cargo:rustc-link-lib=static=scip"); let builder = builder .blocklist_item("FP_NAN") From ea8ca3a1d92c214a11cc1a1f5ed7fef6ea9e2086 Mon Sep 17 00:00:00 2001 From: Mohammed Ghannam Date: Sat, 6 Apr 2024 09:52:34 +0200 Subject: [PATCH 02/52] Link more libraries statically & add libz dependency --- Cargo.toml | 4 ++++ build.rs | 13 +++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 97b54c5..722ba2c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,3 +19,7 @@ reqwest = { version = "0.11", features = ["blocking", "json"], optional = true } zip = { version = "0.5", optional = true } tempfile = { version = "3.2", optional = true } zip-extract = { version = "0.1.3", optional = true } + + +[dependencies] +libz-sys = { version="1.1.16", features = ["static"] } \ No newline at end of file diff --git a/build.rs b/build.rs index 6bf3ffc..1253d66 100644 --- a/build.rs +++ b/build.rs @@ -50,7 +50,7 @@ fn _build_from_scip_dir(path: &str) -> bindgen::Builder { ); } - println!("cargo:rustc-link-arg=-Wl,-rpath,{}", lib_dir_path); + // println!("cargo:rustc-link-arg=-Wl,-rpath,{}", lib_dir_path); let include_dir = PathBuf::from(&path).join("include"); let include_dir_path = include_dir.to_str().unwrap(); @@ -140,7 +140,16 @@ fn main() -> Result<(), Box> { #[cfg(windows)] println!("cargo:rustc-link-lib=static=libscip"); #[cfg(not(windows))] - println!("cargo:rustc-link-lib=static=scip"); + { + println!("cargo:rustc-link-lib=static=gmp"); + println!("cargo:rustc-link-lib=static=gmpxx"); + println!("cargo:rustc-link-lib=static=ipopt"); + println!("cargo:rustc-link-lib=static=soplex"); + println!("cargo:rustc-link-lib=static=z"); + println!("cargo:rustc-link-lib=static=scip"); + println!("cargo:rustc-link-lib=dylib=c++"); + println!("cargo:rustc-link-lib=dylib=lapack"); + } let builder = builder .blocklist_item("FP_NAN") From 14919fc84227f24d6ac15dba5d2d056b593d8009 Mon Sep 17 00:00:00 2001 From: Mohammed Ghannam Date: Sat, 6 Apr 2024 10:00:14 +0200 Subject: [PATCH 03/52] Install blas and lapack on ubuntu --- .github/workflows/build_and_test.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 496ce0b..f97d5e7 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -21,6 +21,11 @@ jobs: runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v3 + - name: Install blas and lapack on ubuntu + if: runner.os == 'ubuntu-latest' + run: | + sudo apt-get update + sudo apt-get install -y libblas-dev liblapack-dev - name: Test run: | cargo t --features bundled create From c04d5533b307f5b2f79b971efebef6bcbeb96579 Mon Sep 17 00:00:00 2001 From: Mohammed Ghannam Date: Sat, 6 Apr 2024 10:01:43 +0200 Subject: [PATCH 04/52] Comment out from-source builds for now --- .github/workflows/build_and_test.yml | 40 ++++++++++++++-------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index ad41dc8..29ab7e0 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -32,26 +32,26 @@ jobs: cargo t --features bundled create cargo t --features bundled --examples - from-source-test: - strategy: - matrix: - os: [ - macos-latest, - macos-14, - ubuntu-latest, - ] - runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@v3 - - name: Install bison - if: ${{ matrix.os == 'macos-latest' || matrix.os == 'macos-14' }} - run: | - brew install bison - - name: Test from-source - run: | - cargo b --features from-source -vv - cargo t --features from-source create - cargo t --features from-source --examples +# from-source-test: +# strategy: +# matrix: +# os: [ +# macos-latest, +# macos-14, +# ubuntu-latest, +# ] +# runs-on: ${{ matrix.os }} +# steps: +# - uses: actions/checkout@v3 +# - name: Install bison +# if: ${{ matrix.os == 'macos-latest' || matrix.os == 'macos-14' }} +# run: | +# brew install bison +# - name: Test from-source +# run: | +# cargo b --features from-source -vv +# cargo t --features from-source create +# cargo t --features from-source --examples # TODO: fix this, needs tbb # windows-from-source: From 0c9aa2e563febedc52245005c4e8af54a5e2b9d5 Mon Sep 17 00:00:00 2001 From: Mohammed Ghannam Date: Sat, 6 Apr 2024 10:02:43 +0200 Subject: [PATCH 05/52] Fix condition --- .github/workflows/build_and_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 29ab7e0..dccc938 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -22,7 +22,7 @@ jobs: steps: - uses: actions/checkout@v3 - name: Install blas and lapack on ubuntu - if: runner.os == 'ubuntu-latest' + if: matrix.os == 'ubuntu-latest' run: | sudo apt-get update sudo apt-get install -y libblas-dev liblapack-dev From 84c3d23d681dde4e284122d1e7d56c21e74f0520 Mon Sep 17 00:00:00 2001 From: Mohammed Ghannam Date: Sat, 6 Apr 2024 10:05:22 +0200 Subject: [PATCH 06/52] Link against blas --- build.rs | 1 + from_source.rs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/build.rs b/build.rs index d049aa0..ef0f07d 100644 --- a/build.rs +++ b/build.rs @@ -146,6 +146,7 @@ fn main() -> Result<(), Box> { println!("cargo:rustc-link-lib=static=scip"); println!("cargo:rustc-link-lib=dylib=c++"); println!("cargo:rustc-link-lib=dylib=lapack"); + println!("cargo:rustc-link-lib=dylib=blas"); } let builder = builder diff --git a/from_source.rs b/from_source.rs index d6b59a4..48af8d9 100644 --- a/from_source.rs +++ b/from_source.rs @@ -52,6 +52,6 @@ pub fn compile_scip(source_path: PathBuf) -> PathBuf { } #[cfg(not(feature = "from-source"))] -pub fn compile_scip(source_path: PathBuf) -> PathBuf { +pub fn compile_scip(_source_path: PathBuf) -> PathBuf { unimplemented!("Cannot compile SCIP without the `from-source` feature") } \ No newline at end of file From 9f487b3499be4fd02e2cd84031e04d6822266fcd Mon Sep 17 00:00:00 2001 From: Mohammed Ghannam Date: Sat, 6 Apr 2024 10:08:08 +0200 Subject: [PATCH 07/52] Use pic version of soplex --- build.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.rs b/build.rs index ef0f07d..613d150 100644 --- a/build.rs +++ b/build.rs @@ -141,7 +141,7 @@ fn main() -> Result<(), Box> { println!("cargo:rustc-link-lib=static=gmp"); println!("cargo:rustc-link-lib=static=gmpxx"); println!("cargo:rustc-link-lib=static=ipopt"); - println!("cargo:rustc-link-lib=static=soplex"); + println!("cargo:rustc-link-lib=static=soplex-pic"); println!("cargo:rustc-link-lib=static=z"); println!("cargo:rustc-link-lib=static=scip"); println!("cargo:rustc-link-lib=dylib=c++"); From 7888483aa2d462d6030aef3df5608011ae7b6169 Mon Sep 17 00:00:00 2001 From: Mohammed Ghannam Date: Sat, 6 Apr 2024 10:10:45 +0200 Subject: [PATCH 08/52] Just try to make ubuntu work for now --- .github/workflows/build_and_test.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index dccc938..cfe3a9e 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -14,9 +14,9 @@ jobs: matrix: os: [ ubuntu-latest, - macos-latest, - macos-14, # macOS arm runner - windows-latest, +# macos-latest, +# macos-14, # macOS arm runner +# windows-latest, ] runs-on: ${{ matrix.os }} steps: From ec3424ed12ce3bdf61620aa4696a50dbb781a042 Mon Sep 17 00:00:00 2001 From: Mohammed Ghannam Date: Sat, 6 Apr 2024 10:14:23 +0200 Subject: [PATCH 09/52] Use -pie link arguemnt --- build.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/build.rs b/build.rs index 613d150..f3ecfbc 100644 --- a/build.rs +++ b/build.rs @@ -149,6 +149,9 @@ fn main() -> Result<(), Box> { println!("cargo:rustc-link-lib=dylib=blas"); } + + println!("cargo:rustc-link-arg=-pie"); + let builder = builder .blocklist_item("FP_NAN") .blocklist_item("FP_INFINITE") From 8d30165e1e1ea1c97717cf3434c6c27793c7c96e Mon Sep 17 00:00:00 2001 From: Mohammed Ghannam Date: Sat, 6 Apr 2024 10:34:03 +0200 Subject: [PATCH 10/52] PIE flag on linux --- build.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/build.rs b/build.rs index f3ecfbc..7b90889 100644 --- a/build.rs +++ b/build.rs @@ -134,6 +134,7 @@ fn main() -> Result<(), Box> { } }; + #[cfg(windows)] println!("cargo:rustc-link-lib=static=libscip"); #[cfg(not(windows))] @@ -149,8 +150,8 @@ fn main() -> Result<(), Box> { println!("cargo:rustc-link-lib=dylib=blas"); } - - println!("cargo:rustc-link-arg=-pie"); + #[cfg(linux)] + println!("cargo:rustc-cfg=PIE"); let builder = builder .blocklist_item("FP_NAN") From 4ae7f4b278c950429113c4671993100f9163eddb Mon Sep 17 00:00:00 2001 From: Mohammed Ghannam Date: Sat, 6 Apr 2024 10:39:10 +0200 Subject: [PATCH 11/52] -no-pie flag --- build.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/build.rs b/build.rs index 7b90889..8242102 100644 --- a/build.rs +++ b/build.rs @@ -150,8 +150,7 @@ fn main() -> Result<(), Box> { println!("cargo:rustc-link-lib=dylib=blas"); } - #[cfg(linux)] - println!("cargo:rustc-cfg=PIE"); + println!("cargo:rustc-link-arg=-no-pie"); let builder = builder .blocklist_item("FP_NAN") From 5ee17ef579aa277f0515ca4a2469afe6d4943486 Mon Sep 17 00:00:00 2001 From: Mohammed Ghannam Date: Sat, 6 Apr 2024 10:42:48 +0200 Subject: [PATCH 12/52] Add stdc++ dependency for linux --- build.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/build.rs b/build.rs index 8242102..1e5209a 100644 --- a/build.rs +++ b/build.rs @@ -145,13 +145,16 @@ fn main() -> Result<(), Box> { println!("cargo:rustc-link-lib=static=soplex-pic"); println!("cargo:rustc-link-lib=static=z"); println!("cargo:rustc-link-lib=static=scip"); - println!("cargo:rustc-link-lib=dylib=c++"); - println!("cargo:rustc-link-lib=dylib=lapack"); - println!("cargo:rustc-link-lib=dylib=blas"); + println!("cargo:rustc-link-lib=c++"); + println!("cargo:rustc-link-lib=lapack"); + println!("cargo:rustc-link-lib=blas"); } println!("cargo:rustc-link-arg=-no-pie"); + #[cfg(linux)] + println!("cargo:rustc-link-lib=stdc++"); + let builder = builder .blocklist_item("FP_NAN") .blocklist_item("FP_INFINITE") From 20b1bf7c2d5d381ae170cbaf475b9251846bee4e Mon Sep 17 00:00:00 2001 From: Mohammed Ghannam Date: Sat, 6 Apr 2024 10:56:51 +0200 Subject: [PATCH 13/52] Try linking to stdc++ --- build.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/build.rs b/build.rs index 1e5209a..1bebb26 100644 --- a/build.rs +++ b/build.rs @@ -145,15 +145,18 @@ fn main() -> Result<(), Box> { println!("cargo:rustc-link-lib=static=soplex-pic"); println!("cargo:rustc-link-lib=static=z"); println!("cargo:rustc-link-lib=static=scip"); - println!("cargo:rustc-link-lib=c++"); println!("cargo:rustc-link-lib=lapack"); println!("cargo:rustc-link-lib=blas"); } + // + // #[cfg(darwin)] + // println!("cargo:rustc-link-lib=dylib=c++"); + // #[cfg(linux)] + println!("cargo:rustc-link-lib=stdc++"); + println!("cargo:rustc-link-arg=-no-pie"); - #[cfg(linux)] - println!("cargo:rustc-link-lib=stdc++"); let builder = builder .blocklist_item("FP_NAN") From 5ffebe9970e50f2b1b5a62efd71111ceedab5d5e Mon Sep 17 00:00:00 2001 From: Mohammed Ghannam Date: Tue, 29 Oct 2024 18:03:33 +0100 Subject: [PATCH 14/52] Ignore .DS_Store --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 2da6cde..448200b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ target Cargo.lock -.idea \ No newline at end of file +.idea +.DS_Store \ No newline at end of file From 7093380b0b56679f7cb1c8639c2e76c92b6d8441 Mon Sep 17 00:00:00 2001 From: Mohammed Ghannam Date: Tue, 29 Oct 2024 18:06:15 +0100 Subject: [PATCH 15/52] Link c++ libs --- build.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/build.rs b/build.rs index 1bebb26..b474f80 100644 --- a/build.rs +++ b/build.rs @@ -142,16 +142,17 @@ fn main() -> Result<(), Box> { println!("cargo:rustc-link-lib=static=gmp"); println!("cargo:rustc-link-lib=static=gmpxx"); println!("cargo:rustc-link-lib=static=ipopt"); - println!("cargo:rustc-link-lib=static=soplex-pic"); + println!("cargo:rustc-link-lib=static=soplex"); println!("cargo:rustc-link-lib=static=z"); println!("cargo:rustc-link-lib=static=scip"); println!("cargo:rustc-link-lib=lapack"); println!("cargo:rustc-link-lib=blas"); } - // - // #[cfg(darwin)] - // println!("cargo:rustc-link-lib=dylib=c++"); - // #[cfg(linux)] + + #[cfg(darwin)] + println!("cargo:rustc-link-lib=dylib=c++"); + + #[cfg(linux)] println!("cargo:rustc-link-lib=stdc++"); From 276b884afed06a486df3cac1a669f7c063a56433 Mon Sep 17 00:00:00 2001 From: Mohammed Ghannam Date: Tue, 29 Oct 2024 18:06:49 +0100 Subject: [PATCH 16/52] Remove dynamic requirement for linking c++ libs on mac --- build.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.rs b/build.rs index b474f80..a9f78d6 100644 --- a/build.rs +++ b/build.rs @@ -150,7 +150,7 @@ fn main() -> Result<(), Box> { } #[cfg(darwin)] - println!("cargo:rustc-link-lib=dylib=c++"); + println!("cargo:rustc-link-lib=c++"); #[cfg(linux)] println!("cargo:rustc-link-lib=stdc++"); From ad00bd3488949525a5f43ade36f3d5fe2d720169 Mon Sep 17 00:00:00 2001 From: Mohammed Ghannam Date: Tue, 29 Oct 2024 18:09:26 +0100 Subject: [PATCH 17/52] Remove gmp from requirements --- build.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.rs b/build.rs index a9f78d6..b7fd702 100644 --- a/build.rs +++ b/build.rs @@ -139,8 +139,8 @@ fn main() -> Result<(), Box> { println!("cargo:rustc-link-lib=static=libscip"); #[cfg(not(windows))] { - println!("cargo:rustc-link-lib=static=gmp"); - println!("cargo:rustc-link-lib=static=gmpxx"); + // println!("cargo:rustc-link-lib=static=gmp"); + // println!("cargo:rustc-link-lib=static=gmpxx"); println!("cargo:rustc-link-lib=static=ipopt"); println!("cargo:rustc-link-lib=static=soplex"); println!("cargo:rustc-link-lib=static=z"); From 1f1d3c67e8b44ea1d106fb1e67cb39d1b8a993c8 Mon Sep 17 00:00:00 2001 From: Mohammed Ghannam Date: Tue, 29 Oct 2024 18:11:27 +0100 Subject: [PATCH 18/52] Install gmp --- .github/workflows/build_and_test.yml | 2 +- build.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index cfe3a9e..623b3b4 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -25,7 +25,7 @@ jobs: if: matrix.os == 'ubuntu-latest' run: | sudo apt-get update - sudo apt-get install -y libblas-dev liblapack-dev + sudo apt-get install -y libblas-dev liblapack-dev libgmp-dev - name: Test bundled run: | cargo b --features bundled -vv diff --git a/build.rs b/build.rs index b7fd702..a9f78d6 100644 --- a/build.rs +++ b/build.rs @@ -139,8 +139,8 @@ fn main() -> Result<(), Box> { println!("cargo:rustc-link-lib=static=libscip"); #[cfg(not(windows))] { - // println!("cargo:rustc-link-lib=static=gmp"); - // println!("cargo:rustc-link-lib=static=gmpxx"); + println!("cargo:rustc-link-lib=static=gmp"); + println!("cargo:rustc-link-lib=static=gmpxx"); println!("cargo:rustc-link-lib=static=ipopt"); println!("cargo:rustc-link-lib=static=soplex"); println!("cargo:rustc-link-lib=static=z"); From 631a38d50479f5e71d7f32058239c653ab96258d Mon Sep 17 00:00:00 2001 From: Mohammed Ghannam Date: Tue, 29 Oct 2024 18:11:49 +0100 Subject: [PATCH 19/52] Update job name --- .github/workflows/build_and_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 623b3b4..bc4761c 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -21,7 +21,7 @@ jobs: runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v3 - - name: Install blas and lapack on ubuntu + - name: Install requirements on ubuntu if: matrix.os == 'ubuntu-latest' run: | sudo apt-get update From 09a2f1e8bb311fb5ac2924106d98f2b49906da2a Mon Sep 17 00:00:00 2001 From: Mohammed Ghannam Date: Tue, 29 Oct 2024 18:15:40 +0100 Subject: [PATCH 20/52] Remove linking gmp --- build.rs | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/build.rs b/build.rs index a9f78d6..1dbfacb 100644 --- a/build.rs +++ b/build.rs @@ -139,8 +139,8 @@ fn main() -> Result<(), Box> { println!("cargo:rustc-link-lib=static=libscip"); #[cfg(not(windows))] { - println!("cargo:rustc-link-lib=static=gmp"); - println!("cargo:rustc-link-lib=static=gmpxx"); + // println!("cargo:rustc-link-lib=static=gmp"); + // println!("cargo:rustc-link-lib=static=gmpxx"); println!("cargo:rustc-link-lib=static=ipopt"); println!("cargo:rustc-link-lib=static=soplex"); println!("cargo:rustc-link-lib=static=z"); @@ -149,11 +149,15 @@ fn main() -> Result<(), Box> { println!("cargo:rustc-link-lib=blas"); } - #[cfg(darwin)] - println!("cargo:rustc-link-lib=c++"); - - #[cfg(linux)] - println!("cargo:rustc-link-lib=stdc++"); + let target = env::var("TARGET").unwrap(); + let apple = target.contains("apple"); + let linux = target.contains("linux"); + let mingw = target.contains("pc-windows-gnu"); + if apple { + println!("cargo:rustc-link-lib=dylib=c++"); + } else if linux || mingw { + println!("cargo:rustc-link-lib=dylib=stdc++"); + } println!("cargo:rustc-link-arg=-no-pie"); From d1d27afc4e6a8307c836fe99a3b4c8381fa898ed Mon Sep 17 00:00:00 2001 From: Mohammed Ghannam Date: Tue, 29 Oct 2024 18:22:50 +0100 Subject: [PATCH 21/52] Back to old binaries (contain static scip) --- build.rs | 3 +-- bundled.rs | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/build.rs b/build.rs index 1dbfacb..fd684df 100644 --- a/build.rs +++ b/build.rs @@ -139,8 +139,6 @@ fn main() -> Result<(), Box> { println!("cargo:rustc-link-lib=static=libscip"); #[cfg(not(windows))] { - // println!("cargo:rustc-link-lib=static=gmp"); - // println!("cargo:rustc-link-lib=static=gmpxx"); println!("cargo:rustc-link-lib=static=ipopt"); println!("cargo:rustc-link-lib=static=soplex"); println!("cargo:rustc-link-lib=static=z"); @@ -154,6 +152,7 @@ fn main() -> Result<(), Box> { let linux = target.contains("linux"); let mingw = target.contains("pc-windows-gnu"); if apple { + println!("cargo:rustc-link-lib=static=gmp"); println!("cargo:rustc-link-lib=dylib=c++"); } else if linux || mingw { println!("cargo:rustc-link-lib=dylib=stdc++"); diff --git a/bundled.rs b/bundled.rs index e1562c7..85967e0 100644 --- a/bundled.rs +++ b/bundled.rs @@ -37,7 +37,7 @@ pub fn download_scip() { }; let url = format!( - "https://github.com/scipopt/scipoptsuite-deploy/releases/download/v0.5.0/libscip-{os_string}.zip" + "https://github.com/scipopt/scip-sys/releases/download/v0.1.9/libscip-{os_string}.zip" ); download_and_extract_zip(&url, &extract_path) From e745849e3ddd5e9e17c9d7bca4bcde1c360effec Mon Sep 17 00:00:00 2001 From: Mohammed Ghannam Date: Tue, 29 Oct 2024 19:15:29 +0100 Subject: [PATCH 22/52] Add mumps --- build.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/build.rs b/build.rs index fd684df..fc84863 100644 --- a/build.rs +++ b/build.rs @@ -145,6 +145,7 @@ fn main() -> Result<(), Box> { println!("cargo:rustc-link-lib=static=scip"); println!("cargo:rustc-link-lib=lapack"); println!("cargo:rustc-link-lib=blas"); + println!("cargo:rustc-link-lib=coinmumps"); } let target = env::var("TARGET").unwrap(); From 11a7ab9e885ce2d9e64f4668d7a0544bb558492b Mon Sep 17 00:00:00 2001 From: Mohammed Ghannam Date: Tue, 29 Oct 2024 19:18:20 +0100 Subject: [PATCH 23/52] Link gfortran --- build.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/build.rs b/build.rs index fc84863..b180b4d 100644 --- a/build.rs +++ b/build.rs @@ -146,6 +146,7 @@ fn main() -> Result<(), Box> { println!("cargo:rustc-link-lib=lapack"); println!("cargo:rustc-link-lib=blas"); println!("cargo:rustc-link-lib=coinmumps"); + println!("cargo:rustc-link-lib=gfortran"); } let target = env::var("TARGET").unwrap(); From 14838e02587c61ec845f8eaaad683f3bd409c5ca Mon Sep 17 00:00:00 2001 From: Mohammed Ghannam Date: Tue, 29 Oct 2024 19:22:39 +0100 Subject: [PATCH 24/52] Install zlib --- .github/workflows/build_and_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index bc4761c..c566029 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -25,7 +25,7 @@ jobs: if: matrix.os == 'ubuntu-latest' run: | sudo apt-get update - sudo apt-get install -y libblas-dev liblapack-dev libgmp-dev + sudo apt-get install -y libblas-dev liblapack-dev zlib1g-dev - name: Test bundled run: | cargo b --features bundled -vv From 355741f5577cbc21e9bea69f535dc9c02e1f3c8e Mon Sep 17 00:00:00 2001 From: Mohammed Ghannam Date: Tue, 29 Oct 2024 19:22:48 +0100 Subject: [PATCH 25/52] Add zlib as build dependency --- Cargo.toml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 4508ddc..bfb8c25 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,6 +20,5 @@ zip = { version = "0.5", optional = true } tempfile = { version = "3.2", optional = true } zip-extract = { version = "0.1.3", optional = true } cmake = { version = "0.1.50", optional = true } - -[dependencies] libz-sys = { version="1.1.16", features = ["static"] } + From 72c29d1c2b2503b95546cdfb38ed5ac2aa765191 Mon Sep 17 00:00:00 2001 From: Mohammed Ghannam Date: Tue, 29 Oct 2024 19:25:06 +0100 Subject: [PATCH 26/52] Revert: Add zlib as build dependency --- Cargo.toml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index bfb8c25..4508ddc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,5 +20,6 @@ zip = { version = "0.5", optional = true } tempfile = { version = "3.2", optional = true } zip-extract = { version = "0.1.3", optional = true } cmake = { version = "0.1.50", optional = true } -libz-sys = { version="1.1.16", features = ["static"] } +[dependencies] +libz-sys = { version="1.1.16", features = ["static"] } From fd2a2752f830dc4a83ff48be1e1511975a582b15 Mon Sep 17 00:00:00 2001 From: Mohammed Ghannam Date: Tue, 29 Oct 2024 19:31:30 +0100 Subject: [PATCH 27/52] Add metis --- .github/workflows/build_and_test.yml | 2 +- build.rs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index c566029..4039bb0 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -25,7 +25,7 @@ jobs: if: matrix.os == 'ubuntu-latest' run: | sudo apt-get update - sudo apt-get install -y libblas-dev liblapack-dev zlib1g-dev + sudo apt-get install -y libblas-dev liblapack-dev zlib1g-dev libmetis-dev - name: Test bundled run: | cargo b --features bundled -vv diff --git a/build.rs b/build.rs index b180b4d..11b1a10 100644 --- a/build.rs +++ b/build.rs @@ -147,6 +147,7 @@ fn main() -> Result<(), Box> { println!("cargo:rustc-link-lib=blas"); println!("cargo:rustc-link-lib=coinmumps"); println!("cargo:rustc-link-lib=gfortran"); + println!("cargo:rustc-link-lib=metis"); } let target = env::var("TARGET").unwrap(); From 09522197af01f060ce8f42f3fdfc4a72722fd905 Mon Sep 17 00:00:00 2001 From: Mohammed Ghannam Date: Tue, 29 Oct 2024 19:33:33 +0100 Subject: [PATCH 28/52] Reenable all runners --- .github/workflows/build_and_test.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 4039bb0..618414c 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -14,9 +14,9 @@ jobs: matrix: os: [ ubuntu-latest, -# macos-latest, -# macos-14, # macOS arm runner -# windows-latest, + macos-latest, + macos-14, # macOS arm runner + windows-latest, ] runs-on: ${{ matrix.os }} steps: From c7b79e9b7006c86d546c99c349edeac5327dd492 Mon Sep 17 00:00:00 2001 From: Mohammed Ghannam Date: Tue, 29 Oct 2024 19:40:36 +0100 Subject: [PATCH 29/52] Trying removing gmp --- build.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/build.rs b/build.rs index 11b1a10..15fb164 100644 --- a/build.rs +++ b/build.rs @@ -155,7 +155,6 @@ fn main() -> Result<(), Box> { let linux = target.contains("linux"); let mingw = target.contains("pc-windows-gnu"); if apple { - println!("cargo:rustc-link-lib=static=gmp"); println!("cargo:rustc-link-lib=dylib=c++"); } else if linux || mingw { println!("cargo:rustc-link-lib=dylib=stdc++"); From 7222b2d813281505a325d0280f26a263dd135a48 Mon Sep 17 00:00:00 2001 From: Mohammed Ghannam Date: Tue, 29 Oct 2024 19:40:51 +0100 Subject: [PATCH 30/52] Focus on macos for now --- .github/workflows/build_and_test.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 618414c..13a1c56 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -13,10 +13,10 @@ jobs: strategy: matrix: os: [ - ubuntu-latest, +# ubuntu-latest, macos-latest, - macos-14, # macOS arm runner - windows-latest, +# macos-14, # macOS arm runner +# windows-latest, ] runs-on: ${{ matrix.os }} steps: From f3b628c77777dc48295d1ae0b60dcfb21fd2aebb Mon Sep 17 00:00:00 2001 From: Mohammed Ghannam Date: Tue, 29 Oct 2024 19:44:01 +0100 Subject: [PATCH 31/52] Install gcc --- .github/workflows/build_and_test.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 13a1c56..0c94610 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -26,6 +26,10 @@ jobs: run: | sudo apt-get update sudo apt-get install -y libblas-dev liblapack-dev zlib1g-dev libmetis-dev + - name: Install requirements on macos + if: matrix.os == 'macos-latest' || matrix.os == 'macos-14' + run: | + brew install gcc - name: Test bundled run: | cargo b --features bundled -vv From 1f59874aeccca1b2cc9cc5004062caa387574b74 Mon Sep 17 00:00:00 2001 From: Mohammed Ghannam Date: Tue, 29 Oct 2024 19:55:39 +0100 Subject: [PATCH 32/52] Add gfortran to lib paths --- .github/workflows/build_and_test.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 0c94610..ae6b434 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -32,7 +32,8 @@ jobs: brew install gcc - name: Test bundled run: | - cargo b --features bundled -vv + export DYLD_LIBRARY_PATH=/opt/homebrew/opt/gcc@14/lib/gcc/14:$DYLD_LIBRARY_PATH + cargo b --features bundled cargo t --features bundled create cargo t --features bundled --examples From 51edd6f9b513162ec993a2f222b77bb5537f7fd4 Mon Sep 17 00:00:00 2001 From: Mohammed Ghannam Date: Tue, 29 Oct 2024 19:58:47 +0100 Subject: [PATCH 33/52] Print info --- .github/workflows/build_and_test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index ae6b434..4b14a2e 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -30,6 +30,7 @@ jobs: if: matrix.os == 'macos-latest' || matrix.os == 'macos-14' run: | brew install gcc + brew info gcc - name: Test bundled run: | export DYLD_LIBRARY_PATH=/opt/homebrew/opt/gcc@14/lib/gcc/14:$DYLD_LIBRARY_PATH From 1356114a7f9b8e201fb578237f6db272209250d0 Mon Sep 17 00:00:00 2001 From: Mohammed Ghannam Date: Tue, 29 Oct 2024 19:59:33 +0100 Subject: [PATCH 34/52] Also update ld_lib_paths --- .github/workflows/build_and_test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 4b14a2e..9d9f077 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -34,6 +34,7 @@ jobs: - name: Test bundled run: | export DYLD_LIBRARY_PATH=/opt/homebrew/opt/gcc@14/lib/gcc/14:$DYLD_LIBRARY_PATH + export LD_LIBRARY_PATH=/opt/homebrew/opt/gcc@14/lib/gcc/14:$LD_LIBRARY_PATH cargo b --features bundled cargo t --features bundled create cargo t --features bundled --examples From 02ae12d67813717842cbe82d4d1ad77a16051c2c Mon Sep 17 00:00:00 2001 From: Mohammed Ghannam Date: Tue, 29 Oct 2024 20:01:54 +0100 Subject: [PATCH 35/52] Fix path of gfortran --- .github/workflows/build_and_test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 9d9f077..14c4e76 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -33,8 +33,8 @@ jobs: brew info gcc - name: Test bundled run: | - export DYLD_LIBRARY_PATH=/opt/homebrew/opt/gcc@14/lib/gcc/14:$DYLD_LIBRARY_PATH - export LD_LIBRARY_PATH=/opt/homebrew/opt/gcc@14/lib/gcc/14:$LD_LIBRARY_PATH + export LIBRARY_PATH=$LIBRARY_PATH:/opt/homebrew/Cellar/gcc/14.2.0/lib/gcc/14 + export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/homebrew/Cellar/gcc/14.2.0/lib/gcc/14 cargo b --features bundled cargo t --features bundled create cargo t --features bundled --examples From 9f8b67e1e777fb31ec9105ebe041d275783d110c Mon Sep 17 00:00:00 2001 From: Mohammed Ghannam Date: Tue, 29 Oct 2024 20:03:43 +0100 Subject: [PATCH 36/52] Enable all again --- .github/workflows/build_and_test.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 14c4e76..4d5144f 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -13,10 +13,10 @@ jobs: strategy: matrix: os: [ -# ubuntu-latest, + ubuntu-latest, macos-latest, -# macos-14, # macOS arm runner -# windows-latest, + macos-14, # macOS arm runner + windows-latest, ] runs-on: ${{ matrix.os }} steps: From 3b164f90084ffe025fdb3af8f8cd69075c79147b Mon Sep 17 00:00:00 2001 From: Mohammed Ghannam Date: Tue, 29 Oct 2024 20:05:30 +0100 Subject: [PATCH 37/52] Fix export paths --- .github/workflows/build_and_test.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 4d5144f..aa204c5 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -29,12 +29,11 @@ jobs: - name: Install requirements on macos if: matrix.os == 'macos-latest' || matrix.os == 'macos-14' run: | - brew install gcc - brew info gcc + export LIBRARY_PATH=$LIBRARY_PATH:/opt/homebrew/Cellar/gcc/14.2.0/lib/gcc/14 >> $GITHUB_ENV + export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/homebrew/Cellar/gcc/14.2.0/lib/gcc/14 >> $GITHUB_ENV + - name: Test bundled run: | - export LIBRARY_PATH=$LIBRARY_PATH:/opt/homebrew/Cellar/gcc/14.2.0/lib/gcc/14 - export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/homebrew/Cellar/gcc/14.2.0/lib/gcc/14 cargo b --features bundled cargo t --features bundled create cargo t --features bundled --examples From afb73d114a9f115db435ff5a6b091f827d1fb2d8 Mon Sep 17 00:00:00 2001 From: Mohammed Ghannam Date: Tue, 29 Oct 2024 20:08:23 +0100 Subject: [PATCH 38/52] Fix export --- .github/workflows/build_and_test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index aa204c5..1e870b2 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -29,8 +29,8 @@ jobs: - name: Install requirements on macos if: matrix.os == 'macos-latest' || matrix.os == 'macos-14' run: | - export LIBRARY_PATH=$LIBRARY_PATH:/opt/homebrew/Cellar/gcc/14.2.0/lib/gcc/14 >> $GITHUB_ENV - export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/homebrew/Cellar/gcc/14.2.0/lib/gcc/14 >> $GITHUB_ENV + echo "export LIBRARY_PATH=$LIBRARY_PATH:/opt/homebrew/Cellar/gcc/14.2.0/lib/gcc/14" >> "${GITHUB_ENV}" + echo "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/homebrew/Cellar/gcc/14.2.0/lib/gcc/14" >> "${GITHUB_ENV}" - name: Test bundled run: | From c5f39d126c6567733b79bacbfe9439eb7eedc234 Mon Sep 17 00:00:00 2001 From: Mohammed Ghannam Date: Tue, 29 Oct 2024 20:14:26 +0100 Subject: [PATCH 39/52] Export gfortran for mac --- .github/workflows/build_and_test.yml | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 1e870b2..c745a88 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -13,10 +13,10 @@ jobs: strategy: matrix: os: [ - ubuntu-latest, +# ubuntu-latest, macos-latest, - macos-14, # macOS arm runner - windows-latest, +# macos-14, # macOS arm runner +# windows-latest, ] runs-on: ${{ matrix.os }} steps: @@ -32,12 +32,22 @@ jobs: echo "export LIBRARY_PATH=$LIBRARY_PATH:/opt/homebrew/Cellar/gcc/14.2.0/lib/gcc/14" >> "${GITHUB_ENV}" echo "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/homebrew/Cellar/gcc/14.2.0/lib/gcc/14" >> "${GITHUB_ENV}" - - name: Test bundled + - name: Test bundled (if not mac) + if: matrix.os != 'ubuntu-latest' run: | cargo b --features bundled cargo t --features bundled create cargo t --features bundled --examples + - name: Test bundled (if mac) + if: matrix.os == 'macos-latest' || matrix.os == 'macos-14' + run: | + export LIBRARY_PATH=$LIBRARY_PATH:/opt/homebrew/Cellar/gcc/14.2.0/lib/gcc/14 + export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/homebrew/Cellar/gcc/14.2.0/lib/gcc/14 + cargo b --features bundled --no-default-features + cargo t --features bundled create + cargo t --features bundled --examples + # from-source-test: # strategy: # matrix: From c546ed814a5f241db81d3790650c0a69c9b1b830 Mon Sep 17 00:00:00 2001 From: Mohammed Ghannam Date: Tue, 29 Oct 2024 20:16:21 +0100 Subject: [PATCH 40/52] Back to install gcc --- .github/workflows/build_and_test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index c745a88..f2370f9 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -29,8 +29,8 @@ jobs: - name: Install requirements on macos if: matrix.os == 'macos-latest' || matrix.os == 'macos-14' run: | - echo "export LIBRARY_PATH=$LIBRARY_PATH:/opt/homebrew/Cellar/gcc/14.2.0/lib/gcc/14" >> "${GITHUB_ENV}" - echo "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/homebrew/Cellar/gcc/14.2.0/lib/gcc/14" >> "${GITHUB_ENV}" + brew install gcc + brew info gcc - name: Test bundled (if not mac) if: matrix.os != 'ubuntu-latest' From 9c331da9d6f9a2113b03030ba46e9fcb1211b097 Mon Sep 17 00:00:00 2001 From: Mohammed Ghannam Date: Tue, 29 Oct 2024 20:18:58 +0100 Subject: [PATCH 41/52] Fix the run condition --- .github/workflows/build_and_test.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index f2370f9..8ef6702 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -26,6 +26,7 @@ jobs: run: | sudo apt-get update sudo apt-get install -y libblas-dev liblapack-dev zlib1g-dev libmetis-dev + - name: Install requirements on macos if: matrix.os == 'macos-latest' || matrix.os == 'macos-14' run: | @@ -33,7 +34,7 @@ jobs: brew info gcc - name: Test bundled (if not mac) - if: matrix.os != 'ubuntu-latest' + if: matrix.os == 'ubuntu-latest' || matrix.os == 'windows-latest' run: | cargo b --features bundled cargo t --features bundled create From 95c37e362559fde5d7f9b8867fb413378f4e7f9c Mon Sep 17 00:00:00 2001 From: Mohammed Ghannam Date: Tue, 29 Oct 2024 20:20:57 +0100 Subject: [PATCH 42/52] Add other runners --- .github/workflows/build_and_test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 8ef6702..91ef3e8 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -13,9 +13,9 @@ jobs: strategy: matrix: os: [ -# ubuntu-latest, + ubuntu-latest, macos-latest, -# macos-14, # macOS arm runner + macos-14, # macOS arm runner # windows-latest, ] runs-on: ${{ matrix.os }} From 965af325a8b7f214c301f3f7c04c4b703561e8d7 Mon Sep 17 00:00:00 2001 From: Mohammed Ghannam Date: Tue, 29 Oct 2024 20:22:41 +0100 Subject: [PATCH 43/52] Now focus on windows --- .github/workflows/build_and_test.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 91ef3e8..ad7ad05 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -13,10 +13,10 @@ jobs: strategy: matrix: os: [ - ubuntu-latest, - macos-latest, - macos-14, # macOS arm runner -# windows-latest, +# ubuntu-latest, +# macos-latest, +# macos-14, # macOS arm runner + windows-latest, ] runs-on: ${{ matrix.os }} steps: From 756d689c53c06b490e3a45e6c55535a54555d80e Mon Sep 17 00:00:00 2001 From: Mohammed Ghannam Date: Tue, 29 Oct 2024 20:28:41 +0100 Subject: [PATCH 44/52] Link to ipopt --- build.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/build.rs b/build.rs index 15fb164..7cf562a 100644 --- a/build.rs +++ b/build.rs @@ -135,8 +135,10 @@ fn main() -> Result<(), Box> { }; - #[cfg(windows)] - println!("cargo:rustc-link-lib=static=libscip"); + #[cfg(windows)]{ + println!("cargo:rustc-link-lib=static=libscip"); + println!("cargo:rustc-link-lib=static=libipopt"); + } #[cfg(not(windows))] { println!("cargo:rustc-link-lib=static=ipopt"); From 9f5bbc092fc52e69c9d0a454bdf32d045d1e3969 Mon Sep 17 00:00:00 2001 From: Mohammed Ghannam Date: Tue, 29 Oct 2024 20:29:35 +0100 Subject: [PATCH 45/52] Link other libs on windows --- build.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/build.rs b/build.rs index 7cf562a..1c0b4e1 100644 --- a/build.rs +++ b/build.rs @@ -138,6 +138,8 @@ fn main() -> Result<(), Box> { #[cfg(windows)]{ println!("cargo:rustc-link-lib=static=libscip"); println!("cargo:rustc-link-lib=static=libipopt"); + println!("cargo:rustc-link-lib=static=libsoplex"); + println!("cargo:rustc-link-lib=static=libz"); } #[cfg(not(windows))] { From 6d4feb5c9c9967778703bab01058a298b1b7ce80 Mon Sep 17 00:00:00 2001 From: Mohammed Ghannam Date: Tue, 29 Oct 2024 20:39:22 +0100 Subject: [PATCH 46/52] Fix ipopt linking on windows --- build.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/build.rs b/build.rs index 1c0b4e1..4dd2291 100644 --- a/build.rs +++ b/build.rs @@ -137,9 +137,8 @@ fn main() -> Result<(), Box> { #[cfg(windows)]{ println!("cargo:rustc-link-lib=static=libscip"); - println!("cargo:rustc-link-lib=static=libipopt"); println!("cargo:rustc-link-lib=static=libsoplex"); - println!("cargo:rustc-link-lib=static=libz"); + println!("cargo:rustc-link-lib=static=ipopt"); } #[cfg(not(windows))] { From 6808ac327cbaf715bc8d6cf8eb4a26395d2c02e8 Mon Sep 17 00:00:00 2001 From: Mohammed Ghannam Date: Tue, 29 Oct 2024 20:43:27 +0100 Subject: [PATCH 47/52] Reenable all --- .github/workflows/build_and_test.yml | 46 ++++++++++++++-------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index ad7ad05..04768e8 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -13,9 +13,9 @@ jobs: strategy: matrix: os: [ -# ubuntu-latest, -# macos-latest, -# macos-14, # macOS arm runner + ubuntu-latest, + macos-latest, + macos-14, # macOS arm runner windows-latest, ] runs-on: ${{ matrix.os }} @@ -49,26 +49,26 @@ jobs: cargo t --features bundled create cargo t --features bundled --examples -# from-source-test: -# strategy: -# matrix: -# os: [ -# macos-latest, -# macos-14, -# ubuntu-latest, -# ] -# runs-on: ${{ matrix.os }} -# steps: -# - uses: actions/checkout@v3 -# - name: Install bison -# if: ${{ matrix.os == 'macos-latest' || matrix.os == 'macos-14' }} -# run: | -# brew install bison -# - name: Test from-source -# run: | -# cargo b --features from-source -vv -# cargo t --features from-source create -# cargo t --features from-source --examples + from-source-test: + strategy: + matrix: + os: [ + macos-latest, + macos-14, + ubuntu-latest, + ] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v3 + - name: Install bison + if: ${{ matrix.os == 'macos-latest' || matrix.os == 'macos-14' }} + run: | + brew install bison + - name: Test from-source + run: | + cargo b --features from-source -vv + cargo t --features from-source create + cargo t --features from-source --examples # TODO: fix this, needs tbb # windows-from-source: From 3192b66638cb76713e2d913e0a28698921a50e7d Mon Sep 17 00:00:00 2001 From: Mohammed Ghannam Date: Tue, 29 Oct 2024 21:24:24 +0100 Subject: [PATCH 48/52] Add static feature --- .github/workflows/build_and_test.yml | 12 +++--- Cargo.toml | 3 +- build.rs | 57 +++++++++++++++------------- from_source.rs | 5 ++- 4 files changed, 42 insertions(+), 35 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 04768e8..dd2b3ee 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -36,18 +36,18 @@ jobs: - name: Test bundled (if not mac) if: matrix.os == 'ubuntu-latest' || matrix.os == 'windows-latest' run: | - cargo b --features bundled - cargo t --features bundled create - cargo t --features bundled --examples + cargo b --features bundled,static + cargo t --features bundled,static create + cargo t --features bundled,static --examples - name: Test bundled (if mac) if: matrix.os == 'macos-latest' || matrix.os == 'macos-14' run: | export LIBRARY_PATH=$LIBRARY_PATH:/opt/homebrew/Cellar/gcc/14.2.0/lib/gcc/14 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/homebrew/Cellar/gcc/14.2.0/lib/gcc/14 - cargo b --features bundled --no-default-features - cargo t --features bundled create - cargo t --features bundled --examples + cargo b --features bundled,static --no-default-features + cargo t --features bundled,static create + cargo t --features bundled,static --examples from-source-test: strategy: diff --git a/Cargo.toml b/Cargo.toml index 4508ddc..f23f8bf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,6 +10,7 @@ links = "scip" [features] bundled = ["ureq", "zip", "tempfile", "zip-extract"] from-source = ["ureq", "zip", "tempfile", "zip-extract", "cmake"] +static = ["libz-sys/static"] [build-dependencies] bindgen = "0.64" @@ -22,4 +23,4 @@ zip-extract = { version = "0.1.3", optional = true } cmake = { version = "0.1.50", optional = true } [dependencies] -libz-sys = { version="1.1.16", features = ["static"] } +libz-sys = { version="1.1.16", features = ["static"], optional = true } diff --git a/build.rs b/build.rs index 4dd2291..6ae8916 100644 --- a/build.rs +++ b/build.rs @@ -134,37 +134,40 @@ fn main() -> Result<(), Box> { } }; + #[cfg(feature = "static")] { + #[cfg(windows)]{ + println!("cargo:rustc-link-lib=static=libscip"); + println!("cargo:rustc-link-lib=static=libsoplex"); + println!("cargo:rustc-link-lib=static=ipopt"); + } + #[cfg(not(windows))] + { + println!("cargo:rustc-link-lib=static=ipopt"); + println!("cargo:rustc-link-lib=static=soplex"); + println!("cargo:rustc-link-lib=static=z"); + println!("cargo:rustc-link-lib=static=scip"); + println!("cargo:rustc-link-lib=lapack"); + println!("cargo:rustc-link-lib=blas"); + println!("cargo:rustc-link-lib=coinmumps"); + println!("cargo:rustc-link-lib=gfortran"); + println!("cargo:rustc-link-lib=metis"); + } - #[cfg(windows)]{ - println!("cargo:rustc-link-lib=static=libscip"); - println!("cargo:rustc-link-lib=static=libsoplex"); - println!("cargo:rustc-link-lib=static=ipopt"); - } - #[cfg(not(windows))] - { - println!("cargo:rustc-link-lib=static=ipopt"); - println!("cargo:rustc-link-lib=static=soplex"); - println!("cargo:rustc-link-lib=static=z"); - println!("cargo:rustc-link-lib=static=scip"); - println!("cargo:rustc-link-lib=lapack"); - println!("cargo:rustc-link-lib=blas"); - println!("cargo:rustc-link-lib=coinmumps"); - println!("cargo:rustc-link-lib=gfortran"); - println!("cargo:rustc-link-lib=metis"); - } + let target = env::var("TARGET").unwrap(); + let apple = target.contains("apple"); + let linux = target.contains("linux"); + let mingw = target.contains("pc-windows-gnu"); + if apple { + println!("cargo:rustc-link-lib=dylib=c++"); + } else if linux || mingw { + println!("cargo:rustc-link-lib=dylib=stdc++"); + } - let target = env::var("TARGET").unwrap(); - let apple = target.contains("apple"); - let linux = target.contains("linux"); - let mingw = target.contains("pc-windows-gnu"); - if apple { - println!("cargo:rustc-link-lib=dylib=c++"); - } else if linux || mingw { - println!("cargo:rustc-link-lib=dylib=stdc++"); } - - println!("cargo:rustc-link-arg=-no-pie"); + #[cfg(not(feature = "static"))] { + println!("cargo:rustc-link-lib=dylib=scip"); + } let builder = builder diff --git a/from_source.rs b/from_source.rs index 48af8d9..8872057 100644 --- a/from_source.rs +++ b/from_source.rs @@ -48,7 +48,10 @@ pub fn compile_scip(source_path: PathBuf) -> PathBuf { use cmake::Config; let mut dst = Config::new(source_path); - dst.define("AUTOBUILD", "ON").build() + dst + .define("AUTOBUILD", "ON") + .define("SHARED", "false") + .build() } #[cfg(not(feature = "from-source"))] From 97fe2ef6cef79b32c7b7e01945a30bbc8b5b4f10 Mon Sep 17 00:00:00 2001 From: Mohammed Ghannam Date: Tue, 29 Oct 2024 21:29:06 +0100 Subject: [PATCH 49/52] Remove static linking for from-source --- from_source.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/from_source.rs b/from_source.rs index 8872057..51da29e 100644 --- a/from_source.rs +++ b/from_source.rs @@ -50,7 +50,6 @@ pub fn compile_scip(source_path: PathBuf) -> PathBuf { dst .define("AUTOBUILD", "ON") - .define("SHARED", "false") .build() } From 792b0ad3eaf6f66abeecdfab223df2046e61b02d Mon Sep 17 00:00:00 2001 From: Mohammed Ghannam Date: Tue, 29 Oct 2024 21:29:47 +0100 Subject: [PATCH 50/52] Turn off ipopt in from-source --- from_source.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/from_source.rs b/from_source.rs index 51da29e..7368e50 100644 --- a/from_source.rs +++ b/from_source.rs @@ -50,6 +50,8 @@ pub fn compile_scip(source_path: PathBuf) -> PathBuf { dst .define("AUTOBUILD", "ON") + .define("SHARED", "false") + .define("IPOPT", "OFF") .build() } From fa846c0c6a8eb1edeafb0cb74b1e4781b403bbc0 Mon Sep 17 00:00:00 2001 From: Mohammed Ghannam Date: Tue, 29 Oct 2024 21:34:57 +0100 Subject: [PATCH 51/52] Add no-pie --- build.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/build.rs b/build.rs index 6ae8916..715dfd0 100644 --- a/build.rs +++ b/build.rs @@ -153,6 +153,8 @@ fn main() -> Result<(), Box> { println!("cargo:rustc-link-lib=metis"); } + println!("cargo:rustc-link-arg=-no-pie"); + let target = env::var("TARGET").unwrap(); let apple = target.contains("apple"); let linux = target.contains("linux"); From 0adbe10c241e52f727dd35b0c47558532dea147a Mon Sep 17 00:00:00 2001 From: Mohammed Ghannam Date: Tue, 29 Oct 2024 21:41:05 +0100 Subject: [PATCH 52/52] Remove static buildin in from-source for now --- from_source.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/from_source.rs b/from_source.rs index 7368e50..5668ad0 100644 --- a/from_source.rs +++ b/from_source.rs @@ -50,7 +50,6 @@ pub fn compile_scip(source_path: PathBuf) -> PathBuf { dst .define("AUTOBUILD", "ON") - .define("SHARED", "false") .define("IPOPT", "OFF") .build() }