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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

symphony: init at 5.7.2 and rPackages.Rsymphony #305301

Merged
merged 3 commits into from
May 3, 2024

Conversation

b-rodrigues
Copy link
Contributor

@b-rodrigues b-rodrigues commented Apr 19, 2024

Description of changes

EDIT: 2024-04-20 thanks to the help of @jbedo and @Kupac , this works now! Tested with example from documentation:

library(Rsymphony)

obj <- c(2, 4, 3)
mat <- matrix(c(3, 2, 1, 4, 1, 3, 2, 1, 2), nrow = 3)
dir <- c("<=", "<=", "<=")
rhs <- c(60, 40, 80)
max <- TRUE
Rsymphony_solve_LP(obj, mat, dir, rhs, max = max)

This PR contains two commits: one that adds the Symphony solver, and another that fixes the build for the R package.

Original message:
Trying to fix rPackages.Rsymphony. I've first added the symphony software in pkgs/by-name/sy/symphony/package.nix and this builds successfully. I'm able to drop in a shell and execute it with:

nix-shell -I nixpkgs=. -p symphony

When building it, the following message appears:

Libraries have been installed in:
   /nix/store/r11wx6bcf8kxfdkigspbbdzgg4mvq6yf-symphony-5.7.2/lib

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,--rpath -Wl,LIBDIR' linker flag

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.

Trying to build the R packages, rPackages.Rsymphony doesn't succeed, so I tried to add:

    Rsymphony = old.Rsymphony.overrideAttrs (attrs: {
      preConfigure = ''
        export LD_RUN_PATH="${lib.getLib pkgs.symphony}/lib/"
      '';
    });

but trying to build results in the following error:

error: builder for '/nix/store/n310bh4kfhakzdzwrccgygh4b9d5vl3n-r-Rsymphony-0.1-33.drv' failed with exit code 1;
       last 10 log lines:
       > Running phase: buildPhase
       > Running phase: checkPhase
       > Running phase: installPhase
       > * installing *source* package 'Rsymphony' ...
       > ** package 'Rsymphony' successfully unpacked and MD5 sums checked
       > ** using staged installation
       > Cannot find SYMPHONY libraries and headers.
       > See <https://projects.coin-or.org/SYMPHONY>.
       > ERROR: configuration failed for package 'Rsymphony'
       > * removing '/nix/store/hfivzzxh1pw5rgfzc53mzxshra5wixva-r-Rsymphony-0.1-33/library/Rsymphony'
       For full logs, run 'nix log /nix/store/n310bh4kfhakzdzwrccgygh4b9d5vl3n-r-Rsymphony-0.1-33.drv'.

Any ideas?

By the way, I聽don't know if this should be an issue instead of a draft PR, so let me know if I should close this and open it as an issue instead.

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.05 Release Notes (or backporting 23.05 and 23.11 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 馃憤 reaction to pull requests you find important.

@b-rodrigues b-rodrigues requested a review from jbedo as a code owner April 19, 2024 12:19
@b-rodrigues b-rodrigues marked this pull request as draft April 19, 2024 12:19
@jbedo
Copy link
Contributor

jbedo commented Apr 19, 2024

I don't think you need your override, just add the missing dependencies for symphony (cgl & clp) to buildInputs. May as well move pkg-config to nativeBuildInputs too.

@b-rodrigues
Copy link
Contributor Author

I don't think you need your override, just add the missing dependencies for symphony (cgl & clp) to buildInputs. May as well move pkg-config to nativeBuildInputs too.

thanks for pointing out the missing deps of symphony! However, that doesn't seem to do the trick, Rsymphony still doesn't find symphony.

@jbedo
Copy link
Contributor

jbedo commented Apr 19, 2024

This works for me:

diff --git a/pkgs/development/r-modules/default.nix b/pkgs/development/r-modules/default.nix
index 35c784e9f021..8dae1810745b 100644
--- a/pkgs/development/r-modules/default.nix
+++ b/pkgs/development/r-modules/default.nix
@@ -520,6 +520,7 @@ let
     Rbwa = [ pkgs.zlib.dev ];
     trackViewer = [ pkgs.zlib.dev ];
     themetagenomics = [ pkgs.zlib.dev ];
+    Rsymphony = [ pkgs.pkg-config ];
     NanoMethViz = [ pkgs.zlib.dev ];
     RcppMeCab = [ pkgs.pkg-config ];
     HilbertVisGUI = with pkgs; [ pkg-config which ];
@@ -586,7 +587,7 @@ let
     mashr = [ pkgs.gsl ];
     hadron = [ pkgs.gsl ];
     AMOUNTAIN = [ pkgs.gsl ];
-    Rsymphony = with pkgs; [ pkg-config doxygen graphviz subversion ];
+    Rsymphony = with pkgs; [ symphony doxygen graphviz subversion cgl clp ];
     tcltk2 = with pkgs; [ tcl tk ];
     tikzDevice = with pkgs; [ which texliveMedium ];
     gridGraphics = [ pkgs.which ];
@@ -1240,12 +1241,6 @@ let
     });


