grimbough / rhdf5

Package providing an interface between HDF5 and R
http://bioconductor.org/packages/rhdf5
60 stars 21 forks source link

external_filters.h:1:9: error: no macro name given in #define directive #91

Closed dbdimitrov closed 1 year ago

dbdimitrov commented 3 years ago

Hi @grimbough,

I'm trying to install rhdf5 (SingleCellExperiment really), but I encounter the following error when trying to install from BioConductor: [removed image as it contains personal paths]

and another error when trying to install via: devtools::install_github("https://github.com/grimbough/rhdf5")

[removed image as it contains personal paths]

─ Session info ──────────────────────────────────────────────── setting value
version R version 4.0.3 (2020-10-10) os Ubuntu 20.04.2 LTS
system x86_64, linux-gnu
ui RStudio
language (EN)
collate en_US.UTF-8
ctype en_US.UTF-8
tz Europe/Berlin
date 2021-08-05

─ Packages ────────────────────────────────────────────────── ! package version date lib source
P askpass 1.1 2019-01-13 [?] CRAN (R 4.0.3) R BiocManager
1.30.16 [?]
P cachem 1.0.5 2021-05-15 [?] CRAN (R 4.0.3) R callr 3.7.0 [?]
P cli 3.0.1 2021-07-17 [?] CRAN (R 4.0.3) P crayon 1.4.1 2021-02-08 [?] CRAN (R 4.0.3) R credentials * 1.3.1 [?]
P curl 4.3.2 2021-06-23 [?] CRAN (R 4.0.3) R desc 1.3.0 [?]
R devtools 2.4.2 [?]
P ellipsis 0.3.2 2021-04-29 [?] CRAN (R 4.0.3) P fansi 0.5.0 2021-05-25 [?] CRAN (R 4.0.3) P fastmap 1.1.0 2021-01-25 [?] CRAN (R 4.0.3) P fs 1.5.0 2020-07-31 [?] CRAN (R 4.0.3) P glue 1.4.2 2020-08-27 [?] CRAN (R 4.0.3) P jsonlite 1.7.2 2020-12-09 [?] CRAN (R 4.0.3) P lifecycle 1.0.0 2021-02-15 [?] CRAN (R 4.0.3) P magrittr 2.0.1 2020-11-17 [?] CRAN (R 4.0.3) R memoise 2.0.0 [?]
P openssl 1.4.4 2021-04-30 [?] CRAN (R 4.0.3) P pillar 1.6.2 2021-07-29 [?] CRAN (R 4.0.3) R pkgbuild 1.2.0 [?]
P pkgconfig 2.0.3 2019-09-22 [?] CRAN (R 4.0.3) R pkgload 1.2.1 [?]
P prettyunits 1.1.1 2020-01-24 [?] CRAN (R 4.0.3) R processx 3.5.2 [?]
R ps 1.6.0 [?]
P purrr 0.3.4 2020-04-17 [?] CRAN (R 4.0.3) P R6 2.5.0 2020-10-28 [?] CRAN (R 4.0.3) P remotes 2.4.0 2021-06-02 [?] CRAN (R 4.0.3) VP renv 0.12.5 2021-07-21 [?] CRAN (R 4.0.3) P rlang 0.4.11 2021-04-30 [?] CRAN (R 4.0.3) R rprojroot 2.0.2 [?]
R rstudioapi 0.13 [?]
R sessioninfo 1.1.1 [?]
P sys 3.4 2020-07-23 [?] CRAN (R 4.0.3) R testthat 3.0.4 [?]
P tibble 3.1.3 2021-07-23 [?] CRAN (R 4.0.3) R usethis 2.0.1 [?]
P utf8 1.2.2 2021-07-24 [?] CRAN (R 4.0.3) P vctrs 0.3.8 2021-04-29 [?] CRAN (R 4.0.3) P withr 2.4.2 2021-04-18 [?] CRAN (R 4.0.3)

V ── Loaded and on-disk version mismatch. P ── Loaded and on-disk path mismatch. R ── Package was removed from disk.

grimbough commented 3 years ago

The error looks like it's because something inappropriate gets inserted into the external_filters.h file, and then the compilation of the package fails. It's suppose to detect whether the rhdf5filters package is installed, and then insert either _H5P_filters or undef into that file, however it looks like you're getting something else printed instead.

I'm concerned by the .Renviron contains invalid line(s) statement that appears, that doesn't sound good and is probably what's being printed instead.

The code that adds to that header is below. What do you see if you run that in a command terminal?

Rscript" -e 'cat(if(require("rhdf5filters", quietly = TRUE)) "_H5P_filters" else "undef")'
dbdimitrov commented 3 years ago

Hi @grimbough,

Thank you so much for your prompt response!

Indeed, it was an inappropriate symbol in the .Renviron.

jan-glx commented 2 years ago

I also just got hit by this (my .Rprofile prints stuff). Perhaps you can change Rscript -e 'cat(if(require("rhdf5filters", quietly = TRUE)) "_H5P_filters" else "undef")' to something like Rscript -e 'quit(status=require("rhdf5filters", quietly = TRUE))' "_H5P_filters" else "undef")' && echo _H5P_filters || echo undef ?

grimbough commented 2 years ago

@jan-glx which version of rhdf5 are you trying to install? That line currently has a tail -n1 after it.

https://github.com/grimbough/rhdf5/blob/c053f51d186504a5bb6273c33f2aeaae9939db0c/configure.ac#L9-L10

Just want to make sure it's the current implementation that's failing for you.

jan-glx commented 2 years ago

3.13 (, and HEAD of master) The fix with the tail was probably enough for the vast majority of cases. In my case, my .Rprofile would print a single @ char without newline (to be able to see that is has run completely but without making much noise). Accordingly it took me quite a while to figure out what the problem was. (I jut got rid of the @ for now, so this is not urgent)

grimbough commented 2 years ago

I like the suggestion, I just think it needs to be !require(...) as bash will treat a return code of 0 as success e.g.

https://github.com/grimbough/rhdf5/blob/fbb3f7b1ac05a6ee8cd8f54f78f490ddd461fc97/configure.ac#L9

Hopefully that works. Can you test with your original .Rprofile and install from master again?

jan-glx commented 2 years ago

Unfortunately is does not work (by bad). The output still shows up. One could redirect it by inserting > \dev\null or >&2 before the &&. Perhaps one could even keep the output on stdout and fix this somehow differently but I have no experience with configure scripts.

grimbough commented 2 years ago

So what's the final part of your .Rprofile? Is it just cat("@") ? Let me know and I'll work with a local copy to try and get this suppressed. rhdf5 isn't the only package that uses this approach in configure, so it's good to find these edge cases and try to make it more robust.

jan-glx commented 2 years ago

Yes, just cat("@").