How to obtain an absolute path within a Genrule #21522
Unanswered
beautifulnight
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I wanted to create symbolic link of a file from srcs and got error with:
bash.exe failed: error executing command (from target //demo:symlink) C:\Program Files\Git\bin\bash.exe -c source external/bazel_tools/tools/genrule/genrule-setup.sh; ln -s demo/some_file bazel-out/x64_windows-fastbuild/bin/demo/some_file_symlink ln: failed to create symbolic link 'bazel-out/x64_windows-fastbuild/bin/demo/some_file_symlink': No such file or directory
or using batch:
with error msg:
INFO: From Executing genrule //demo:symlink_bat: 为 some_file_symlink_bat <<===>> demo\some_file 创建的符号链接 ERROR: D:/demo/BUILD:314:8: declared output 'demo/some_file_symlink_bat' was not created by genrule. This is probably because the genrule actually didn't create this output, or because the output was a directory and the genrule was run remotely (note that only the contents of declared file outputs are copied from genrules run remotely)
However, I was able to successfully copy the file, like below:
I think the problem is the path. The predefined varables provided by genrule use relative path to Workspace but I need absolute path of the source file to create symlink and how can I get an absolute path in genrule?
Thinks a lot :)
Beta Was this translation helpful? Give feedback.
All reactions