Skip to content

Using scip_bundled requires CBC and clang to be installed #100

@KnorpelSenf

Description

@KnorpelSenf

Problem

According to the README (I wrote), the SCIP solver can be used without a C compiler. It uses https://github.com/scipopt/scip-sys?tab=readme-ov-file#bundled-feature for that. However, it's still required to have clang installed. Somewhat ironically, you also need to have CBC installed in order to use SCIP.

Repro

Use the following Docker image.

FROM mcr.microsoft.com/devcontainers/rust:1-1-bookworm

This should contain all things to use good_lp with SCIP. In other words, you should be able to set up a basic Rust project with the following dependency in your Cargo.toml file.

[dependencies]
good_lp = { version = "1.13.0", default-features = false, features = ["scip", "scip_bundled"] }

However, it fails with the following build error.

   Compiling scip-sys v0.1.21
warning: [email protected]: Detected OS: linux
warning: [email protected]: Detected arch: x86_64
warning: [email protected]: Downloading from https://github.com/scipopt/scipoptsuite-deploy/releases/download/v0.7.0/libscip-linux-debug.zip
warning: [email protected]: Downloaded to "/tmp/.tmpI0lgYl/libscip.zip"
warning: [email protected]: Extracting to "/workspaces/scheduling-malleable-tasks/target/debug/build/scip-sys-c78f92ab07fcdd58/out"
warning: [email protected]: Using SCIP from /workspaces/scheduling-malleable-tasks/target/debug/build/scip-sys-c78f92ab07fcdd58/out/scip_install/lib
error: failed to run custom build command for `scip-sys v0.1.21`

Caused by:
  process didn't exit successfully: `/workspaces/scheduling-malleable-tasks/target/debug/build/scip-sys-6c6834fd22d726d3/build-script-build` (exit status: 101)
  --- stdout
  cargo:warning=Detected OS: linux
  cargo:warning=Detected arch: x86_64
  cargo:warning=Downloading from https://github.com/scipopt/scipoptsuite-deploy/releases/download/v0.7.0/libscip-linux-debug.zip
  cargo:warning=Downloaded to "/tmp/.tmpI0lgYl/libscip.zip"
  cargo:warning=Extracting to "/workspaces/scheduling-malleable-tasks/target/debug/build/scip-sys-c78f92ab07fcdd58/out"
  cargo:warning=Using SCIP from /workspaces/scheduling-malleable-tasks/target/debug/build/scip-sys-c78f92ab07fcdd58/out/scip_install/lib
  cargo:rustc-link-search=/workspaces/scheduling-malleable-tasks/target/debug/build/scip-sys-c78f92ab07fcdd58/out/scip_install/lib
  cargo:libdir=/workspaces/scheduling-malleable-tasks/target/debug/build/scip-sys-c78f92ab07fcdd58/out/scip_install/lib
  cargo:rustc-link-arg=-Wl,-rpath,/workspaces/scheduling-malleable-tasks/target/debug/build/scip-sys-c78f92ab07fcdd58/out/scip_install/lib
  cargo:rustc-link-lib=scip

  --- stderr

  thread 'main' panicked at /usr/local/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bindgen-0.64.0/lib.rs:2393:31:
  Unable to find libclang: "couldn't find any valid shared libraries matching: ['libclang.so', 'libclang-*.so', 'libclang.so.*', 'libclang-*.so.*'], set the `LIBCLANG_PATH` environment variable to a path where one of these files can be found (invalid: [])"
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

You can now change the Docker image to include clang which will bring you a step further.

FROM mcr.microsoft.com/devcontainers/rust:1-1-bookworm

RUN apt-get update && export DEBIAN_FRONTEND=noninteractive && apt-get -y install clang

You will now see the following error.

   Compiling scip-sys v0.1.21
   Compiling russcip v0.7.1
   Compiling good_lp v1.13.0
   Compiling scheduling-malleable-tasks v0.1.0 (/workspaces/scheduling-malleable-tasks)