-    Rsymphony = old.Rsymphony.overrideAttrs (attrs: {
-      preConfigure = ''
-        export LD_RUN_PATH="${lib.getLib pkgs.symphony}/lib/"
-      '';
-    });
-
     RPostgres = old.RPostgres.overrideAttrs (attrs: {
       preConfigure = ''
         export INCLUDE_DIR=${pkgs.postgresql}/include

@jbedo
Copy link
Contributor

jbedo commented Apr 19, 2024

Ah I should have looked at your commit first, I mean you needed to add it to Rsymphony not symphony.

@b-rodrigues b-rodrigues marked this pull request as ready for review April 20, 2024 19:41
@Sigmanificient
Copy link
Member

@b-rodrigues did you added yourself in the maintainer list?

@b-rodrigues b-rodrigues changed the title Trying to build rPackages.Rsymphony symphony: init at 5.7.2 and rPackages.Rsymphony Apr 20, 2024
@b-rodrigues
Copy link
Contributor Author

@b-rodrigues did you added yourself in the maintainer list?

yes, for symphony

@Sigmanificient
Copy link
Member

@b-rodrigues did you added yourself in the maintainer list?

yes, for symphony

I mean this one:
https://github.com/NixOS/nixpkgs/blob/master/maintainers/maintainer-list.nix

I cant find yourself in it

@b-rodrigues
Copy link
Contributor Author

@b-rodrigues did you added yourself in the maintainer list?

yes, for symphony

I mean this one: https://github.com/NixOS/nixpkgs/blob/master/maintainers/maintainer-list.nix

I cant find yourself in it

ops, sorry, no, first time adding a package. Should I add a commit adding myself as a maintainer to this PR?

@Sigmanificient
Copy link
Member

Sigmanificient commented Apr 20, 2024

Yes, you need to do it in 2 commits, one to add yourself, then one to init the package.
I recommend checking this section on how to become a maintainer & this nixpkgs manual section

@Sigmanificient
Copy link
Member

Sigmanificient commented Apr 20, 2024

you need to follow alphabetical order tho

maintainer brodes (line 2936) should be listed after brianmcgillion, not after b-rodrigues (line 2113)

The CI has very precise requirements

@b-rodrigues
Copy link
Contributor Author

thank you for your patience! Hope I didn't mess anything up

@Sigmanificient
Copy link
Member

thank you for your patience! Hope I didn't mess anything up

We are here to help, especially first contributors!
Ofborg-eval may take a bit of time

@Sigmanificient
Copy link
Member

Sigmanificient commented Apr 20, 2024

Can you add the Changelog file in meta attribute?

Like so

changelog = "https://github.com/coin-or/SYMPHONY/blob/${version}/CHANGELOG.md";

@b-rodrigues
Copy link
Contributor Author

Can you add the Changelog file in meta attribute?

Like so

changelog = "https://github.com/coin-or/SYMPHONY/blob/${version}/CHANGELOG.md";

yes, done!

@Sigmanificient
Copy link
Member

Result of nixpkgs-review pr 305301 run on x86_64-linux 1

1 package built:
  • symphony

@jbedo
Copy link
Contributor

jbedo commented Apr 21, 2024

@ofborg build rPackages.Rsymphony

@jbedo jbedo merged commit ff1b721 into NixOS:master May 3, 2024
30 checks passed
@b-rodrigues b-rodrigues deleted the add_symphony branch May 3, 2024 07:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants