Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rPackages.ChemmineOB: fix compile error #351013

Merged
merged 1 commit into from
Oct 31, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 13 additions & 16 deletions pkgs/development/r-modules/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -801,7 +801,7 @@ let
sphereTessellation = with pkgs; [ gmp.dev mpfr.dev ];
vapour = with pkgs; [ proj.dev gdal ];
MedianaDesigner = [ pkgs.zlib.dev ];
ChemmineOB = [ pkgs.eigen ];
ChemmineOB = with pkgs; [ eigen openbabel ];
DGP4LCF = [ pkgs.lapack pkgs.blas ];
};

Expand Down Expand Up @@ -1582,29 +1582,26 @@ let
PKGCONFIG_LIBS = "-Wl,-rpath,${lib.getLib pkgs.openssl}/lib -L${lib.getLib pkgs.openssl}/lib -L${pkgs.cyrus_sasl.out}/lib -L${pkgs.zlib.out}/lib -lssl -lcrypto -lsasl2 -lz";
});

ChemmineOB = let
# R package doesn't compile with the latest (unstable) version.
# Override from nixpkgs-23.11
openbabel3 = pkgs.openbabel.overrideAttrs (attrs: {
version = "3.1.1";
src = pkgs.fetchFromGitHub {
owner = "openbabel";
repo = "openbabel";
rev = "openbabel-${lib.replaceStrings ["."] ["-"] attrs.version}";
sha256 = "sha256-wQpgdfCyBAoh4pmj9j7wPTlMtraJ62w/EShxi/olVMY=";
};
});
in
old.ChemmineOB.overrideAttrs (attrs: {
ChemmineOB = old.ChemmineOB.overrideAttrs (attrs: {
# pkg-config knows openbabel-3 without the .0
# Eigen3 is also looked for in the wrong location
# pointer was changed in newer version of openbabel:
# https://github.com/openbabel/openbabel/commit/305a6fd3183540e4a8ae1d79d10bf1860e6aa373
jbedo marked this conversation as resolved.
Show resolved Hide resolved
postPatch = ''
substituteInPlace configure \
--replace-fail openbabel-3.0 openbabel-3
substituteInPlace src/Makevars.in \
--replace-fail "-I/usr/include/eigen3" "-I${pkgs.eigen}/include/eigen3"
substituteInPlace src/ChemmineOB.cpp \
--replace-fail "obsharedptr<" "std::shared_ptr<"
'';
buildInputs = attrs.buildInputs ++ [openbabel3];

# copied from fastnlo-toolkit:
# None of our currently packaged versions of swig are C++17-friendly
# Use a workaround from https://github.com/swig/swig/issues/1538
env = (attrs.env or { }) // {
NIX_CFLAGS_COMPILE = (attrs.env.NIX_CFLAGS_COMPILE or "") + lib.optionalString stdenv.hostPlatform.isDarwin " -D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES";
};
});

ps = old.ps.overrideAttrs (attrs: {
Expand Down