git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #112951 from rmcgibbo/cbc

cbc: 2.10.3 -> 2.10.4

commit3bbd4267ab8f12d249b9092b38e8574e9882a1f1 authordavidak <davidak@users.noreply.github.com> dateMon 22 Feb 2021, 05:02 (6 years ago) parentaf32563aadc742
3 files changed+88−21
pkgs/applications/science/math/cbc/default.nix+7−4 pkgs/development/libraries/abseil-cpp/default.nix+6−2 pkgs/development/libraries/science/math/or-tools/default.nix+75−15
pkgs/applications/science/math/cbc/default.nix+7−4
@@ -2,14 +2,18 @@
22
33stdenv.mkDerivation rec {
44 pname = "cbc";
5− version = "2.10.3";
5+ version = "2.10.4";
6+
7+ # Note: Cbc 2.10.5 contains Clp 1.17.5 which hits this bug
8+ # that breaks or-tools https://github.com/coin-or/Clp/issues/130
69
710 src = fetchurl {
811 url = "https://www.coin-or.org/download/source/Cbc/Cbc-${version}.tgz";
9− sha256 = "1zzcg40ky5v96s7br2hqlkqdspwrn43kf3757g6c35wl29bq6f5d";
12+ sha256 = "0zq66j1vvpslswhzi9yfgkv6vmg7yry4pdmfgqaqw2vhyqxnsy39";
1013 };
1114
12− configureFlags = [ "-C" ];
15+ # or-tools has a hard dependency on Cbc static libraries, so we build both
16+ configureFlags = [ "-C" "--enable-static" ];
1317
1418 enableParallelBuilding = true;
1519
@@ -24,7 +28,6 @@ stdenv.mkDerivation rec {
2428 license = lib.licenses.epl10;
2529 maintainers = [ lib.maintainers.eelco ];
2630 platforms = lib.platforms.linux ++ lib.platforms.darwin;
27− broken = stdenv.isAarch64; # Missing <immintrin.h> after 2.10.0
2831 description = "A mixed integer programming solver";
2932 };
3033}
pkgs/development/libraries/abseil-cpp/default.nix+6−2
@@ -2,15 +2,19 @@
22
33stdenv.mkDerivation rec {
44 pname = "abseil-cpp";
5− version = "20200225.2";
5+ version = "20200923.3";
66
77 src = fetchFromGitHub {
88 owner = "abseil";
99 repo = "abseil-cpp";
1010 rev = version;
11− sha256 = "0dwxg54pv6ihphbia0iw65r64whd7v8nm4wwhcz219642cgpv54y";
11+ sha256 = "1p4djhm1f011ficbjjxx3n8428p8481p20j4glpaawnpsi362hkl";
1212 };
1313
14+ cmakeFlags = [
15+ "-DCMAKE_CXX_STANDARD=17"
16+ ];
17+
1418 nativeBuildInputs = [ cmake ];
1519
1620 meta = with lib; {
pkgs/development/libraries/science/math/or-tools/default.nix+75−15
@@ -1,40 +1,84 @@
1−{ lib, stdenv, fetchFromGitHub, cmake, abseil-cpp, gflags, which
2−, lsb-release, glog, protobuf, cbc, zlib
3−, ensureNewerSourcesForZipFilesHook, python, swig }:
1+{ lib
2+, stdenv
3+, fetchFromGitHub
4+, fetchpatch
5+, cmake
6+, abseil-cpp
7+, bzip2
8+, zlib
9+, lsb-release
10+, which
11+, protobuf
12+, cbc
13+, ensureNewerSourcesForZipFilesHook
14+, python
15+, swig4
16+}:
417
518stdenv.mkDerivation rec {
619 pname = "or-tools";
7− version = "7.7";
20+ version = "8.1";
21+ disabled = python.pythonOlder "3.6"; # not supported upstream
822
923 src = fetchFromGitHub {
1024 owner = "google";
1125 repo = "or-tools";
1226 rev = "v${version}";
13− sha256 = "06ig9a1afmzgzcg817y0rdq49ahll0q9y7bhhg9d89x6zy959ypv";
27+ sha256 = "1zqgvkaw5vf2d8pwsa34g9jysbpiwplzxc8jyy8kdbzmj8ax3gpg";
1428 };
1529
30+ patches = [
31+ # This patch (on master as of Feb 11, 2021) fixes or-tools failing to respect
32+ # USE_SCIP=OFF and then failing to find scip/scip.h
33+ (fetchpatch {
34+ url = "https://github.com/google/or-tools/commit/17321869832b5adaccd9864e7e5576122730a5d5.patch";
35+ sha256 = "0bi2z1hqlpdm1if3xa5dzc2zv0qlm5xi2x979brx10f8k779ghn0";
36+ })
37+ ];
38+
1639 # The original build system uses cmake which does things like pull
1740 # in dependencies through git and Makefile creation time. We
1841 # obviously don't want to do this so instead we provide the
1942 # dependencies straight from nixpkgs and use the make build method.
43+
44+ # Cbc is linked against bzip2 and declares this in its pkgs-config file,
45+ # but this makefile doesn't use pkgs-config, so we also have to add lbz2
2046 configurePhase = ''
47+ substituteInPlace makefiles/Makefile.third_party.unix.mk \
48+ --replace 'COINUTILS_LNK = $(STATIC_COINUTILS_LNK)' \
49+ 'COINUTILS_LNK = $(STATIC_COINUTILS_LNK) -lbz2'
50+
2151 cat <<EOF > Makefile.local
22− UNIX_ABSL_DIR=${abseil-cpp}
23− UNIX_GFLAGS_DIR=${gflags}
24− UNIX_GLOG_DIR=${glog}
25− UNIX_PROTOBUF_DIR=${protobuf}
26− UNIX_CBC_DIR=${cbc}
52+ UNIX_ABSL_DIR=${abseil-cpp}
53+ UNIX_PROTOBUF_DIR=${protobuf}
54+ UNIX_CBC_DIR=${cbc}
55+ USE_SCIP=OFF
2756 EOF
2857 '';
2958
59+ # Many of these 'samples' (which are really the tests) require using SCIP, and or-tools 8.1
60+ # will just crash if SCIP is not found because it doesn't fall back to using one of
61+ # the available solvers: https://github.com/google/or-tools/blob/b77bd3ac69b7f3bb02f55b7bab6cbb4bab3917f2/ortools/linear_solver/linear_solver.cc#L427
62+ # We don't compile with SCIP because it does not have an open source license.
63+ # See https://github.com/google/or-tools/issues/2395
64+ preBuild = ''
65+ for file in ortools/linear_solver/samples/*.cc; do
66+ if grep -q SCIP_MIXED_INTEGER_PROGRAMMING $file; then
67+ substituteInPlace $file --replace SCIP_MIXED_INTEGER_PROGRAMMING CBC_MIXED_INTEGER_PROGRAMMING
68+ fi;
69+ done
70+
71+ substituteInPlace ortools/linear_solver/samples/simple_mip_program.cc \
72+ --replace 'SCIP' 'CBC'
73+ '';
3074 makeFlags = [
3175 "prefix=${placeholder "out"}"
3276 "PROTOBUF_PYTHON_DESC=${python.pkgs.protobuf}/${python.sitePackages}/google/protobuf/descriptor_pb2.py"
3377 ];
3478 buildFlags = [ "cc" "pypi_archive" ];
3579
36− checkTarget = "test_cc";
3780 doCheck = true;
81+ checkTarget = "test_cc";
3882
3983 installTargets = [ "install_cc" ];
4084 # The upstream install_python target installs to $HOME.
@@ -43,14 +87,30 @@ stdenv.mkDerivation rec {
4387 (cd temp_python/ortools; PYTHONPATH="$python/${python.sitePackages}:$PYTHONPATH" python setup.py install '--prefix=$python')
4488 '';
4589
90+ enableParallelBuilding = true;
91+
4692 nativeBuildInputs = [
47− cmake lsb-release swig which zlib python
93+ cmake
94+ lsb-release
95+ swig4
96+ which
4897 ensureNewerSourcesForZipFilesHook
49− python.pkgs.setuptools python.pkgs.wheel
98+ python.pkgs.setuptools
99+ python.pkgs.wheel
100+ ];
101+ buildInputs = [
102+ zlib
103+ bzip2
104+ python
50105 ];
51106 propagatedBuildInputs = [
52− abseil-cpp gflags glog protobuf cbc
53− python.pkgs.protobuf python.pkgs.six
107+ abseil-cpp
108+ protobuf
109+
110+ python.pkgs.protobuf
111+ python.pkgs.six
112+ python.pkgs.absl-py
113+ python.pkgs.mypy-protobuf
54114 ];
55115
56116 outputs = [ "out" "python" ];