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

fix: do not rely on which program during configuration #1232

Merged
merged 2 commits into from Feb 11, 2024

Conversation

szhorvat
Copy link
Member

@szhorvat szhorvat commented Feb 10, 2024

This PR avoids reliance on the which utility, which may not be present on all systems. It addresses complaints like this one: NixOS/nixpkgs#286406

It also renamed xml2_include_paths to lilbxml2_cflags to better reflect what this variable contains.

Copy link
Contributor

aviator-app bot commented Feb 10, 2024

Current Aviator status

Aviator will automatically update this comment as the status of the PR changes.
Comment /aviator refresh to force Aviator to re-examine your PR (or learn about other /aviator commands).

This PR was merged using Aviator.


See the real-time status of this PR on the Aviator webapp.
Use the Aviator Chrome Extension to see the status of your PR within GitHub.

@szhorvat szhorvat requested a review from krlmlr February 10, 2024 19:07
@szhorvat
Copy link
Member Author

Second commits adds libxml2 library detection in the configure script.

Copy link
Contributor

@krlmlr krlmlr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking this on.

configure Show resolved Hide resolved
@szhorvat
Copy link
Member Author

R says,

possible bashism in configure line 5 ('command' with option other than -p):

even though -v is in the POSIX standard.

It is ironic that -p, the only flag they allow, doesn't actually work on macOS ...

@krlmlr
Copy link
Contributor

krlmlr commented Feb 10, 2024

🤷

The upstream issue just mentions that they need "which" as a package dependency, not that we must fix here.

@szhorvat
Copy link
Member Author

szhorvat commented Feb 10, 2024

@krlmlr I think the current version should work. It should be reasonably safe to try to run these commands (xml2-config and pkg-config) as a means of detecting their availability. Also committed the missing Makevars.in change. Please have another look.

Note that for the library detection I requested the flags required when libxml2 is a static library. I believe this won't hurt when it is actually a shared library, but it will allow using a static one as well.

If we only wanted shared ones, we'd need xml2-config --libs --dynamic and pkg-config --libs libxml-2.0.

Copy link
Contributor

@krlmlr krlmlr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@@ -10,6 +10,6 @@ PKG_CPPFLAGS=-DUSING_R -I. -Ivendor -Ivendor/cigraph/src -Ivendor/cigraph/includ
-DHAVE_GFORTRAN=1 \
-D_GNU_SOURCE=1

PKG_LIBS = -lxml2 -lz -lglpk -lgmp $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)
PKG_LIBS = -lglpk -lgmp @libs@ $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The order change may or may not be relevant. Let's see.

@krlmlr krlmlr added this to the phoenix 🔥 milestone Feb 11, 2024
@aviator-app aviator-app bot force-pushed the fix/avoid-which-in-configure branch from 4eb90d7 to ddfed18 Compare February 11, 2024 08:58
@aviator-app aviator-app bot merged commit 73e5bb1 into main Feb 11, 2024
25 checks passed
@aviator-app aviator-app bot deleted the fix/avoid-which-in-configure branch February 11, 2024 09:28
@szhorvat
Copy link
Member Author

@Antonov548 Do we actually need libxml2_cflags="" at the beginning of the configure script? If not, let's remove it. If yes, can you explain why, and perhaps also add libxml2_libs=""?

@Antonov548
Copy link
Contributor

Antonov548 commented Feb 12, 2024

@Antonov548 Do we actually need libxml2_cflags="" at the beginning of the configure script? If not, let's remove it. If yes, can you explain why, and perhaps also add libxml2_libs=""?

Don't really need it anymore #1235
I think it was needed when parsing of cflags was in configure script.

@PhDyellow
Copy link

Thanks for noticing the Nix PR! I think Nix is a great ecosystem for reproducible research and I am actively using it with R, but it does require updates as upstream packages change. Nix also has a very different way of approaching dependencies than most operating systems and package managers.

https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/r-modules/default.nix contains most of the nix-specific tweaks we make to ensure R packages have the right system-level dependencies and settings. R package dependencies are automatically extracted from CRAN.

I opened NixOS/nixpkgs#286406 because the error message was cryptic. If the build had immediately errored with "which - not found on system" the R ecosystem maintainers would have known exactly what to do. Once the next igraph version hits CRAN, the build will break anyway because glpk hasn't been added as an igraph system dependency in Nix yet, but the error message is clear and will be quickly fixed. PRs welcome too.

Of course, removing which as a dependency doesn't hurt.

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

4 participants