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

Example genrule doesn't work #866

Closed
dfabulich opened this issue Feb 8, 2016 · 4 comments
Closed

Example genrule doesn't work #866

dfabulich opened this issue Feb 8, 2016 · 4 comments

Comments

@dfabulich
Copy link
Contributor

https://github.com/dfabulich/genrule_example

https://github.com/dfabulich/genrule_example/blob/master/BUILD is copied and pasted from the documentation http://bazel.io/docs/be/general.html#genrule

genrule(
    name = "foo",
    srcs = [],
    outs = ["foo.h"],
    cmd = "$(location create_foo.pl) > \"$@\"",
    tools = ["create_foo.pl"],
)

create_foo.pl is a one-line script.

https://github.com/dfabulich/genrule_example/blob/master/create_foo.pl

#!/usr/bin/env perl

print "FOO\n"

But when I try to run it, my build fails.

$ bazel build //:foo
INFO: Found 1 target...
INFO: From Executing genrule //:foo:
/bin/bash: create_foo.pl: command not found
ERROR: /private/tmp/tp/genrule_example/BUILD:1:1: Executing genrule //:foo failed: bash failed: error executing command /bin/bash -c 'source external/bazel_tools/tools/genrule/genrule-setup.sh; create_foo.pl > "bazel-out/local_darwin-fastbuild/genfiles/foo.h"': com.google.devtools.build.lib.shell.BadExitStatusException: Process exited with status 127.
Target //:foo failed to build
@ahumesky
Copy link
Contributor

ahumesky commented Feb 9, 2016

Yeah, the command should start with "./" or use "perl" explicitly.

@bsilver8192
Copy link
Contributor

Is this the same issue as #347?

@dfabulich
Copy link
Contributor Author

@bsilver8192 Yes, I believe so.

bazel-io pushed a commit that referenced this issue Feb 15, 2016
Fixes issue #866

--
Reviewed-on: #869
MOS_MIGRATED_REVID=114680542
@helenalt
Copy link
Contributor

helenalt commented Feb 9, 2018

This is now fixed per updated doc

@helenalt helenalt closed this as completed Feb 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants