Hi, I'm unable to compile the tutorial from the docs.rs page. I boiled it down to the first line of code.
fn main() {
let mut model = CpModelBuilder::default();
}
The compilation fails with the following compiler-message:
error: linking with `cc` failed: exit status: 1
|
= note: "cc" "-m64" "/tmp/rustc0HD3jZ/symbols.o" "/home/moostropfen/repos/cp_sat_test/target/release/deps/cp_sat_test-4218de00e7218591.cp_sat_test.796bff4f-cgu.0.rcgu.o" "/home/moostropfen/repos/cp_sat_test/target/release/deps/cp_sat_test-4218de00e7218591.cp_sat_test.796bff4f-cgu.1.rcgu.o" "/home/moostropfen/repos/cp_sat_test/target/release/deps/cp_sat_test-4218de00e7218591.cp_sat_test.796bff4f-cgu.2.rcgu.o" "/home/moostropfen/repos/cp_sat_test/target/release/deps/cp_sat_test-4218de00e7218591.cp_sat_test.796bff4f-cgu.3.rcgu.o" "/home/moostropfen/repos/cp_sat_test/target/release/deps/cp_sat_test-4218de00e7218591.cp_sat_test.796bff4f-cgu.4.rcgu.o" "/home/moostropfen/repos/cp_sat_test/target/release/deps/cp_sat_test-4218de00e7218591.cp_sat_test.796bff4f-cgu.5.rcgu.o" "/home/moostropfen/repos/cp_sat_test/target/release/deps/cp_sat_test-4218de00e7218591.cp_sat_test.796bff4f-cgu.6.rcgu.o" "/home/moostropfen/repos/cp_sat_test/target/release/deps/cp_sat_test-4218de00e7218591.3kovovwyrqc5us51.rcgu.o" "-Wl,--as-needed" "-L" "/home/moostropfen/repos/cp_sat_test/target/release/deps" "-L" "/home/moostropfen/repos/cp_sat_test/target/release/build/cp_sat-f3fc18ec20b15bd6/out" "-L" "/usr/include/ortools/lib" "-L" "/home/moostropfen/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "/home/moostropfen/repos/cp_sat_test/target/release/deps/libcp_sat-e9130974727f5382.rlib" "/home/moostropfen/repos/cp_sat_test/target/release/deps/libprost-ec421cb9c57c324e.rlib" "/home/moostropfen/repos/cp_sat_test/target/release/deps/libbytes-041203b2d8753cce.rlib" "/home/moostropfen/repos/cp_sat_test/target/release/deps/liblibc-458b67f93e226fac.rlib" "/home/moostropfen/repos/cp_sat_test/target/release/deps/libsmallvec-5ff24209a016f56a.rlib" "-Wl,--start-group" "/home/moostropfen/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-5670385a2fe8b60b.rlib" "/home/moostropfen/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-fd56ba6dbf7aaecc.rlib" "/home/moostropfen/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libobject-b8acf8e5c2e85baa.rlib" "/home/moostropfen/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libmemchr-1706edefffdca0a2.rlib" "/home/moostropfen/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libaddr2line-f483302e0b13708e.rlib" "/home/moostropfen/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgimli-725b0718fc18e1ed.rlib" "/home/moostropfen/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle-de685fcf2157e6fb.rlib" "/home/moostropfen/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd_detect-f613ac3eda05b9ff.rlib" "/home/moostropfen/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libhashbrown-3de98a7d049af6a1.rlib" "/home/moostropfen/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libminiz_oxide-c12183655bdce152.rlib" "/home/moostropfen/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libadler-0fc7beea925de7e3.rlib" "/home/moostropfen/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-8c34825485bf59dc.rlib" "/home/moostropfen/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-ba5f7e926e729d81.rlib" "/home/moostropfen/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcfg_if-643de0950163a839.rlib" "/home/moostropfen/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-539ea2f72ef89687.rlib" "/home/moostropfen/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-871432094bb4c885.rlib" "/home/moostropfen/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_core-ef1a8ee61f2e39bf.rlib" "/home/moostropfen/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-f1646747442c1c7b.rlib" "-Wl,--end-group" "/home/moostropfen/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-ff283b4bf550fa1c.rlib" "-Wl,-Bdynamic" "-lstdc++" "-lortools" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-znoexecstack" "-L" "/home/moostropfen/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "/home/moostropfen/repos/cp_sat_test/target/release/deps/cp_sat_test-4218de00e7218591" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro,-znow" "-Wl,-O1" "-nodefaultlibs"
= note: /usr/bin/ld: /home/moostropfen/repos/cp_sat_test/target/release/deps/libcp_sat-e9130974727f5382.rlib(cp_sat_wrapper.o): undefined reference to symbol '_ZNK6google8protobuf11MessageLite16SerializeToArrayEPvi'
/usr/bin/ld: /usr/lib/libprotobuf.so.32: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
= help: 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#cargorustc-link-libkindname)
warning: `cp_sat_test` (bin "cp_sat_test") generated 3 warnings
error: could not compile `cp_sat_test` due to previous error; 3 warnings emitted
My ORTOOLS_PREFIX variable is not defined.
I run Archlinux and installed or-tools with paru from the following AUR repository.
My Cargo.toml includes cp-sat as a git dependency. Using version 0.3.3 from crates.io does not fix the problem.