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

Doesn't work on macOS #42

Open
eilvelia opened this issue Nov 6, 2020 · 4 comments
Open

Doesn't work on macOS #42

eilvelia opened this issue Nov 6, 2020 · 4 comments

Comments

@eilvelia
Copy link

eilvelia commented Nov 6, 2020

Executing opam switch create . ocaml-base-compiler.4.10.1 on macOS 10.14.6 fails with:

# fatal exception Failure("Command 'tar -cf /Users/user/test/_opam/.opam-switch/opam-bin/ocaml-base-compiler-bin.tar.gz.tmp --mtime=2020/07/13 --group=user:1000 --owner=user:1000 --transform s|^|prefix/|S bin/ocaml bin/ocaml-instr-graph bin/ocaml-instr-report bin/ocamlc bin/ocamlc.byte bin/ocamlc.opt bin/ocamlcmt bin/ocamlcp bin/ocamlcp.byte bin/ocamlcp.opt bin/ocamldebug bin/ocamldep bin/oca[...]
# Raised at Stdlib.failwith in file "stdlib.ml", line 29, characters 17-33
# Called from Opam_bin_lib__Misc.tar_zcf in file "src/opam_bin_lib/misc.ml", line 121, characters 6-45
# Called from Opam_bin_lib__CommandPostInstall.commit in file "src/opam_bin_lib/commandPostInstall.ml", line 283, characters 12-69
# Called from Cmdliner_term.app.(fun) in file "cmdliner_term.ml", line 25, characters 19-24
# Called from Cmdliner.Term.run in file "cmdliner.ml", line 117, characters 32-39
# Called from Cmdliner.Term.term_eval in file "cmdliner.ml", line 147, characters 18-36
# Called from Cmdliner.Term.eval_choice in file "cmdliner.ml", line 265, characters 22-48
# Called from Ezcmd.main_with_subcommands in file "src/ezcmd.ml", line 194, characters 8-54
# Called from Opam_bin_lib__Main.main in file "src/opam_bin_lib/main.ml", line 45, characters 6-191
#

BSD tar doesn't have options like group, owner, etc. That seems to be the reason.

Update: opam-bin seems to use other options that don't exist on BSD, like -T from cp. These options aren't part of the POSIX standard.

@lefessan
Copy link
Member

lefessan commented Nov 7, 2020

It looks like gnu-tar is available in brew and called gtar, I will modify the code to use it on Mac OS.
Any idea of what the equivalent is for cp -T on Mac OS ?

@eilvelia
Copy link
Author

eilvelia commented Nov 7, 2020

Looks like BSD cp has similar behaviour if the source ends with /

If the source_file ends in a /, the contents of the directory are copied rather than the directory itself

$ tree
.
├── test1
│   ├── file1
│   └── file2
└── test2
$ cp -a test1/ test2
$ tree
.
├── test1
│   ├── file1
│   └── file2
└── test2
    ├── file1
    └── file2

GNU cp, though, treats test1 and test1/ the same.

@mattjbray
Copy link

A workaround is to install gnu-tar and coreutils:

brew install coreutils gnu-tar

Then add the gnubin directories to your path (as directed by the brew caveats):

export PATH="/usr/local/opt/coreutils/libexec/gnubin:/usr/local/opt/gnu-tar/libexec/gnubin:$PATH"

Then opam-bin will find the GNU versions of tar and ls.

@yawaramin
Copy link

I'm getting I guess the same error, with a little more output:

### output ###
# tar: Option --mtime=2020/07/13 is not supported
# Usage:
#   List:    tar -tf <archive-filename>
#   Extract: tar -xf <archive-filename>
#   Create:  tar -cf <archive-filename> [filenames...]
#   Help:    tar --help
# fatal exception Failure("Command 'tar -cf /Users/me/src/github.com/yawaramin/odoc/_opam/.opam-switch/opam-bin/ocaml-base-compiler-bin.tar.gz.tmp --mtime=2020/07/13 --group=user:1000 --owner=user:1000 --transform s|^|prefix/|S bin/ocaml bin/ocamlc bin/ocamlc.byte bin/ocamlc.opt bin/ocamlcmt bin/ocamlcp bin/ocamlcp.byte bin/ocamlcp.opt bin/ocamldebug bin/ocamldep bin/ocamldep.byte [...]

On macOS without GNU coreutils. Any way we can make this work without the coreutils workaround? I would love to use opam-bin but can't if it can't create switches or if I need duplicate copies of Unix tools (which also make a Windows port more difficult).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants