bovee / entab

* -> TSV
MIT License
21 stars 5 forks source link

Error installing entab-cli #25

Closed ethanbass closed 2 years ago

ethanbass commented 2 years ago

This seems like a really useful project! Unfortunately, I have not yet been able to install the CLI. I get a number of errors when I run cargo install entab-cli as suggested in the read me (reproduced below). I also get a similar set of errors when I try to install the R bindings. I am running Mac OS 12.2.1 (on a m1 mac) with rustc 1.59.0. I have not really used rust before, so I'm not sure if there's some obvious problem I might be missing. Please let me know if there's any further information I can provide. Thanks!

   Compiling entab-cli v0.2.2
error[E0432]: unresolved imports `clap::crate_authors`, `clap::crate_version`
 --> /Users/ethanbass/.cargo/registry/src/github.com-1ecc6299db9ec823/entab-cli-0.2.2/src/main.rs:7:12
  |
7 | use clap::{crate_authors, crate_version, App, Arg};
  |            ^^^^^^^^^^^^^  ^^^^^^^^^^^^^ no `crate_version` in the root
  |            |
  |            no `crate_authors` in the root

error: cannot determine resolution for the macro `crate_authors`
  --> /Users/ethanbass/.cargo/registry/src/github.com-1ecc6299db9ec823/entab-cli-0.2.2/src/main.rs:21:17
   |
21 |         .author(crate_authors!())
   |                 ^^^^^^^^^^^^^
   |
   = note: import resolution is stuck, try simplifying macro imports

error: cannot determine resolution for the macro `crate_version`
  --> /Users/ethanbass/.cargo/registry/src/github.com-1ecc6299db9ec823/entab-cli-0.2.2/src/main.rs:22:18
   |
22 |         .version(crate_version!())
   |                  ^^^^^^^^^^^^^
   |
   = note: import resolution is stuck, try simplifying macro imports

error[E0599]: no method named `about` found for struct `Arg` in the current scope
  --> /Users/ethanbass/.cargo/registry/src/github.com-1ecc6299db9ec823/entab-cli-0.2.2/src/main.rs:26:18
   |
26 |                 .about("Path to read; if not provided stdin will be used")
   |                  ^^^^^ method not found in `Arg<'_>`

error[E0599]: no method named `about` found for struct `Arg` in the current scope
  --> /Users/ethanbass/.cargo/registry/src/github.com-1ecc6299db9ec823/entab-cli-0.2.2/src/main.rs:32:18
   |
32 |                 .about("Path to write to; if not provided stdout will be used")
   |                  ^^^^^ method not found in `Arg<'_>`

error[E0599]: no method named `about` found for struct `Arg` in the current scope
  --> /Users/ethanbass/.cargo/registry/src/github.com-1ecc6299db9ec823/entab-cli-0.2.2/src/main.rs:38:18
   |
38 |                 .about("Parser to use [if not specified, file type will be auto-detected]")
   |                  ^^^^^ method not found in `Arg<'_>`

error[E0599]: no method named `about` found for struct `Arg` in the current scope
  --> /Users/ethanbass/.cargo/registry/src/github.com-1ecc6299db9ec823/entab-cli-0.2.2/src/main.rs:45:18
   |
45 |                 .about("Reports metadata about the file instead of the data itself"),
   |                  ^^^^^ method not found in `Arg<'_>`

Some errors have detailed explanations: E0432, E0599.
For more information about an error, try `rustc --explain E0432`.
bovee commented 2 years ago

Thanks so much!

Unfortunately the last stable version of the CLI is relying on an old/mismatched version of clap so I don't think it'll work anymore, but you should be able to install the CLI by pinning the version to the current alpha (cargo install entab-cli --version 0.3.0-alpha.1)

I think the R package probably has a similar issue in that it's dependent on crates.io instead of the git version because of how R builds it. Both should work once I push 0.3.0, but I wanted to figure out a couple big API things before that (mostly #24 at this point). I can futz with it a little this week and see if there's not a temporary fix though.

ethanbass commented 2 years ago

