Skip to content
This repository was archived by the owner on Apr 29, 2025. It is now read-only.
This repository was archived by the owner on Apr 29, 2025. It is now read-only.

MacOS: install has different options there #31

@hzeller

Description

@hzeller

Version: bazel_rules_install tag 0.4. Not sure what MacOS exactly, uname spits out something like Darwin Kernel Version 19.6.0

When compiling a project that compiles with bazel on MacOS (in my case: verible), the install procedure is not working, possibly because the install on MacOS is a BSD install, not GNU install.

In particular it seems to stumble upon the -- separator between options and arguments.

bazel run -c opt :install -- ~/bin
#.... 
install: illegal option -- -
usage: install [-bCcpSsv] [-B suffix] [-f flags] [-g group] [-m mode]
               [-o owner] file1 file2
       install [-bCcpSsv] [-B suffix] [-f flags] [-g group] [-m mode]
               [-o owner] file1 ... fileN directory
       install -d [-v] [-g group] [-m mode] [-o owner] directory ...

Looking at the bazel-bin/_install_gen.sh (which I suspect is the one invoked) contains the following snippet, which is possibly the culprit:

  $sudo install --mode="${target_mode}" \
    -T -- "${source}" "${target_dir}/${target_name}"

I know that MacOS is still on the TODO list, but I hope this actual use-case might help raise the awareness (we just recently were able to get the project to compile on MacOS, so this would be the final stumbling block).

Maybe as a first step, the -- could only be emitted if the target looks like it would be in danger to be interpreted as option ? Given that binaries rarely (if ever) start with dash, this should fix the typical use-case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions