Closed Topaz1618 closed 10 months ago
load("@bazel_tools//tools/build_defs/pkg:pkg.bzl", "pkg_tar") is unsupported, and not from rules_pkg Use @rules_pkg//pkg:tar.bzl", "pkg.tar")
Thank u. I've tried to build rpm using Bazel, and facing the bellow issue.
main/BUILD
$ cat main/BUILD
load("@rules_pkg//pkg:rpm.bzl", "pkg_rpm")
cc_binary(
name = "hello",
srcs = ["hello.cc"],
)
pkg_rpm(
name="hello_rpm",
srcs = [":hello"],
license = "Internal",
package_file_name = "hello.rpm",
summary = "test",
)
output
$ bazel build main:hello
INFO: Analyzed target //main:hello (1 packages loaded, 2 targets configured).
INFO: Found 1 target...
Target //main:hello up-to-date:
bazel-bin/main/hello
INFO: Elapsed time: 0.183s, Critical Path: 0.00s
INFO: 1 process: 1 internal.
INFO: Build completed successfully, 1 total action
I can not find my rpm package by using this BUILD file.
$ find . -name "hello.rpm"
$
However, if I specify the out attribute get the below issue (The pkg_tar can specify "out" attribute)
$ bazel build main:hello
ERROR: /home/topaz/Projects/BazelDemo/stage4/main/BUILD:8:8: //main:hello_rpm: no such attribute 'out' in 'pkg_rpm' rule
ERROR: Skipping 'main:hello': Error evaluating 'main:hello': error loading package 'main': Package 'main' contains errors
WARNING: Target pattern parsing failed.
ERROR: Error evaluating 'main:hello': error loading package 'main': Package 'main' contains errors
INFO: Elapsed time: 0.112s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (1 packages loaded)
Could u take a look anything wrong of the BUILD file
If you want the rpm, you should do bazel build main:hello_rpm
'
Also, find .
won't work. Output is in bazel-bin, so you need find bazel-bin/. ...
Hi, I want to use bazel to package my folder and facing below issue. Could you take a look? Is there any example of how to use this?
Error info
Bazel version
Structure
WORKSPACE
main/BUILD