error: linking with `cc` failed: exit status: 1
  |
  = note:  "cc" "-m64" "/tmp/rustcQYHguC/symbols.o" "<208 object files omitted>" "-Wl,--as-needed" "-Wl,-Bstatic" "/workspaces/scheduling-malleable-tasks/target/debug/deps/{libsvg-04122c7b891b4bf8.rlib,libgood_lp-7ae0f1152ae116dd.rlib,librusscip-29ca5be352d71fa3.rlib,libscip_sys-96a76ffce7839d17.rlib,libfnv-e363583e1b6fdae8.rlib,libcpm_rs-d62c8c277c683d64.rlib,librand-f3005b65dbefeaea.rlib,librand_chacha-99999d3cc561cd77.rlib,libppv_lite86-9f65517081565f5a.rlib,libzerocopy-b119440df8d5a5c3.rlib,librand_core-6025fd635112f165.rlib,libgetrandom-fef4ce91088f95ca.rlib,libcfg_if-f52ed1292e79c10c.rlib,libitertools-4baebf5cb0d8cc57.rlib,libeither-f9c8554968d2d0b1.rlib,libcsv-62014aa54a452553.rlib,libryu-9f5ba4537d50f128.rlib,libitoa-1d34ec624624d608.rlib,libcsv_core-058dc571269c38c0.rlib,libserde-3c5e2754f8f296c5.rlib,libopen-6beb11303b2b336a.rlib,libpathdiff-db5f2acff7ea901e.rlib,libis_wsl-aadc506f888eaaaa.rlib,libis_docker-d6e400666a45d19b.rlib,libonce_cell-dfa4fa0cc8a504f1.rlib,liblibc-48f3c545be33f5ed.rlib,libclap-a5589fcf02b49f4a.rlib,libclap_builder-f0588bb14bc1d056.rlib,libstrsim-cd89ec10c58c8c9e.rlib,libclap_lex-ad85b797eb91717f.rlib,libenv_logger-3ee3d016a8add31f.rlib,libanstream-37605a02f0fac906.rlib,libanstyle_query-5f4bd87459b20ad6.rlib,libis_terminal_polyfill-0ec8cf20a8fd5a04.rlib,libcolorchoice-ba17308800d88ed6.rlib,libanstyle_parse-4881a1eda670a37e.rlib,libutf8parse-ed0f948dddfa5152.rlib,libjiff-46a1cdff2864ad3e.rlib,libenv_filter-315b02fe49ca08d2.rlib,libregex-8d2aa754afc5bc70.rlib,libregex_automata-59f3e4e0b3b3b173.rlib,libaho_corasick-98faf4abfbc32d5b.rlib,libmemchr-99ecde59a9784c40.rlib,libregex_syntax-e9911f1b4a36081d.rlib,libanstyle-894b0e78f8d7fc16.rlib,liblog-301258bcf5dbcba7.rlib}.rlib" "<sysroot>/lib/rustlib/x86_64-unknown-linux-gnu/lib/{libstd-*,libpanic_unwind-*,libobject-*,libmemchr-*,libaddr2line-*,libgimli-*,librustc_demangle-*,libstd_detect-*,libhashbrown-*,librustc_std_workspace_alloc-*,libminiz_oxide-*,libadler2-*,libunwind-*,libcfg_if-*,liblibc-*,liballoc-*,librustc_std_workspace_core-*,libcore-*,libcompiler_builtins-*}.rlib" "-Wl,-Bdynamic" "-lscip" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-L" "/tmp/rustcQYHguC/raw-dylibs" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "/workspaces/scheduling-malleable-tasks/target/debug/build/scip-sys-c78f92ab07fcdd58/out/scip_install/lib" "-L" "<sysroot>/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "/workspaces/scheduling-malleable-tasks/target/debug/deps/scheduling_malleable_tasks-720978c15c509f34" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs"
  = note: some arguments are omitted. use `--verbose` to show all linker arguments
  = note: /usr/bin/ld: warning: libgfortran.so.5, needed by /workspaces/scheduling-malleable-tasks/target/debug/build/scip-sys-c78f92ab07fcdd58/out/scip_install/lib/libscip.so, not found (try using -rpath or -rpath-link)
          /usr/bin/ld: /workspaces/scheduling-malleable-tasks/target/debug/build/scip-sys-c78f92ab07fcdd58/out/scip_install/lib/libscip.so: undefined reference to `_gfortran_random_r8@GFORTRAN_8'
          /usr/bin/ld: /workspaces/scheduling-malleable-tasks/target/debug/build/scip-sys-c78f92ab07fcdd58/out/scip_install/lib/libscip.so: undefined reference to `_gfortran_concat_string@GFORTRAN_8'
          /usr/bin/ld: /workspaces/scheduling-malleable-tasks/target/debug/build/scip-sys-c78f92ab07fcdd58/out/scip_install/lib/libscip.so: undefined reference to `_gfortran_runtime_error_at@GFORTRAN_8'
          /usr/bin/ld: /workspaces/scheduling-malleable-tasks/target/debug/build/scip-sys-c78f92ab07fcdd58/out/scip_install/lib/libscip.so: undefined reference to `_gfortran_os_error@GFORTRAN_8'
          /usr/bin/ld: /workspaces/scheduling-malleable-tasks/target/debug/build/scip-sys-c78f92ab07fcdd58/out/scip_install/lib/libscip.so: undefined reference to `_gfortran_st_close@GFORTRAN_8'
          /usr/bin/ld: /workspaces/scheduling-malleable-tasks/target/debug/build/scip-sys-c78f92ab07fcdd58/out/scip_install/lib/libscip.so: undefined reference to `_gfortran_st_read@GFORTRAN_8'
          /usr/bin/ld: /workspaces/scheduling-malleable-tasks/target/debug/build/scip-sys-c78f92ab07fcdd58/out/scip_install/lib/libscip.so: undefined reference to `_gfortran_select_string@GFORTRAN_8'
          /usr/bin/ld: /workspaces/scheduling-malleable-tasks/target/debug/build/scip-sys-c78f92ab07fcdd58/out/scip_install/lib/libscip.so: undefined reference to `_gfortran_stop_string@GFORTRAN_8'
          /usr/bin/ld: /workspaces/scheduling-malleable-tasks/target/debug/build/scip-sys-c78f92ab07fcdd58/out/scip_install/lib/libscip.so: undefined reference to `_gfortran_st_read_done@GFORTRAN_8'
          /usr/bin/ld: /workspaces/scheduling-malleable-tasks/target/debug/build/scip-sys-c78f92ab07fcdd58/out/scip_install/lib/libscip.so: undefined reference to `_gfortran_transfer_array@GFORTRAN_8'
          /usr/bin/ld: /workspaces/scheduling-malleable-tasks/target/debug/build/scip-sys-c78f92ab07fcdd58/out/scip_install/lib/libscip.so: undefined reference to `_gfortran_internal_pack@GFORTRAN_8'
          /usr/bin/ld: /workspaces/scheduling-malleable-tasks/target/debug/build/scip-sys-c78f92ab07fcdd58/out/scip_install/lib/libscip.so: undefined reference to `_gfortran_transfer_real@GFORTRAN_8'
          /usr/bin/ld: /workspaces/scheduling-malleable-tasks/target/debug/build/scip-sys-c78f92ab07fcdd58/out/scip_install/lib/libscip.so: undefined reference to `_gfortran_transfer_logical@GFORTRAN_8'
          /usr/bin/ld: /workspaces/scheduling-malleable-tasks/target/debug/build/scip-sys-c78f92ab07fcdd58/out/scip_install/lib/libscip.so: undefined reference to `_gfortran_st_open@GFORTRAN_8'
          /usr/bin/ld: /workspaces/scheduling-malleable-tasks/target/debug/build/scip-sys-c78f92ab07fcdd58/out/scip_install/lib/libscip.so: undefined reference to `_gfortran_st_inquire@GFORTRAN_8'
          /usr/bin/ld: /workspaces/scheduling-malleable-tasks/target/debug/build/scip-sys-c78f92ab07fcdd58/out/scip_install/lib/libscip.so: undefined reference to `_gfortran_compare_string@GFORTRAN_8'
          /usr/bin/ld: /workspaces/scheduling-malleable-tasks/target/debug/build/scip-sys-c78f92ab07fcdd58/out/scip_install/lib/libscip.so: undefined reference to `_gfortran_st_write_done@GFORTRAN_8'
          /usr/bin/ld: /workspaces/scheduling-malleable-tasks/target/debug/build/scip-sys-c78f92ab07fcdd58/out/scip_install/lib/libscip.so: undefined reference to `_gfortran_transfer_array_write@GFORTRAN_8'
          /usr/bin/ld: /workspaces/scheduling-malleable-tasks/target/debug/build/scip-sys-c78f92ab07fcdd58/out/scip_install/lib/libscip.so: undefined reference to `_gfortran_string_len_trim@GFORTRAN_8'
          /usr/bin/ld: /workspaces/scheduling-malleable-tasks/target/debug/build/scip-sys-c78f92ab07fcdd58/out/scip_install/lib/libscip.so: undefined reference to `_gfortran_transfer_real_write@GFORTRAN_8'
          /usr/bin/ld: /workspaces/scheduling-malleable-tasks/target/debug/build/scip-sys-c78f92ab07fcdd58/out/scip_install/lib/libscip.so: undefined reference to `_gfortran_transfer_character@GFORTRAN_8'
          /usr/bin/ld: /workspaces/scheduling-malleable-tasks/target/debug/build/scip-sys-c78f92ab07fcdd58/out/scip_install/lib/libscip.so: undefined reference to `_gfortran_date_and_time@GFORTRAN_8'
          /usr/bin/ld: /workspaces/scheduling-malleable-tasks/target/debug/build/scip-sys-c78f92ab07fcdd58/out/scip_install/lib/libscip.so: undefined reference to `_gfortran_transfer_integer_write@GFORTRAN_8'
          /usr/bin/ld: /workspaces/scheduling-malleable-tasks/target/debug/build/scip-sys-c78f92ab07fcdd58/out/scip_install/lib/libscip.so: undefined reference to `_gfortran_adjustl@GFORTRAN_8'
          /usr/bin/ld: /workspaces/scheduling-malleable-tasks/target/debug/build/scip-sys-c78f92ab07fcdd58/out/scip_install/lib/libscip.so: undefined reference to `_gfortran_st_write@GFORTRAN_8'
          /usr/bin/ld: /workspaces/scheduling-malleable-tasks/target/debug/build/scip-sys-c78f92ab07fcdd58/out/scip_install/lib/libscip.so: undefined reference to `_gfortran_transfer_integer@GFORTRAN_8'
          /usr/bin/ld: /workspaces/scheduling-malleable-tasks/target/debug/build/scip-sys-c78f92ab07fcdd58/out/scip_install/lib/libscip.so: undefined reference to `_gfortran_transfer_logical_write@GFORTRAN_8'
          /usr/bin/ld: /workspaces/scheduling-malleable-tasks/target/debug/build/scip-sys-c78f92ab07fcdd58/out/scip_install/lib/libscip.so: undefined reference to `_gfortran_transfer_character_write@GFORTRAN_8'
          /usr/bin/ld: /workspaces/scheduling-malleable-tasks/target/debug/build/scip-sys-c78f92ab07fcdd58/out/scip_install/lib/libscip.so: undefined reference to `_gfortran_string_trim@GFORTRAN_8'
          collect2: error: ld returned 1 exit status
          
  = note: some `extern` functions couldn't be found; some native libraries may need to be installed or have their path specified
  = note: use the `-l` flag to specify native libraries to link
  = note: use the `cargo:rustc-link-lib` directive to specify the native libraries to link with Cargo (see https://doc.rust-lang.org/cargo/reference/build-scripts.html#rustc-link-lib)

error: could not compile `scheduling-malleable-tasks` (bin "scheduling-malleable-tasks") due to 1 previous error

It can be fixed by adding CBC to the system like so.

FROM mcr.microsoft.com/devcontainers/rust:1-1-bookworm

RUN apt-get update && export DEBIAN_FRONTEND=noninteractive && apt-get -y install coinor-libcbc-dev clang

Solution

If I understand the above logs correctly, the C compiler is just needed to link the library, not to compile it. However, if the project claims not to need a C compiler then it's misleading to still need a C compiler (even just for linking).

Perhaps scipopt/scip-sys#19 would fix this?

If there is no solution in sight, we should edit the README again and remove the checkmark for SCIP.

As to why FORTRAN is needed and why installing CBC fixes that, I have no idea.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions