From 1cdbfb73348a5fbe8efb1d49b23b130a676dba1e Mon Sep 17 00:00:00 2001 From: annalee <150648636+a-n-n-a-l-e-e@users.noreply.github.com> Date: Sat, 25 Nov 2023 23:44:44 +0000 Subject: [PATCH 1/2] python311Packages.cvxopt: use LP64 blas on darwin; fix build darwin builds were using the ILP64 openblas library which causes the build to segufault in the unittests, which might be why the unit tests were disabled on darwin... this change aligns darwin to the linux build to use LP64 blas / lapack libraries. this also aligns with the assert at the top of the file which asserts blas and lapack are LP64. the darwin unit test is re-enabled and passes. --- .../python-modules/cvxopt/default.nix | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/pkgs/development/python-modules/cvxopt/default.nix b/pkgs/development/python-modules/cvxopt/default.nix index f6135ecba744..c52b518d69eb 100644 --- a/pkgs/development/python-modules/cvxopt/default.nix +++ b/pkgs/development/python-modules/cvxopt/default.nix @@ -4,9 +4,8 @@ , fetchPypi , isPyPy , python -, openblas , blas -, lapack # build segfaults with 64-bit blas +, lapack , suitesparse , unittestCheckHook , glpk ? null @@ -30,22 +29,13 @@ buildPythonPackage rec { hash = "sha256-NGH6QsGyJAuk2h2YXKc1A5FBV/xMd0FzJ+1tfYWs2+Y="; }; - buildInputs = (if stdenv.isDarwin then [ openblas ] else [ blas lapack ]); - doCheck = !stdenv.isDarwin; + buildInputs = [ blas lapack ]; # similar to Gsl, glpk, fftw there is also a dsdp interface # but dsdp is not yet packaged in nixpkgs - preConfigure = (if stdenv.isDarwin then - '' - export CVXOPT_BLAS_LIB=openblas - export CVXOPT_LAPACK_LIB=openblas - '' - else - '' + preConfigure = '' export CVXOPT_BLAS_LIB=blas export CVXOPT_LAPACK_LIB=lapack - '') + - '' export CVXOPT_BUILD_DSDP=0 export CVXOPT_SUITESPARSE_LIB_DIR=${lib.getLib suitesparse}/lib export CVXOPT_SUITESPARSE_INC_DIR=${lib.getDev suitesparse}/include From 7ee99913e80a49e7e7b1b6c5b9a9849a9dfe0f16 Mon Sep 17 00:00:00 2001 From: annalee <150648636+a-n-n-a-l-e-e@users.noreply.github.com> Date: Sun, 26 Nov 2023 19:29:01 +0000 Subject: [PATCH 2/2] python311Packages.cvxopt: set env vars in env rather than preConfigure --- .../python-modules/cvxopt/default.nix | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/pkgs/development/python-modules/cvxopt/default.nix b/pkgs/development/python-modules/cvxopt/default.nix index c52b518d69eb..3e94238709d5 100644 --- a/pkgs/development/python-modules/cvxopt/default.nix +++ b/pkgs/development/python-modules/cvxopt/default.nix @@ -33,25 +33,25 @@ buildPythonPackage rec { # similar to Gsl, glpk, fftw there is also a dsdp interface # but dsdp is not yet packaged in nixpkgs - preConfigure = '' - export CVXOPT_BLAS_LIB=blas - export CVXOPT_LAPACK_LIB=lapack - export CVXOPT_BUILD_DSDP=0 - export CVXOPT_SUITESPARSE_LIB_DIR=${lib.getLib suitesparse}/lib - export CVXOPT_SUITESPARSE_INC_DIR=${lib.getDev suitesparse}/include - '' + lib.optionalString withGsl '' - export CVXOPT_BUILD_GSL=1 - export CVXOPT_GSL_LIB_DIR=${lib.getLib gsl}/lib - export CVXOPT_GSL_INC_DIR=${lib.getDev gsl}/include - '' + lib.optionalString withGlpk '' - export CVXOPT_BUILD_GLPK=1 - export CVXOPT_GLPK_LIB_DIR=${lib.getLib glpk}/lib - export CVXOPT_GLPK_INC_DIR=${lib.getDev glpk}/include - '' + lib.optionalString withFftw '' - export CVXOPT_BUILD_FFTW=1 - export CVXOPT_FFTW_LIB_DIR=${lib.getLib fftw}/lib - export CVXOPT_FFTW_INC_DIR=${lib.getDev fftw}/include - ''; + env = { + CVXOPT_BLAS_LIB = "blas"; + CVXOPT_LAPACK_LIB = "lapack"; + CVXOPT_BUILD_DSDP = "0"; + CVXOPT_SUITESPARSE_LIB_DIR = "${lib.getLib suitesparse}/lib"; + CVXOPT_SUITESPARSE_INC_DIR = "${lib.getDev suitesparse}/include"; + } // lib.optionalAttrs withGsl { + CVXOPT_BUILD_GSL = "1"; + CVXOPT_GSL_LIB_DIR= "${lib.getLib gsl}/lib"; + CVXOPT_GSL_INC_DIR= "${lib.getDev gsl}/include"; + } // lib.optionalAttrs withGlpk { + CVXOPT_BUILD_GLPK = "1"; + CVXOPT_GLPK_LIB_DIR = "${lib.getLib glpk}/lib"; + CVXOPT_GLPK_INC_DIR = "${lib.getDev glpk}/include"; + } // lib.optionalAttrs withFftw { + CVXOPT_BUILD_FFTW = "1"; + CVXOPT_FFTW_LIB_DIR = "${lib.getLib fftw}/lib"; + CVXOPT_FFTW_INC_DIR = "${lib.getDev fftw}/include"; + }; nativeCheckInputs = [ unittestCheckHook ];