Thanks! I was able to install the alpha version off of git using cargo install entab-cli --git https://github.com/bovee/entab/

I did get a couple of warnings. I have no idea what they mean, but I'm including them here in case they're helpful at all. Thanks for all your work on this project.

   Compiling entab-cli v0.3.0-alpha.1 (/Users/ethanbass/.cargo/git/checkouts/entab-b7f8b9e3abc50bda/0ae2760/entab-cli)
warning: variant is never constructed: `Escape`
  --> entab-cli/src/tsv_params.rs:11:5
   |
11 |     Escape(u8),
   |     ^^^^^^^^^^
   |
   = note: `#[warn(dead_code)]` on by default

warning: variant is never constructed: `Replace`
  --> entab-cli/src/tsv_params.rs:12:5
   |
12 |     Replace(u8),
   |     ^^^^^^^^^^^
bovee commented 2 years ago

The warnings are because I wrote an overly complicated system to allow e.g. escaping or replacing commas when outputting CSVs, but haven't actually wired it up to the CLI interface so the compiler keeps complaining about it. It shouldn't affect anything though.

I just tried pushing out a new alpha version of entab and pinning the R library off it and it looks like it installs properly now with the directions in the README. Thanks so much for reporting these issues!

ethanbass commented 2 years ago

Cool. I was able to install the new version successfully on the command line, but I'm now getting a new error with the r package. Everything seems to compile fine, but then at the end I'm getting:

...Finished release [optimized] target(s) in 13.48s
cp ../target/release/libentab.so .
cp: ../target/release/libentab.so: No such file or directory
make: *** [all] Error 1
ERROR: compilation failed for package ‘entab’
bovee commented 2 years ago

Weird. I think I know why that happened, but I'm not sure why it didn't happen locally. Maybe 132495c7810b52f3c4f7f2306f82580bc83a010f will fix it?

ethanbass commented 2 years ago

Unfortunately not. I'm still getting the same error

ethanbass commented 2 years ago

(I see libentab.dylib and libentab.d in the /target/release directory, but no libentab.so)

ethanbass commented 2 years ago

I got it to install (!) by editing the last line of the makefile like this:

cp ../target/release/libentab.dylib ./libentab.so

I don't know if that will break it on linux or something though. I think it might be some kind of platform-dependent issue where mine is building with .dylib and yours is building with .so? (It seems to be working!)

ethanbass commented 2 years ago

I think this issue may be relevant: https://github.com/rust-lang/rust/issues/21727

bovee commented 2 years ago

I think the rust-lang issue is about iOS specifically? Rust builds dynamic libraries for each platform with different formats/extensions (Linux is so, Mac is dylib, Windows is dll). As far as I can tell, most other Rust-R bindings get around this by building into a static library and then have a wrapper in C that interfaces between that and R. I wonder if this is required for CRAN?

I redid the Makefile into Makevars (most other projects use this instead?) in 4efd71bdf148aa4dff326ed3b60529789c0190ab and added a case for Mac OS X. Let me know if this finally fixes it.

(If anyone is looking at this in the future, this won't support Windows at all and we'll have to add a Makevars.win with the right build arguments which will probably require actually futzing with a Windows box.)

ethanbass commented 2 years ago

I'm getting a slightly different error now. I guess it's still looking for the lientab.so file?

"Error: package or namespace load failed for ‘entab’ in library.dynam(lib, package, package.lib):
 shared object ‘libentab.so’ not found"

It seems to be running the Makevars sequence successfully, but fails while "** testing if installed package can be loaded from temporary location". I guess this is a bug with R inserting the wrong suffix for the library when it is trying to load the package?

bovee commented 2 years ago

Yeah, I don't understand why R is trying to load it as a so library on Mac OS? Super weird. I just tried redoing the Mac-specific side to copy what you were doing moving the dylib into a so file in 4283059fd634723a6d0a0d7a763b562be5e1d4ef. If that doesn't work, I'll probably have to borrow a Mac to futz around with.

ethanbass commented 2 years ago

I can't say I really understand it either, but that seems to have done the trick! I just installed the r package from your last commit without even a warning